Sterling,
I have version 1.2.0. I read the legend guide. Which thing should be
possible? If you mean giving the points as a tuple, here's some simple
test code:
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
p1 = ax.scatter([0.1],[0.5],c='r',marker='s')
p2 = ax.scatter([0.3],[0.2],c='b',marker='o')
l = ax.legend((p1,p2),['points'],scatterpoints=2)
plt.show()
I get a legend with only red squares. What I want is a legend line with
a red square and a blue circle. I can get points with different colors
if I do:
p1 = ax.scatter([0.1,0.3],[0.5,0.2],c=('r','b'),marker='s')
l = ax.legend(['points'],scatterpoints=2)
(though as far as I can tell, you can't have a sequence of marker
types).
Jon
On Wed, 2013-01-23 at 09:57 -0800, Sterling Smith wrote:
> Jon,
>
> What version of matplotlib do you have? According to
> http://matplotlib.org/users/legend_guide.html
> what you say should be possible in 1.2.0.
>
> -Sterling
>
> On Jan 23, 2013, at 9:35AM, Jonathan Slavin wrote:
>
> > Hi,
> >
> > I'm wondering if there is some straightforward way to combine two
> > PathCollection objects to create a new PathCollection object. My goal
> > is to include two points that use different axes (one twin'ed to the
> > other) into a single legend item (different point types, same label).
> > Each call to scatter creates a new PathCollection object. If I could
> > just combine two (or more) PathCollection objects -- either extending
> > them or concatenating or whatever -- then I could give that to legend
> > and it would work correctly. But it's not clear to me how I can do
> > that. I tried providing the two objects as a tuple to legend, but it
> > doesn't work (only point characteristics of one of them is used).
> >
> > Really, I think this should be easier -- both the combining of such
> > objects (which after all, are collections) and providing legend with
> > simple arguments to produce what you want. As far as I can tell I can't
> > just tell leged directly the symbol type(s) and colors of point(s) per
> > each label. Though in general the automatic method whereby you provide
> > the object to the legend is nice and easy, a more crude and direct way
> > would be a good option for special cases.
> >
> > Jon
> > --
> > ______________________________________________________________
> > Jonathan D. Slavin Harvard-Smithsonian CfA
> > [email protected] 60 Garden Street, MS 83
> > phone: (617) 496-7981 Cambridge, MA 02138-1516
> > cell: (781) 363-0035 USA
> > ______________________________________________________________
> >
> >
> > ------------------------------------------------------------------------------
> > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> > MVPs and experts. ON SALE this month only -- learn more at:
> > http://p.sf.net/sfu/learnnow-d2d
> > _______________________________________________
> > Matplotlib-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
______________________________________________________________
Jonathan D. Slavin Harvard-Smithsonian CfA
[email protected] 60 Garden Street, MS 83
phone: (617) 496-7981 Cambridge, MA 02138-1516
cell: (781) 363-0035 USA
______________________________________________________________
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users