No legend using scatter function

Hello,

Could not get a legend shown on scatter function used plot:

In [4]: a = rand(100)

In [5]: b = rand(100)

In [22]: scatter(a,b, c=a, s=b, label=“aaaa”)
Out[22]: <matplotlib.collections.CircleCollection object at 0xa133dcc>

In [23]: scatter(a,b, c=a5, s=b5, label=“cccc”)
Out[23]: <matplotlib.collections.CircleCollection object at 0xa311e6c>

In [24]: legend()

at rev 7355.

with

Python 2.6 (r26:66714, Jun 8 2009)
IPython 0.10.bzr.r1163 – An enhanced Interactive Python.

Any suggestions?

···


Gökhan

This turned out to be a bug introduced recently, which is now fixed in
the 0.99 maintenance branch.
The fix is not merged into the head yet. I tried svnmerge.py but it
gave some merge conflict. While the conflict seems rather trivial,
I'll leave it to others.

Meanwhile, you can explicitly give artists and labels to create the legend.

s1 = scatter(..)
s2 = scatter(..)

legend([s1, s2], ["aaaa", "cccc"])

-JJ

···

On Tue, Aug 4, 2009 at 4:51 PM, Gökhan Sever<gokhansever@...287...> wrote:

Hello,

Could not get a legend shown on scatter function used plot:

In [4]: a = rand(100)

In [5]: b = rand(100)

In [22]: scatter(a,b, c=a, s=b, label="aaaa")
Out[22]: <matplotlib.collections.CircleCollection object at 0xa133dcc>

In [23]: scatter(a,b, c=a*5, s=b*5, label="cccc")
Out[23]: <matplotlib.collections.CircleCollection object at 0xa311e6c>

In [24]: legend()

at rev 7355.

with

Python 2.6 (r26:66714, Jun 8 2009)
IPython 0.10.bzr.r1163 -- An enhanced Interactive Python.

Any suggestions?

--
Gökhan

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks JJ,

I was playing with different ways to create legends, and found myself a way just like you suggested.

I guess in legend as long as a sequence is provided it doesn’t matter whether it is a tuple or list. Am I correct?

Additionally, speaking of scatters; is there a way to add a colorbar next to scatters depicting the variation in colors or size of the scatters?

Thanks.

···

On Thu, Aug 6, 2009 at 11:47 AM, Jae-Joon Lee <lee.j.joon@…287…> wrote:

This turned out to be a bug introduced recently, which is now fixed in

the 0.99 maintenance branch.

The fix is not merged into the head yet. I tried svnmerge.py but it

gave some merge conflict. While the conflict seems rather trivial,

I’ll leave it to others.

Meanwhile, you can explicitly give artists and labels to create the legend.

s1 = scatter(…)

s2 = scatter(…)

legend([s1, s2], [“aaaa”, “cccc”])

-JJ

On Tue, Aug 4, 2009 at 4:51 PM, Gökhan Sever<gokhansever@…287…> wrote:

Hello,

Could not get a legend shown on scatter function used plot:

In [4]: a = rand(100)

In [5]: b = rand(100)

In [22]: scatter(a,b, c=a, s=b, label=“aaaa”)

Out[22]: <matplotlib.collections.CircleCollection object at 0xa133dcc>

In [23]: scatter(a,b, c=a5, s=b5, label=“cccc”)

Out[23]: <matplotlib.collections.CircleCollection object at 0xa311e6c>

In [24]: legend()

at rev 7355.

with

Python 2.6 (r26:66714, Jun 8 2009)

IPython 0.10.bzr.r1163 – An enhanced Interactive Python.

Any suggestions?

Gökhan


Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day

trial. Simplify your report design, integration and deployment - and focus

on

what you do best, core application coding. Discover what’s new with

Crystal Reports now. http://p.sf.net/sfu/bobj-july


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Gökhan

Thanks JJ,

I was playing with different ways to create legends, and found myself a way
just like you suggested.

I guess in legend as long as a sequence is provided it doesn't matter
whether it is a tuple or list. Am I correct?

As far as it is iterable, it should be okay.

Additionally, speaking of scatters; is there a way to add a colorbar next to
scatters depicting the variation in colors or size of the scatters?

I'm not sure what exactly you're trying to do here.

You mean something like this?

http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_collection.html

The example uses EllipseCollection but scatter basically creates collections.

If there is any screenshot you can show (may be from other plotting
tool), it would be much easier to figure out.

-JJ

-ps. By the way, I'm afraid that this fix missed the 0.99 release.

···

On Thu, Aug 6, 2009 at 12:54 PM, Gökhan Sever<gokhansever@...287...> wrote:

Thanks.

On Thu, Aug 6, 2009 at 11:47 AM, Jae-Joon Lee <lee.j.joon@...287...> wrote:

This turned out to be a bug introduced recently, which is now fixed in
the 0.99 maintenance branch.
The fix is not merged into the head yet. I tried svnmerge.py but it
gave some merge conflict. While the conflict seems rather trivial,
I'll leave it to others.

Meanwhile, you can explicitly give artists and labels to create the
legend.

s1 = scatter(..)
s2 = scatter(..)

legend([s1, s2], ["aaaa", "cccc"])

-JJ

On Tue, Aug 4, 2009 at 4:51 PM, Gökhan Sever<gokhansever@...287...> wrote:
> Hello,
>
> Could not get a legend shown on scatter function used plot:
>
> In [4]: a = rand(100)
>
> In [5]: b = rand(100)
>
> In [22]: scatter(a,b, c=a, s=b, label="aaaa")
> Out[22]: <matplotlib.collections.CircleCollection object at 0xa133dcc>
>
> In [23]: scatter(a,b, c=a*5, s=b*5, label="cccc")
> Out[23]: <matplotlib.collections.CircleCollection object at 0xa311e6c>
>
> In [24]: legend()
>
> at rev 7355.
>
> with
>
> Python 2.6 (r26:66714, Jun 8 2009)
> IPython 0.10.bzr.r1163 -- An enhanced Interactive Python.
>
> Any suggestions?
>
>
> --
> Gökhan
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and
> focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
Gökhan

I've merged and resolved these conflicts, so HEAD should be good now.

Too bad the fix squaeked in minutes after the release -- it will have
to wait for the bugfix release, which hopefully will not be too soon,
since we did a fair amount of rc testing this time around.

JDH

···

On Thu, Aug 6, 2009 at 11:47 AM, Jae-Joon Lee<lee.j.joon@...287...> wrote:

This turned out to be a bug introduced recently, which is now fixed in
the 0.99 maintenance branch.
The fix is not merged into the head yet. I tried svnmerge.py but it
gave some merge conflict. While the conflict seems rather trivial,
I'll leave it to others.

This turned out to be a bug introduced recently, which is now fixed in
the 0.99 maintenance branch.
The fix is not merged into the head yet. I tried svnmerge.py but it
gave some merge conflict. While the conflict seems rather trivial,
I'll leave it to others.

I've merged and resolved these conflicts, so HEAD should be good now.

Thanks John.

Too bad the fix squaeked in minutes after the release -- it will have
to wait for the bugfix release, which hopefully will not be too soon,
since we did a fair amount of rc testing this time around.

JDH

The bug is that CircleCollections are ignored when legend items are
automatically created.
While, I hope not much people are affected by this bug.

Regards,

-JJ

···

On Thu, Aug 6, 2009 at 1:13 PM, John Hunter<jdh2358@...287...> wrote:

On Thu, Aug 6, 2009 at 11:47 AM, Jae-Joon Lee<lee.j.joon@...287...> wrote:

I’m not sure what exactly you’re trying to do here.

You mean something like this?

http://matplotlib.sourceforge.net/examples/pylab_examples/ellipse_collection.html

The example uses EllipseCollection but scatter basically creates collections.

That is exactly what I have been trying to do :slight_smile: You understood me even
I being very clear. I think this should be a very developer instinct of
you JJ :wink:

If there is any screenshot you can show (may be from other plotting

tool), it would be much easier to figure out.

It would be so very great to have an interface similar to Mayavi’s (what other plotting tool I would have in my mind :). Some functionality is much easier to find in Mayavi’s menus. Matplotlib is allowing me to create very creative and informative plots to analyse and demonstrate our airborne collected aerosol, cloud nuclei, and various other atmospheric parameters. However the number of different figures that I am creating is increasing on a daily-basis. Something out of my screen is screening at me to put the figures on GUI-based design. Hoping that SciPy09 will give me the motivation to establish some good results in the lands of matplotlib integrated GUI’s.

-JJ

-ps. By the way, I’m afraid that this fix missed the 0.99 release.

I don’t think many will notice this, since you have amazing other additions into the library.

Please, keep up great work.

···

On Thu, Aug 6, 2009 at 12:02 PM, Jae-Joon Lee <lee.j.joon@…287…> wrote:


Gökhan