SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
(2)
2
(4)
3
(9)
4
(12)
5
(12)
6
(7)
7
(8)
8
(4)
9
(2)
10
(9)
11
(6)
12
(1)
13
(20)
14
(13)
15
(9)
16
(3)
17
(12)
18
(16)
19
(14)
20
(12)
21
(15)
22
(11)
23
(5)
24
(7)
25
(7)
26
(8)
27
(11)
28
(10)
29
(1)
30
(3)
31
(6)





Showing 9 results of 9

From: John H. <jd...@gm...> - 2011年10月15日 15:56:59
On Sat, Oct 15, 2011 at 10:39 AM, <jos...@gm...> wrote:
> I'm building plots in stages using several different functions. Since
> the figure contains all information, I don't hand handles to
> individual elements around.
>
> What's the best way to check for a specific plot element? using
> isinstance, or are there specific attributes that could be checked?
Checkout out Artist.findobj
 http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.artist.Artist.findobj
Artist is the base class for everything in a matplotlib figure, the
Figure, Axes, Axis, Text, Line2D, Polygon, etc, all derive from
Artist, so you can call this method on any mpl object to recursively
search for objects of a given type. By recursive, I mean search the
objects children, their children, etc. See also
 http://matplotlib.sourceforge.net/users/artists.html
for more info on the artist hierarchy.
But for your specific example, each axes has an `images` attribute,
which is a list of images it contains (this is detailed in the artist
tutorial linked above, so you could simplify your code with something
like:
 images = np.concatenate([ax.images for ax in fig.axes])
JDH
From: <jos...@gm...> - 2011年10月15日 15:39:36
I'm building plots in stages using several different functions. Since
the figure contains all information, I don't hand handles to
individual elements around.
What's the best way to check for a specific plot element? using
isinstance, or are there specific attributes that could be checked?
For example, I want to add a colorbar to the figure corresponding to
the first axis.imshow:
>>> images = [c for ax in f.axes for c in ax.get_children() if isinstance(c, mpl.image.AxesImage)]
>>> images
[<matplotlib.image.AxesImage object at 0x08C0CAD0>]
>>> f.colorbar(images[0])
<matplotlib.colorbar.Colorbar instance at 0x08E033F0>
>>> f
<matplotlib.figure.Figure object at 0x08B614D0>
example
using recipe http://matplotlib.sourceforge.net/examples/pylab_examples/subplots_adjust.html
https://lh5.googleusercontent.com/-rpw4NHbXvxM/TpmnumYNcRI/AAAAAAAAAK0/5zLnnUPjg0A/corrmatrixgrid.png
Thanks,
Josef
From: Chao Y. <cha...@gm...> - 2011年10月15日 14:36:33
cool. it's done!! Thanks!!!
Chao
2011年10月15日 Tony Yu <ts...@gm...>
>
>
> On Sat, Oct 15, 2011 at 8:55 AM, Chao YUE <cha...@gm...> wrote:
>
>> Dear all,
>>
>> how can I make a scatter plot without edgecolor?
>>
>> import matplotlib.pyplot as plt
>> In [110]: plt.scatter(np.arange(10),np.arange(10,20),edgecolor=None)
>> Out[110]: <matplotlib.collections.CircleCollection object at 0x5cf16d0>
>>
>> in this case I can use edgecolor='w' to solve it, but when points overlap,
>> this does not work anymore.
>> Any help will be appreciated. Thanks.
>>
>
> Hi Chao,
>
> I think what you want is 'none':
>
> plt.scatter(np.arange(10),np.arange(10,20), color='y',edgecolor='none')
>
> It's confusing, but None is used to let matplotlib auto-select the color,
> while 'none' is used to turn off edge coloring.
>
> Best,
> -Tony
>
-- 
***********************************************************************************
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
************************************************************************************
From: Jae-Joon L. <lee...@gm...> - 2011年10月15日 14:15:59
Figure.tight_layout() is a correct way.
Do you see that error only when you use Figure.tight_plot (and not
when you use plt.tight_layout)?
What happen you try the script below.
import matplotlib.pyplot as plt
fig = plt.figure(1)ax = fig.add_subplot(111)fig.tight_layout()
Regards,
-JJ
On Sat, Oct 15, 2011 at 9:13 AM, C M <cmp...@gm...> wrote:
> Just trying out the latest mpl 1.1.0 and the tight_layout() method. I saw
> the guide written about it, but am a unsure how to use this when using the
> OO approach to using Matplotlib.
>
> When using pyplot, the method is: plt.tight_layout(). When using the OO
> form of mpl, is it: figure.tight_layout() ?
>
> I assume it is, because I tried this and it didn't give me a name error, but
> I did get an error: ValueError: left cannot be >= right.
>
> What am I doing wrong?
>
> Thanks,
> Che
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Tony Yu <ts...@gm...> - 2011年10月15日 13:39:30
On Sat, Oct 15, 2011 at 8:55 AM, Chao YUE <cha...@gm...> wrote:
> Dear all,
>
> how can I make a scatter plot without edgecolor?
>
> import matplotlib.pyplot as plt
> In [110]: plt.scatter(np.arange(10),np.arange(10,20),edgecolor=None)
> Out[110]: <matplotlib.collections.CircleCollection object at 0x5cf16d0>
>
> in this case I can use edgecolor='w' to solve it, but when points overlap,
> this does not work anymore.
> Any help will be appreciated. Thanks.
>
Hi Chao,
I think what you want is 'none':
plt.scatter(np.arange(10),np.arange(10,20), color='y',edgecolor='none')
It's confusing, but None is used to let matplotlib auto-select the color,
while 'none' is used to turn off edge coloring.
Best,
-Tony
From: Durrieu Jean-L. <jea...@ep...> - 2011年10月15日 13:20:46
Hi Chao!
On Oct 15, 2011, at 2:55 PM, Chao YUE wrote:
> import matplotlib.pyplot as plt
> In [110]: plt.scatter(np.arange(10),np.arange(10,20),edgecolor=None)
> Out[110]: <matplotlib.collections.CircleCollection object at 0x5cf16d0>
> 
> in this case I can use edgecolor='w' to solve it, but when points overlap, this does not work anymore.
> Any help will be appreciated. Thanks.
For scatter plots, I usually use:
plt.plot(x,y,'.')
You can manipulate a bit the marker, markersize, style and alpha parameters (nice when there are really too many points overlapping, to get an idea of the "distribution"). In your ipython, type plot? to get all the available options.
Cheers,
jean-louis
> 
> Chao
> -- 
> ***********************************************************************************
> 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
> ************************************************************************************
> 
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2d-oct_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Chao Y. <cha...@gm...> - 2011年10月15日 12:55:16
Dear all,
how can I make a scatter plot without edgecolor?
import matplotlib.pyplot as plt
In [110]: plt.scatter(np.arange(10),np.arange(10,20),edgecolor=None)
Out[110]: <matplotlib.collections.CircleCollection object at 0x5cf16d0>
in this case I can use edgecolor='w' to solve it, but when points overlap,
this does not work anymore.
Any help will be appreciated. Thanks.
Chao
-- 
***********************************************************************************
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
************************************************************************************
From: Benjamin R. <ben...@ou...> - 2011年10月15日 00:50:14
On Friday, October 14, 2011, jopeto <g_n...@ho...> wrote:
>
> Hello,
>
> I have a question regarding setting a custom axis range. Here's a basic
> example:
>
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(1,1,1)
> ax.plot([1,2,3])
> ax.axis([xmin,xmax,ymin,ymax])
> plt.show()
>
> Now the question that I'm having is the following. The way I understand it
> now, I either have to live with the default axis ranges which matplotlib
> gives me, or I need to change all four values xmin, xmax, ymin, ymax using
> the ax.axis command. Say that I'm happy with xmin, ymin and ymax, and I
only
> want to set xmax to a value slightly larger than the default. Is there a
way
> to specify just that and to be able to keep the other three? The command
> which I'm looking for would be something like:
>
> ax.axis([keep default, xmax, keep default, keep default])
>
> If someone has a suggestion, I would be very grateful.
Use ax.set_xlim() and it's y-axis equivalent. You can even use kwargs to
those functions to manually set only one of the two limits.
Ben Root
From: C M <cmp...@gm...> - 2011年10月15日 00:13:32
Just trying out the latest mpl 1.1.0 and the tight_layout() method. I saw
the guide written about it, but am a unsure how to use this when using the
OO approach to using Matplotlib.
When using pyplot, the method is: plt.tight_layout(). When using the OO
form of mpl, is it: figure.tight_layout() ?
I assume it is, because I tried this and it didn't give me a name error, but
I did get an error: ValueError: left cannot be >= right.
What am I doing wrong?
Thanks,
Che

Showing 9 results of 9

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /