From: Alan B on 21 Jul 2010 17:47 I have written a modified version of quiver that is more suitable for my work. The plotting works exactly as I want it to, but I use multiple "line" objects, which show up as normal line objects when I create a legend. How can I define custom graphics for the legend entries? I am about to delve into the code in @specgraph, but it makes use of properties that I have never used before, so it will take me some time to decipher it. I am hoping there is a straightforward answer, or maybe someone knows of a concise example on the file exchange? I found quiver2, but it is 33k, and I searched the code for "legend" and "annotation" and saw nothing - I'm not sure what else to look for. Thanks for any suggestions.
From: neil on 21 Jul 2010 19:15 "Alan B" <monguin61REM(a)OVETHIS.yahoo.com> wrote in message <i27pso$c4f$1(a)fred.mathworks.com>... > I have written a modified version of quiver that is more suitable for my work. The plotting works exactly as I want it to, but I use multiple "line" objects, which show up as normal line objects when I create a legend. How can I define custom graphics for the legend entries? > > I am about to delve into the code in @specgraph, but it makes use of properties that I have never used before, so it will take me some time to decipher it. I am hoping there is a straightforward answer, or maybe someone knows of a concise example on the file exchange? I found quiver2, but it is 33k, and I searched the code for "legend" and "annotation" and saw nothing - I'm not sure what else to look for. > > Thanks for any suggestions. If you know the handles of the line objects you want legend entries for you can use the following from the legend Doc legend(li_objects,M) creates a legend of legendinfo objects li_objects, where M is a string matrix or cell array of strings corresponding to the legendinfo objects. For example a = plot(rand(100,4)) legend(a(1:2),{'entry1','entry2'})
From: Alan B on 22 Jul 2010 11:00 "neil " <neil.iain(a)gmail.com> wrote in message <i27v1r$561$1(a)fred.mathworks.com>... > "Alan B" <monguin61REM(a)OVETHIS.yahoo.com> wrote in message <i27pso$c4f$1(a)fred.mathworks.com>... > > I have written a modified version of quiver that is more suitable for my work. The plotting works exactly as I want it to, but I use multiple "line" objects, which show up as normal line objects when I create a legend. How can I define custom graphics for the legend entries? > > > > I am about to delve into the code in @specgraph, but it makes use of properties that I have never used before, so it will take me some time to decipher it. I am hoping there is a straightforward answer, or maybe someone knows of a concise example on the file exchange? I found quiver2, but it is 33k, and I searched the code for "legend" and "annotation" and saw nothing - I'm not sure what else to look for. > > > > Thanks for any suggestions. > > If you know the handles of the line objects you want legend entries for you can use the following from the legend Doc > > legend(li_objects,M) creates a legend of legendinfo objects li_objects, where M is a string matrix or cell array of strings corresponding to the legendinfo objects. > > For example > > a = plot(rand(100,4)) > legend(a(1:2),{'entry1','entry2'}) I guess I wasn't clear. I want to call a single custom function, similar to quiver, that does these things: 1. plot a set of arrows according to input arguments, using 3 line objects - one for the arrows, one for the arrowheads, and one for markers at the arrow bases (this I have done). 2. group the 3 line objects together into a hggroup object, or something similar. 3. set some property of the hggroup object such that, when I later create a legend, the hggroup object generates a legend entry with a custom GRAPHIC (NOT text), that resembles the actual arrow graphics on the plot. For example, whenever you create a legend, entries for line objects show the correct color, thickness, markers, etc. Legend entries for surf objects show rectangular patches. Legend entries for quiver objects show small arrows. There is clearly some way to define the graphic that is displayed in the legend entry, I want to know how I can modify that graphic myself. I do NOT want to create a legend and then subsequently modify the graphic manually, I want to set some property of the hggroup, so that whenever a legend is created, the graphic automatically shows the custom graphic.
|
Pages: 1 Prev: help with retrieving information about pixels Next: Multiple figure windows |