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
(10)
2
(17)
3
(14)
4
(28)
5
(23)
6
(12)
7
(3)
8
(11)
9
(29)
10
(31)
11
(9)
12
(35)
13
(3)
14
(9)
15
(16)
16
(14)
17
(10)
18
(7)
19
(3)
20
21
(4)
22
(6)
23
(14)
24
(16)
25
(10)
26
(5)
27
(4)
28
(8)
29
(19)
30
(21)




Showing 12 results of 12

From: feldmaus <fel...@gm...> - 2009年06月06日 21:39:32
Eric Firing <efiring@...> writes:
> 
> 
> If x,y don't change, and if you are not using masked arrays, then you 
> might be able to add something like this:
> 
> self.plots3.set_array(np.transpose(z).ravel())
> self.plots3.autoscale()
> self.figure.canvas.draw()
> 
> The colorbar range will be updated automatically.
Very very thank you, that worked for me :-)
If i did the help(self.plots3) after defining, 
self.plots3 = self.subplot3.pcolor(X,Y,np.transpose(z))
i had seen this, damned.
again thanks for your answer.
regards Markus
From: Xavier G. <xav...@gm...> - 2009年06月06日 21:01:35
Eric Firing wrote:
> Xavier Gnata wrote:
>>
>>>> ok. My bad! Sorry.
>>>> I have changed the default to %1.4g so that is matches my usecases 
>>>> *but* I
>>>> agree that correct way to improve it in not that trivial...
>>>> 
>>>
>>>
>>> You can control the point at which mpl falls over to scientific
>>> notation. From the matplotlibrc file (see
>>> http://matplotlib.sourceforge.net/users/customizing.html)
>>>
>>> axes.formatter.limits : -7, 7 # use scientific notation if log10
>>> # of the axis range is smaller than the
>>> # first or larger than the second
>>>
>>> I'm actually surprised you are seeing problems with images of
>>> 1000x1000 -- it makes me suspect you have an older matplotlib version
>>> or an older matplotlibrc laying around because at -7,7, which is the
>>> current default, you should not see exponential formatting until you
>>> get to much larger sizes.
>>>
>>> JDH
>>> 
>> I have uncommented the "axes.formatter.limits : -7, 7" line in my 
>> matplotlibrc.
>> If have have understood the conclusion of this thread correctly, it 
>> should be taken info account quite soon, isn't it?
>
> It already *is* taken into account--just not where you want it to be. 
> And I don't think it *should* be taken into account there. It is used 
> for the *tick labels*. I don't think that locking the formatting of 
> these to the *cursor readout* is the right thing to do. The solution 
> to your problem involves improving the latter with *no change* to the 
> former.
>
> I have just now committed a small change set that I think you will 
> find sufficient improvement for the present, and that I hope no one 
> else will find objectionable; but we will have to see how that turns 
> out. It is possible that it will not play well on some 
> backends/dpi/whatever, or under some other circumstances.
>
> As noted in the commit message, doing this right requires some changes 
> in all the interactive backends.
>
> Eric
>
Ok. Sorry for the conclusion.
Your small change is sufficient for my usecase :).
Thanks. I fully agree with you on the right way to really fix that problem;
I think pylab is great also because I always get feedback on this 
mailing list.
Xavier
From: Eric F. <ef...@ha...> - 2009年06月06日 20:36:30
feldmaus wrote:
> Hi All,
> 
> The User of my program should use a slider element which lets compute
> x,y and z and then my colorbar should also be updated with the new
> computed x,y, and z values.
> 
> How to do this ?
> 
> There is a set_colorbar() method, but i dont know how to use it.
> I also found a set_axes() method.
> 
> Here comes a clip of my code:
> def drawhistogram(self,min,max):
> if not hasattr(self, 'subplot3'):
> self.subplot3 = self.figure.add_subplot(111)
> self.subplot3.grid(True)
> x,y,z = self.computehistogram(self.rastertime)
> X,Y = meshgrid(x,y)
> self.plots3 = self.subplot3.pcolor(X,Y,np.transpose(z))
> self.figure.colorbar(self.plots3)
> 
> def repainthistogram(self,rastertime):
> x,y,z = self.computehistogram(rastertime)
> 
> What for methods to use in my repainthistogram() method ?
If x,y don't change, and if you are not using masked arrays, then you 
might be able to add something like this:
 self.plots3.set_array(np.transpose(z).ravel())
 self.plots3.autoscale()
 self.figure.canvas.draw()
The colorbar range will be updated automatically.
If x,y do change, then just clear the figure and regenerate it with the 
new data.
Eric
> 
> regards Markus
> 
> 
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
> looking to deploy the next generation of Solaris that includes the latest 
> innovations from Sun and the OpenSource community. Download a copy and 
> enjoy capabilities such as Networking, Storage and Virtualization. 
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: feldmaus <fel...@gm...> - 2009年06月06日 19:57:19
Hi All,
The User of my program should use a slider element which lets compute
x,y and z and then my colorbar should also be updated with the new
computed x,y, and z values.
How to do this ?
There is a set_colorbar() method, but i dont know how to use it.
I also found a set_axes() method.
Here comes a clip of my code:
 def drawhistogram(self,min,max):
 if not hasattr(self, 'subplot3'):
 self.subplot3 = self.figure.add_subplot(111)
 self.subplot3.grid(True)
 x,y,z = self.computehistogram(self.rastertime)
 X,Y = meshgrid(x,y)
 self.plots3 = self.subplot3.pcolor(X,Y,np.transpose(z))
 self.figure.colorbar(self.plots3)
 def repainthistogram(self,rastertime):
 x,y,z = self.computehistogram(rastertime)
What for methods to use in my repainthistogram() method ?
regards Markus
From: feldmaus <fel...@gm...> - 2009年06月06日 19:33:39
Eric Firing <efiring@...> writes:
 
> I don't understand what your question has to do with the colorbar; but 
> in anything like pcolor, if you swap X and Y, then at the same time you 
> need to transpose Z.
Thanks,
that was my Problem i had to transpose my z. :-)
numpy.transpose(z)
Regards Markus
From: Eric F. <ef...@ha...> - 2009年06月06日 18:27:16
Xavier Gnata wrote:
> 
>>> ok. My bad! Sorry.
>>> I have changed the default to %1.4g so that is matches my usecases 
>>> *but* I
>>> agree that correct way to improve it in not that trivial...
>>> 
>>
>>
>> You can control the point at which mpl falls over to scientific
>> notation. From the matplotlibrc file (see
>> http://matplotlib.sourceforge.net/users/customizing.html)
>>
>> axes.formatter.limits : -7, 7 # use scientific notation if log10
>> # of the axis range is smaller than the
>> # first or larger than the second
>>
>> I'm actually surprised you are seeing problems with images of
>> 1000x1000 -- it makes me suspect you have an older matplotlib version
>> or an older matplotlibrc laying around because at -7,7, which is the
>> current default, you should not see exponential formatting until you
>> get to much larger sizes.
>>
>> JDH
>> 
> I have uncommented the "axes.formatter.limits : -7, 7" line in my 
> matplotlibrc.
> If have have understood the conclusion of this thread correctly, it 
> should be taken info account quite soon, isn't it?
It already *is* taken into account--just not where you want it to be. 
And I don't think it *should* be taken into account there. It is used 
for the *tick labels*. I don't think that locking the formatting of 
these to the *cursor readout* is the right thing to do. The solution to 
your problem involves improving the latter with *no change* to the former.
I have just now committed a small change set that I think you will find 
sufficient improvement for the present, and that I hope no one else will 
find objectionable; but we will have to see how that turns out. It is 
possible that it will not play well on some backends/dpi/whatever, or 
under some other circumstances.
As noted in the commit message, doing this right requires some changes 
in all the interactive backends.
Eric
> 
> Xavier
From: projetmbc <pro...@cl...> - 2009年06月06日 16:38:49
Hello,
I would like to draw a rectangle and then to cut a disc wich is in the 
rectangle.
Is it possible ?
Christophe
On Jun 6, 2009, at 9:34 AM, John Hunter wrote:
> I'm happy to post this example in the examples dir, where it will
> automatically get picked up in the website gallery and examples dir.
That'd be great!
> The scipy cookbook is fine too, but I would prefer that a little mini
> tutorial be written in rest explaining the example and we can start a
> cookbook in the mpl docs. If you would like to go this route, we can
> add a section to the users guide for "explained examples", aka a
> cookbook.
Now that I think about it, maybe this example isn't suited for a 
cookbook. Or maybe I'm just being lazy and avoiding the work involved 
in writing an explanation. :P
> I am curious though why you prefer to alter the default color cycle
> rather than just passing the color in to the plot command -- it seems
> more explicit to pass the color in directly rather than rely on the
> default cycle.
> JDH
Actually, I originally cycled through colors in my plot loop, which I 
agree is more explicit. However, I got tired of the extra code 
involved with this method and went looking for a way to change the 
defaults. Plus, I already have of a module of functions I use to 
change matplotlib defaults (different fontsizes, linewidths, etc. for 
publications, presentations, etc), and this function fit quite nicely 
with that module.
-Tony
PS. If it'd be useful to show different ways of cycling through 
colors, here's another version of my example:
From: Xavier G. <xav...@gm...> - 2009年06月06日 14:29:44
>> ok. My bad! Sorry.
>> I have changed the default to %1.4g so that is matches my usecases *but* I
>> agree that correct way to improve it in not that trivial...
>> 
>
>
> You can control the point at which mpl falls over to scientific
> notation. From the matplotlibrc file (see
> http://matplotlib.sourceforge.net/users/customizing.html)
>
> axes.formatter.limits : -7, 7 # use scientific notation if log10
> # of the axis range is smaller than the
> # first or larger than the second
>
> I'm actually surprised you are seeing problems with images of
> 1000x1000 -- it makes me suspect you have an older matplotlib version
> or an older matplotlibrc laying around because at -7,7, which is the
> current default, you should not see exponential formatting until you
> get to much larger sizes.
>
> JDH
> 
I have uncommented the "axes.formatter.limits : -7, 7" line in my 
matplotlibrc.
If have have understood the conclusion of this thread correctly, it 
should be taken info account quite soon, isn't it?
Xavier
On Fri, Jun 5, 2009 at 11:39 PM, Tony S Yu<to...@mi...> wrote:
> Are there guidelines for what makes a good example to be included with the
> matplotlib examples?
>
> I have a matplotlib snippet I'd like to post somewhere, but I'm not sure
> where to put it. I doubt it'd be useful enough to be included with the
> packaged examples. I was thinking about putting it in the matplotlib
> examples in the Scipy cookbook, but I wasn't sure how active the site is.
>
> In any case, the code I'd like to post changes the color cycle to use
> successive colors from a colormap. I find this really useful for plotting
> curves that evolve in time on the same plot. I've attached an image
> illustrating this idea. The code is pretty simple and is also attached.
I'm happy to post this example in the examples dir, where it will
automatically get picked up in the website gallery and examples dir.
The scipy cookbook is fine too, but I would prefer that a little mini
tutorial be written in rest explaining the example and we can start a
cookbook in the mpl docs. If you would like to go this route, we can
add a section to the users guide for "explained examples", aka a
cookbook.
I am curious though why you prefer to alter the default color cycle
rather than just passing the color in to the plot command -- it seems
more explicit to pass the color in directly rather than rely on the
default cycle.
JDH
From: Sebastian B. <web...@th...> - 2009年06月06日 09:58:06
Attachments: signature.asc
Jae-Joon Lee wrote:
> ...
> def Tc(Tf): return (5./9.)*(Tf-32)
> 
> ax1 = subplot(111) # y-axis in F
> ax2 = twinx() # y-axis in C
> 
> def update_ax2(ax1):
> y1, y2 = ax1.get_ylim()
> ax2.set_ylim(Tc(y1), Tc(y2))
> 
> # automatically update ylim of ax2 when ylim of ax1 changes.
> ax1.callbacks.connect("ylim_changed", update_ax2)
> ax1.plot([78, 79, 79, 77])
> ...
Thanks, this was also useful for me. I see that you are discussing
shortcomings of twinx -- so perhaps the following is one of those...
I was using this exact script with an additional
ax1.set_yscale('log')
ax2.set_yscale('log')
and the ticks seem to be messed up. I used 'ipython -pylab' with
matplotlib.__version__ '0.98.3'.
Is there something I can do to get the ticks only at the places i would
like them to be?
Thanks,
Sebastian.
Are there guidelines for what makes a good example to be included with 
the matplotlib examples?
I have a matplotlib snippet I'd like to post somewhere, but I'm not 
sure where to put it. I doubt it'd be useful enough to be included 
with the packaged examples. I was thinking about putting it in the 
matplotlib examples in the Scipy cookbook, but I wasn't sure how 
active the site is.
In any case, the code I'd like to post changes the color cycle to use 
successive colors from a colormap. I find this really useful for 
plotting curves that evolve in time on the same plot. I've attached an 
image illustrating this idea. The code is pretty simple and is also 
attached.
-Tony

Showing 12 results of 12

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 によって変換されたページ (->オリジナル) /