numpoints in legend() function for scatter plot is not working in matplotlib 1.1.0?

Dear all,

I found that the numpoints in legend function for scatter plot is not
working?

import matplotlib as mat
import matplotlib.pyplot as plt
In [59]: mat.__version__
Out[59]: '1.1.0'

#ordinary plot working
fig=plt.figure()
ax=fig.add_subplot(111)
ax.plot(np.arange(10),'ro',label='tst')
ax.legend(numpoints=1)
plt.show()

#but not scatter plot
fig=plt.figure()
ax=fig.add_subplot(111)
ax.scatter(np.arange(10),np.arange(10),marker='o',label='tst')
ax.legend(numpoints=1)
plt.show()

cheers,

chao

···


View this message in context: http://old.nabble.com/numpoints-in-legend()-function-for-scatter-plot-is-not-working-in-matplotlib-1.1.0--tp33662785p33662785.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Confirmed… this is still broken.

Ben Root

···

On Tue, Apr 10, 2012 at 12:43 PM, wiswit <chaoyuejoy@…287…> wrote:

Dear all,

I found that the numpoints in legend function for scatter plot is not

working?

import matplotlib as mat

import matplotlib.pyplot as plt

In [59]: mat.version

Out[59]: ‘1.1.0’

#ordinary plot working

fig=plt.figure()

ax=fig.add_subplot(111)

ax.plot(np.arange(10),‘ro’,label=‘tst’)

ax.legend(numpoints=1)

plt.show()

#but not scatter plot

fig=plt.figure()

ax=fig.add_subplot(111)

ax.scatter(np.arange(10),np.arange(10),marker=‘o’,label=‘tst’)

ax.legend(numpoints=1)

plt.show()

cheers,

chao

Hi Ben,

I tried the “numpoints” in legend function for scatter plot, in dev version and GTKAgg backend it works.

In [3]: mat.version
Out[3]: ‘1.2.x’

In [4]: mat.get_backend()
Out[4]: ‘GTKAgg’

Chao

···

On Sun, Sep 9, 2012 at 9:28 PM, Benjamin Root <ben.root@…1304…> wrote:

On Tue, Apr 10, 2012 at 12:43 PM, wiswit <chaoyuejoy@…287…> wrote:

Dear all,

I found that the numpoints in legend function for scatter plot is not

working?

import matplotlib as mat

import matplotlib.pyplot as plt

In [59]: mat.version

Out[59]: ‘1.1.0’

#ordinary plot working

fig=plt.figure()

ax=fig.add_subplot(111)

ax.plot(np.arange(10),‘ro’,label=‘tst’)

ax.legend(numpoints=1)

plt.show()

#but not scatter plot

fig=plt.figure()

ax=fig.add_subplot(111)

ax.scatter(np.arange(10),np.arange(10),marker=‘o’,label=‘tst’)

ax.legend(numpoints=1)

plt.show()

cheers,

chao

Confirmed… this is still broken.

Ben Root


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16


Strange, when I tested it last night, I was using a build of mpl from master of a couple weeks ago, and I saw three markers in the legend. Now, I am trying it again with the latest master: 1478a1be70b3077b71350cecaccb774f76a76656, and I now see zero markers. Something is seriously broken.

Can you tell me what commit (and the date for that commit) shows up at top when you run “git log” in the mpl source directory?

Ben Root

···

On Mon, Sep 10, 2012 at 2:56 AM, Chao YUE <chaoyuejoy@…287…> wrote:

Hi Ben,

I tried the “numpoints” in legend function for scatter plot, in dev version and GTKAgg backend it works.

In [3]: mat.version
Out[3]: ‘1.2.x’

In [4]: mat.get_backend()

Out[4]: ‘GTKAgg’

Chao

Hi Ben,

I think I installed this version by following the instructions on matplotlib website. But when I try to use git log, I get:

chaoyue@…4193…:/usr/local/lib/python2.7/dist-packages/matplotlib$ pwd
/usr/local/lib/python2.7/dist-packages/matplotlib

chaoyue@…4193…:/usr/local/lib/python2.7/dist-packages/matplotlib$ git log
fatal: Not a git repository (or any of the parent directories): .git

I tried to have a look at init.py, it has:

from future import print_function

version = ‘1.2.x’
version__numpy = ‘1.4’ # minimum required numpy version

So it’s the correct directory I am going. could you give some further instructions?

Chao

···

On Mon, Sep 10, 2012 at 3:05 PM, Benjamin Root <ben.root@…1304…> wrote:

On Mon, Sep 10, 2012 at 2:56 AM, Chao YUE <chaoyuejoy@…287…> wrote:

Hi Ben,

I tried the “numpoints” in legend function for scatter plot, in dev version and GTKAgg backend it works.

In [3]: mat.version
Out[3]: ‘1.2.x’

In [4]: mat.get_backend()

Out[4]: ‘GTKAgg’

Chao

Strange, when I tested it last night, I was using a build of mpl from master of a couple weeks ago, and I saw three markers in the legend. Now, I am trying it again with the latest master: 1478a1be70b3077b71350cecaccb774f76a76656, and I now see zero markers. Something is seriously broken.

Can you tell me what commit (and the date for that commit) shows up at top when you run “git log” in the mpl source directory?

Ben Root


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16


Hi Ben,

I think I installed this version by following the instructions on matplotlib website. But when I try to use git log, I get:

chaoyue@…4193…:/usr/local/lib/python2.7/dist-packages/matplotlib$ pwd

/usr/local/lib/python2.7/dist-packages/matplotlib

chaoyue@…4193…:/usr/local/lib/python2.7/dist-packages/matplotlib$ git log
fatal: Not a git repository (or any of the parent directories): .git

I tried to have a look at init.py, it has:

from future import print_function

version = ‘1.2.x’
version__numpy = ‘1.4’ # minimum required numpy version

So it’s the correct directory I am going. could you give some further instructions?

Chao

Which directions? We have several for different kinds of installs. We have not released v1.2.0 yet, so I was guessing you checked out mpl from github. If that is the case, then you run “git log” from the source directory, not the install directory.

Ben

···

On Mon, Sep 10, 2012 at 9:33 AM, Chao YUE <chaoyuejoy@…287…> wrote:

On Mon, Sep 10, 2012 at 3:05 PM, Benjamin Root <ben.root@…1304…> wrote:

On Mon, Sep 10, 2012 at 2:56 AM, Chao YUE <chaoyuejoy@…287…> wrote:

Hi Ben,

I tried the “numpoints” in legend function for scatter plot, in dev version and GTKAgg backend it works.

In [3]: mat.version
Out[3]: ‘1.2.x’

In [4]: mat.get_backend()

Out[4]: ‘GTKAgg’

Chao

Strange, when I tested it last night, I was using a build of mpl from master of a couple weeks ago, and I saw three markers in the legend. Now, I am trying it again with the latest master: 1478a1be70b3077b71350cecaccb774f76a76656, and I now see zero markers. Something is seriously broken.

Can you tell me what commit (and the date for that commit) shows up at top when you run “git log” in the mpl source directory?

Ben Root


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16


Ben, on master scatter legends are broken. A pull request (I can’t remember which, and github is down, possibly #1176) fixes this (obviously, the PR is marked as release critical for 1.2).

I have confirmed, that even once fixed on master, the scatter legend handler does not take notice of the “numpoints” kwarg.

Hope that helps clarify the matter,

Regards,

Phil

···

On 10 September 2012 14:51, Benjamin Root <ben.root@…1304…> wrote:

On Mon, Sep 10, 2012 at 9:33 AM, Chao YUE <chaoyuejoy@…1896…> wrote:

Hi Ben,

I think I installed this version by following the instructions on matplotlib website. But when I try to use git log, I get:

chaoyue@…4193…:/usr/local/lib/python2.7/dist-packages/matplotlib$ pwd

/usr/local/lib/python2.7/dist-packages/matplotlib

chaoyue@…4193…:/usr/local/lib/python2.7/dist-packages/matplotlib$ git log
fatal: Not a git repository (or any of the parent directories): .git

I tried to have a look at init.py, it has:

from future import print_function

version = ‘1.2.x’
version__numpy = ‘1.4’ # minimum required numpy version

So it’s the correct directory I am going. could you give some further instructions?

Chao

Which directions? We have several for different kinds of installs. We have not released v1.2.0 yet, so I was guessing you checked out mpl from github. If that is the case, then you run “git log” from the source directory, not the install directory.

Ben

On Mon, Sep 10, 2012 at 3:05 PM, Benjamin Root <ben.root@…1304…> wrote:

On Mon, Sep 10, 2012 at 2:56 AM, Chao YUE <chaoyuejoy@…287…> wrote:

Hi Ben,

I tried the “numpoints” in legend function for scatter plot, in dev version and GTKAgg backend it works.

In [3]: mat.version
Out[3]: ‘1.2.x’

In [4]: mat.get_backend()

Out[4]: ‘GTKAgg’

Chao

Strange, when I tested it last night, I was using a build of mpl from master of a couple weeks ago, and I saw three markers in the legend. Now, I am trying it again with the latest master: 1478a1be70b3077b71350cecaccb774f76a76656, and I now see zero markers. Something is seriously broken.

Can you tell me what commit (and the date for that commit) shows up at top when you run “git log” in the mpl source directory?

Ben Root


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16



Live Security Virtual Conference

Exclusive live event will cover all the ways today’s security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

Hi Ben,

I guess it’s this:

commit 8c57e4fe4909815092af470f4a036c80b407382c
Merge: cf53d4c b6c5625
Author: Eric Firing <efiring@…202…>

Merge pull request #994 from efiring/fix_pcolorfast_quadmesh

Fix bug in pcolorfast introduced by #901

cheers,

Chao

···

Date: Mon Jul 9 15:25:16 2012 -0700

On Mon, Sep 10, 2012 at 4:30 PM, Phil Elson <pelson.pub@…287…> wrote:

Ben, on master scatter legends are broken. A pull request (I can’t remember which, and github is down, possibly #1176) fixes this (obviously, the PR is marked as release critical for 1.2).

I have confirmed, that even once fixed on master, the scatter legend handler does not take notice of the “numpoints” kwarg.

Hope that helps clarify the matter,

Regards,

Phil

On 10 September 2012 14:51, Benjamin Root <ben.root@…1304…> wrote:

On Mon, Sep 10, 2012 at 9:33 AM, Chao YUE <chaoyuejoy@…287…> wrote:

Hi Ben,

I think I installed this version by following the instructions on matplotlib website. But when I try to use git log, I get:

chaoyue@…4193…:/usr/local/lib/python2.7/dist-packages/matplotlib$ pwd

/usr/local/lib/python2.7/dist-packages/matplotlib

chaoyue@…4193…:/usr/local/lib/python2.7/dist-packages/matplotlib$ git log
fatal: Not a git repository (or any of the parent directories): .git

I tried to have a look at init.py, it has:

from future import print_function

version = ‘1.2.x’
version__numpy = ‘1.4’ # minimum required numpy version

So it’s the correct directory I am going. could you give some further instructions?

Chao

Which directions? We have several for different kinds of installs. We have not released v1.2.0 yet, so I was guessing you checked out mpl from github. If that is the case, then you run “git log” from the source directory, not the install directory.

Ben

On Mon, Sep 10, 2012 at 3:05 PM, Benjamin Root <ben.root@…1304…> wrote:

On Mon, Sep 10, 2012 at 2:56 AM, Chao YUE <chaoyuejoy@…287…> wrote:

Hi Ben,

I tried the “numpoints” in legend function for scatter plot, in dev version and GTKAgg backend it works.

In [3]: mat.version
Out[3]: ‘1.2.x’

In [4]: mat.get_backend()

Out[4]: ‘GTKAgg’

Chao

Strange, when I tested it last night, I was using a build of mpl from master of a couple weeks ago, and I saw three markers in the legend. Now, I am trying it again with the latest master: 1478a1be70b3077b71350cecaccb774f76a76656, and I now see zero markers. Something is seriously broken.

Can you tell me what commit (and the date for that commit) shows up at top when you run “git log” in the mpl source directory?

Ben Root


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16



Live Security Virtual Conference

Exclusive live event will cover all the ways today’s security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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


Chao YUE
Laboratoire des Sciences du Climat et de l’Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex

Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16