Re: [Matplotlib-users] Omitting curves from a legend
Bill Baxter wrote: There are a couple things about legend that I'm finding a little irksome. Is there some better way to do this? 1) if you have a contour, legend() wants to add all the contours to the list. calling contour(...,label='_nolegend_') doesn't seem to help. I think it would be quite unusual that someone would want contour lines to show up in a legend, so I made the change I suggested in an earlier response to this thread: the LineCollections in the ContourSet now have their labels set to _nolegend_. If someone really does want contour lines in a legend, these labels still can be changed manually, as described earlier in this thread. Eric - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Omitting curves from a legend
On 4/18/07, Eric Firing [EMAIL PROTECTED] wrote: Bill Baxter wrote: There are a couple things about legend that I'm finding a little irksome. Is there some better way to do this? 1) if you have a contour, legend() wants to add all the contours to the list. calling contour(...,label='_nolegend_') doesn't seem to help. I think it would be quite unusual that someone would want contour lines to show up in a legend, so I made the change I suggested in an earlier response to this thread: the LineCollections in the ContourSet now have their labels set to _nolegend_. If someone really does want contour lines in a legend, these labels still can be changed manually, as described earlier in this thread. You can also use colorbar() to show the levels if you want that information to be visible, and that's probably more appropriate than a legend anyway. I think it's a good change. Thanks! --bb - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Omitting curves from a legend
On 4/13/07, Bill Baxter [EMAIL PROTECTED] wrote: There are a couple things about legend that I'm finding a little irksome. Is there some better way to do this? 1) if you have a contour, legend() wants to add all the contours to the list. calling contour(...,label='_nolegend_') doesn't seem to help. You should be able to set the _nolegend_ label property on the contour set line collections like so: cs = contour(...blah...) for coll in cs.collections: coll.set_label('_nolegend_') of use setp for the same purpose. setp(cs.collections, label='_nolegend_') contour doesn't use the kwargs to set the line collection properties, which is why it is not working in the contour commands. some plot commands use the kwargs to update the artist properties that the plot command creates, some do not, and the only way to know is the read the individual docstrings of the commands. Let me know if this works because it is untested. JDH - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Omitting curves from a legend
Maybe I should make _nolegend_ the default for contour and contourf collections? Eric John Hunter wrote: On 4/13/07, Bill Baxter [EMAIL PROTECTED] wrote: There are a couple things about legend that I'm finding a little irksome. Is there some better way to do this? 1) if you have a contour, legend() wants to add all the contours to the list. calling contour(...,label='_nolegend_') doesn't seem to help. You should be able to set the _nolegend_ label property on the contour set line collections like so: cs = contour(...blah...) for coll in cs.collections: coll.set_label('_nolegend_') of use setp for the same purpose. setp(cs.collections, label='_nolegend_') contour doesn't use the kwargs to set the line collection properties, which is why it is not working in the contour commands. some plot commands use the kwargs to update the artist properties that the plot command creates, some do not, and the only way to know is the read the individual docstrings of the commands. Let me know if this works because it is untested. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Omitting curves from a legend
Ok. Thanks. I'll give the setp on the ContourSet thing a try. Documentation issue/question: I figured there was probably some way to set attributes individually using the return value from contour since contour's docstring helpfully tells me that countour returns a ContourSet object. However, 'ContourSet?' in ipython gives me nothing. Similarly with plot(), it says it returns a 'list of lines' but that is not so useful since I can't look up the docstring for 'list of lines'. --bb On 4/17/07, Eric Firing [EMAIL PROTECTED] wrote: Maybe I should make _nolegend_ the default for contour and contourf collections? Eric John Hunter wrote: On 4/13/07, Bill Baxter [EMAIL PROTECTED] wrote: There are a couple things about legend that I'm finding a little irksome. Is there some better way to do this? 1) if you have a contour, legend() wants to add all the contours to the list. calling contour(...,label='_nolegend_') doesn't seem to help. You should be able to set the _nolegend_ label property on the contour set line collections like so: cs = contour(...blah...) for coll in cs.collections: coll.set_label('_nolegend_') of use setp for the same purpose. setp(cs.collections, label='_nolegend_') contour doesn't use the kwargs to set the line collection properties, which is why it is not working in the contour commands. some plot commands use the kwargs to update the artist properties that the plot command creates, some do not, and the only way to know is the read the individual docstrings of the commands. Let me know if this works because it is untested. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Omitting curves from a legend
Bill Baxter [EMAIL PROTECTED] writes: Documentation issue/question: I figured there was probably some way to set attributes individually using the return value from contour since contour's docstring helpfully tells me that countour returns a ContourSet object. However, 'ContourSet?' in ipython gives me nothing. Similarly with plot(), it says it returns a 'list of lines' but that is not so useful since I can't look up the docstring for 'list of lines'. Call setp on the returned object: In [8]:y = plot(sin(arange(10))) In [9]:setp(y) alpha: float animated: [True | False] antialiased or aa: [True | False] axes: unknown ... xdata: array ydata: array zorder: any number And similarly: In [11]:z = contour(outerproduct(arange(10), arange(10))) In [12]:setp(z) alpha: unknown array: unknown clim: a length 2 sequence of floats cmap: a colormap colorbar: unknown label_props: unknown norm: unknown Or, in ipython you can type z.set_TAB to see the completions. With the list returned from plot you cannot simply type y[0].set_TAB but have to assign the value of y[0] to a variable first. -- Jouni K. Seppänen http://www.iki.fi/jks - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Omitting curves from a legend
There are a couple things about legend that I'm finding a little irksome. Is there some better way to do this? 1) if you have a contour, legend() wants to add all the contours to the list. calling contour(...,label='_nolegend_') doesn't seem to help. I'm trying to plot a bunch of different types of markers on top of a contour plot, and put just the markers in the legend. The workaround seems to be contour(. . . ) p1 = plot( . . .) p2 = plot(. . .) . . . pN = plot(. . .) legend((p1,p2,...,pN), ('Legend1', 'Legend2', ... , 'LegendN')) Basically I have to save the plot data and repeat myself later. 2) The '_nolegend_' trick doesn't work for things in the simple call style for legend() legend('_nolegend_', 'Data 1', 'Data 2') That makes a legend containing the string _nolegend_. My first hunch to do that before looking at the docs at all was to put in a None for a legend I wanted to leave off. That's raises an error though. Might be nice if it was made a legal way to omit something from the legend. --bb - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/matplotlib-users