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 results of 383

<< < 1 .. 10 11 12 13 14 .. 16 > >> (Page 12 of 16)
From: Esmail <eb...@ho...> - 2009年06月08日 03:10:11
Brian Blais wrote:
> On Jun 4, 2009, at 19:48 , Esmail wrote:
> 
>> Someone recently generously shared this code with me on the python
> 
> since I was the one to share this with you, I might be able to answer a 
> couple questions. :)
Hi Brian,
(sorry for the tardy reply)
I was grateful for the code example, I didn't want to bother you with
more questions.
>> .. these sort of things I
>> am curious to learn about before I see them in code for the first
>> time.
>>
> 
> actually, that's how I learned most of it...by seeing it in code at some 
> point. :)
Yes, that is very instructive - though a nice narrative/tutorial would
be good too. I'll have to see if I can find a copy of the book locally for
me to look through.
> hope this helps,
It sure does, thanks again,
Esmail
From: Esmail <eb...@ho...> - 2009年06月08日 03:05:34
John Hunter wrote:
> On Thu, Jun 4, 2009 at 6:48 PM, Esmail <eb...@ho...> wrote:
>> Hi,
>>
>> Beginning Python Visualization: Crafting Visual Transformation Scripts
>> by Shai Vaingast
>> http://www.amazon.com/Beginning-Python-Visualization-Transformation-Professionals/dp/1430218436/ref=sr_1_1?ie=UTF8&s=books&qid=1244158389&sr=8-1
>>
>>
>> Has anyone seen/read this book? I am looking for a good
>> hardcopy reference for matplotlib and associated tools.
>>
>> While the gallery on the matplotlib site is a good way to learn, I
>> would like a reference guide that I could easily print out or
>> a tutorial of sorts, or possibly this book.
Hi John,
(sorry for the tardy reply)
> Have you tried the official docs? While they are not complete, they do
> cover a number of things you mention that you have not seen before
> (ion, draw, tutorial, etc.)
> 
> HTML: http://matplotlib.sourceforge.net/users/index.html
> PDF: http://matplotlib.sf.net/Matplotlib.pdf
Thanks for these links, I don't have a problem looking up stuff once
I see it used (like I did once I examined the sample code), but the
problem is unless I see it used, I really don't know that it's available :-)
I guess looking over the various APIs will help.
> The book you refer to was recently reviewed on slashdot, BTW
> 
> http://books.slashdot.org/article.pl?sid=09/05/27/1327255&from=rss
> 
> I've browsed some chapters on Amazon, and it looks well done, but have
> not read it myself.
I read the ./ review, and there was a post on the general python mailing list
too - it looks promising. I'll have to see if I can find a copy to browse it
myself. I've really been impressed with this software (usually I'm a big fan
of gnuplot).
By the way, any idea how different the MayaVi interface is? I understand that
matplotlib doesn't do 3D plots and I may want to plot some.
Thanks again,
Esmail
From: Xavier G. <xav...@gm...> - 2009年06月07日 20:52:46
Eric Firing wrote:
> Xavier Gnata wrote:
>> Hi,
>>
>> I'm trying to modify the imshow colormapping on the flight:
>>
>> http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize 
>>
>> "Colormapping typically involves two steps: a data array is first 
>> mapped onto the range 0-1 using an instance of Normalize 
>> <http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize> 
>> or of a subclass; then this number in the 0-1 range is mapped to a 
>> color using an instance of a subclass of Colormap 
>> <http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Colormap>" 
>>
>>
>> How should I modify the way "data array is first mapped onto the 
>> range 0-1"?
>> I would like to map all the values <T1 to 0, all the values>T1 to 1 
>> and use an affine function to map all the others values into ]0,1[. 
>> In a more generic way, how should I modify the way the normalization 
>> step is 
>> <http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize> 
>> performed?
>> I could modify the values to be displayed but it is ugly.
>
> Functions and methods that take cmap kwargs also take norm kwargs; 
> they work together. The Normalize subclass instance passed in via the 
> norm kwarg is what does the mapping of the original data to the 0-1 
> range. For examples, see lib/matplotlib/colors.py, which has the 
> Normalize base class and the LogNorm, BoundaryNorm, and NoNorm 
> subclasses.
>
> Eric
Ok. So I just create class MyNorm(matplotlib.colors.Normalize) and call 
imshow(A,cmap=cmap_xmap(lambda x:x,get_cmap("hot")),norm=MyNorm)
That looks easy :)
Thanks.
Xavier
From: Eric F. <ef...@ha...> - 2009年06月07日 17:18:49
Xavier Gnata wrote:
> Hi,
> 
> I'm trying to modify the imshow colormapping on the flight:
> 
> http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize
> "Colormapping typically involves two steps: a data array is first mapped 
> onto the range 0-1 using an instance of Normalize 
> <http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize> 
> or of a subclass; then this number in the 0-1 range is mapped to a color 
> using an instance of a subclass of Colormap 
> <http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Colormap>" 
> 
> 
> How should I modify the way "data array is first mapped onto the range 0-1"?
> I would like to map all the values <T1 to 0, all the values>T1 to 1 and 
> use an affine function to map all the others values into ]0,1[. In a 
> more generic way, how should I modify the way the normalization step is 
> <http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize> 
> performed?
> I could modify the values to be displayed but it is ugly.
Functions and methods that take cmap kwargs also take norm kwargs; they 
work together. The Normalize subclass instance passed in via the norm 
kwarg is what does the mapping of the original data to the 0-1 range. 
For examples, see lib/matplotlib/colors.py, which has the Normalize base 
class and the LogNorm, BoundaryNorm, and NoNorm subclasses.
Eric
> 
> 
> It is easy to modify the values of the second step of Colormapping:
> from pylab import *
> from numpy import *
> 
> def G(i,j):
> return exp(-((i-100)**2+(j-100)**2)/50.)
> 
> def cmap_xmap(function,cmapInput):
> cdict = cmapInput._segmentdata.copy()
> function_to_map = lambda x : (function(x[0]), x[1], x[2])
> for key in ('red','green','blue'):
> cdict[key] = map(function_to_map, cdict[key])
> cdict[key].sort()
> return matplotlib.colors.LinearSegmentedColormap('MyMap',cdict,1024)
> 
> A=fromfunction(G,(200,200))
> imshow(A,cmap=cmap_xmap(lambda x:x**60,get_cmap("hot")))
> 
> but it does no help.
> 
> Xavier
> 
> ------------------------------------------------------------------------------
> 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: Xavier G. <xav...@gm...> - 2009年06月07日 11:46:15
Hi,
I'm trying to modify the imshow colormapping on the flight:
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize
"Colormapping typically involves two steps: a data array is first mapped 
onto the range 0-1 using an instance of Normalize 
<http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize> 
or of a subclass; then this number in the 0-1 range is mapped to a color 
using an instance of a subclass of Colormap 
<http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Colormap>" 
How should I modify the way "data array is first mapped onto the range 0-1"?
I would like to map all the values <T1 to 0, all the values>T1 to 1 and 
use an affine function to map all the others values into ]0,1[. In a 
more generic way, how should I modify the way the normalization step is 
<http://matplotlib.sourceforge.net/api/colors_api.html?highlight=linearsegmentedcolormap#matplotlib.colors.Normalize> 
performed?
I could modify the values to be displayed but it is ugly.
It is easy to modify the values of the second step of Colormapping:
from pylab import *
from numpy import *
def G(i,j):
 return exp(-((i-100)**2+(j-100)**2)/50.)
def cmap_xmap(function,cmapInput):
 cdict = cmapInput._segmentdata.copy()
 function_to_map = lambda x : (function(x[0]), x[1], x[2])
 for key in ('red','green','blue'):
 cdict[key] = map(function_to_map, cdict[key])
 cdict[key].sort()
 return matplotlib.colors.LinearSegmentedColormap('MyMap',cdict,1024)
A=fromfunction(G,(200,200))
imshow(A,cmap=cmap_xmap(lambda x:x**60,get_cmap("hot")))
but it does no help.
Xavier
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
From: Jae-Joon L. <lee...@gm...> - 2009年06月05日 22:33:37
John,
These ideas have been part of motivation behind my axes_grid toolkit.
In the module documentation of
"lib/mpl_toolkits/axes_grid/axislines.py", I tried to briefly explain
what I wanted and what I implemented, although the explanation is very
far from complete (also some examples are found in
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline
). Note that my ultimate goal was to support the curvelinear
coordinate system, as demonstrated in my recent example
(examples/axes_grid/demo_curvelinear_grid.py).
And my hope is that, if we're going to this direction and somehow
expand the "spines" to support these ideas, please make it possible to
customize and expand although only the basic features are supported by
the vanilla mpl. For example, in curvelinear coordinate, ticks can
have arbitrary angles, so I hope that the tickstyles are not strictly
limited to [TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN] by design. It would
be great if there is a chance to discuss about the overall design
before implementing something in this regard.
My current implementation in axes_grid toolkit became rather
complicated, and some of them are implemented in quick and dirty ways.
However, I guess it would be helpful to go over how thing are
currently implemented in axes_grid toolkit and further discuss how
we're going to do this within the mpl. I'll try to write up short
documentation about my design during this weekend.
Regards,
-JJ
On Fri, Jun 5, 2009 at 1:07 PM, John Hunter<jd...@gm...> wrote:
> On Fri, Jun 5, 2009 at 11:44 AM, Andrew Straw<str...@as...> wrote:
>
>> I think this would be a good direction, as well. It would also allow
>> disabling the tick mark labels in some axes that share the same axis --
>> because the ticks/labels would belong to the spine, which itself
>> wouldn't (necessarily) be shared.
>>
>> I can't promise anything, but this may be a solution to the issues that
>> Jae-Joon pointed out w.r.t loglog plots in the spine implementation
>> (although I suspect they are more general). I'll take a look at it,
>> although I can't say exactly when I'll do so -- hopefully within the
>> coming week.
>
> If you go this route, you may want to look at abolishing the Tick
> class entirely -- once the ticks are associated with a spine, we will
> not need the tick1line, tick2line, label1, label2 instances. We can
> draw all the ticks along a given spine with a single Line2D object
> using the marker styles TICKLEFT, TICKRIGHT, TICKUP, and TICKDOWN. We
> really do not need heterogeneous properties along a given spine, so we
> are paying a lot to have separate artist instances for each of these
> things. The tick labels will be a little harder since Text is so
> complicated, so you might want to punt at the outset and just have the
> spine hold a list of Text instances, and down the road we can think
> about a more efficient text collection if necessary.
>
> Thinking out loud.... But for nonlinear coordinate systems, where
> ticks may be oriented in different directions, the single Line2D idea
> may not work so tread cautiously -- perhaps a line collection for the
> tick lines....
>
> I am willing to have some breakage in support of this, though we can
> try to make the top level axes methods accessor (e get_xticklabels)
> do the intuitive thing.
>
> JDH
>
From: Gökhan S. <gok...@gm...> - 2009年06月05日 19:58:42
Hi,
I sometimes create matplotlib plots without any labels on them -figures
only. Then I add appropriate titles and/or labels using either MS Word or OO
Writer.
A few times used GIMP too to add additional texts. When I can't easily
figure out things in matplotlib this method turns out helpful to accomplish
the task.
Gökhan
On Fri, Jun 5, 2009 at 2:32 PM, Yves-Alexandre <yve...@ho...>wrote:
> Hi,
>
> A quick (probably easy) question: how do you do a label in two lines and
> with both lines centered?
>
> xlabel('first line \n second line') don't center both :(
>
> best,
>
> -Yva.
>
>
> ------------------------------------------------------------------------------
> 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: Ryan M. <rm...@gm...> - 2009年06月05日 19:50:37
On Fri, Jun 5, 2009 at 2:32 PM, Yves-Alexandre <yve...@ho...>wrote:
> Hi,
>
> A quick (probably easy) question: how do you do a label in two lines and
> with both lines centered?
>
> xlabel('first line \n second line') don't center both :(
Try removing the spaces, that makes it look good for me:
xlabel('first line\nsecond line')
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
From: Yves-Alexandre <yve...@ho...> - 2009年06月05日 19:33:37
Hi,
A quick (probably easy) question: how do you do a label in two lines and 
with both lines centered?
xlabel('first line \n second line') don't center both :(
best,
-Yva.
From: Young, K. <kar...@uc...> - 2009年06月05日 18:06:47
Hi Eric,
Thanks much - I'll try that.
________________________________________
From: Eric Firing [ef...@ha...]
Sent: Friday, June 05, 2009 10:43 AM
To: Young, Karl
Cc: John Hunter; mat...@li...
Subject: Re: [Matplotlib-users] consistent colors between imshow and scatter
Young, Karl wrote:
> Thanks for the tip and sorry I didn't include a complete code
> snippet; the current code involves images (scipy.ndimage) and
> clustering code and I thought that was a little too much too include;
> I'll try to extract something simpler. I guess the main question is
> how to use a set of integers to index a color space consistently for
> both scatter and imshow but I'll try to come up with a simple
> example. Thanks agan.
>
Karl,
It sounds like you need to specify the norm=colors.NoNorm() argument.
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=nonorm#matplotlib.colors.NoNorm
 Then if your data are integers (typed as integers, not just taking
integer values), they will be interpreted as indices into the color
table. You will probably also want to generate that table yourself and
specify it via the cmap=my_cmap kwarg. If you have only a few values,
then you may want to generate it as a colors.ListedColormap:
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=listedcolormap#matplotlib.colors.ListedColormap
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html?highlight=listedcolormap
It looks like we don't have any good examples sitting around showing the
use of NoNorm; but try it anyway.
Eric
From: Eric F. <ef...@ha...> - 2009年06月05日 17:44:00
Young, Karl wrote:
> Thanks for the tip and sorry I didn't include a complete code
> snippet; the current code involves images (scipy.ndimage) and
> clustering code and I thought that was a little too much too include;
> I'll try to extract something simpler. I guess the main question is
> how to use a set of integers to index a color space consistently for
> both scatter and imshow but I'll try to come up with a simple
> example. Thanks agan.
> 
Karl,
It sounds like you need to specify the norm=colors.NoNorm() argument.
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=nonorm#matplotlib.colors.NoNorm
 Then if your data are integers (typed as integers, not just taking 
integer values), they will be interpreted as indices into the color 
table. You will probably also want to generate that table yourself and 
specify it via the cmap=my_cmap kwarg. If you have only a few values, 
then you may want to generate it as a colors.ListedColormap:
http://matplotlib.sourceforge.net/api/colors_api.html?highlight=listedcolormap#matplotlib.colors.ListedColormap
http://matplotlib.sourceforge.net/examples/api/colorbar_only.html?highlight=listedcolormap
It looks like we don't have any good examples sitting around showing the 
use of NoNorm; but try it anyway.
Eric
From: Eric F. <ef...@ha...> - 2009年06月05日 17:35:16
Markus Feldmann wrote:
> Hi All,
> 
> i try to get a colorbar to work with:
> if not hasattr(self, 'subplot3'):
> self.subplot3 = self.figure.add_subplot(111)
> self.subplot3.grid(True)
> x,y,z = self.computehistogramm(min,min+self.maxitems)
> X,Y = meshgrid(x,y)
> plot = self.subplot3.pcolor(Y,X,z)
> self.figure.colorbar(plot)
> 
> but the x and y axis are interchanged, like this:
> 
> 
> X
> |
> |
> |
> |
> |
> o-------------Y
> 
> But i want this:
> Y
> |
> |
> |
> |
> |
> o-------------X
> 
> So how can i change this ?
> the x and y data also depends on Z, so when i change x<-->y then i have
> change z too ?
> 
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.
http://matplotlib.sourceforge.net/api/pyplot_api.html#axes-pcolor-grid-orientation
Eric
> Any hints for me ?
> 
> As i read in the examples and in the docu this shoul be right,
> self.subplot3.pcolor(x,y,z)
> 
> But then my x and y data are wrong assigned to z, so i wrote
> self.subplot3.pcolor(y,x,z)
> 
> How to change my code so x and y are right assigned to z and i get this:
> Y
> |
> |
> |
> |
> |
> o-------------X
> 
> 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: John H. <jd...@gm...> - 2009年06月05日 17:07:05
On Fri, Jun 5, 2009 at 11:44 AM, Andrew Straw<str...@as...> wrote:
> I think this would be a good direction, as well. It would also allow
> disabling the tick mark labels in some axes that share the same axis --
> because the ticks/labels would belong to the spine, which itself
> wouldn't (necessarily) be shared.
>
> I can't promise anything, but this may be a solution to the issues that
> Jae-Joon pointed out w.r.t loglog plots in the spine implementation
> (although I suspect they are more general). I'll take a look at it,
> although I can't say exactly when I'll do so -- hopefully within the
> coming week.
If you go this route, you may want to look at abolishing the Tick
class entirely -- once the ticks are associated with a spine, we will
not need the tick1line, tick2line, label1, label2 instances. We can
draw all the ticks along a given spine with a single Line2D object
using the marker styles TICKLEFT, TICKRIGHT, TICKUP, and TICKDOWN. We
really do not need heterogeneous properties along a given spine, so we
are paying a lot to have separate artist instances for each of these
things. The tick labels will be a little harder since Text is so
complicated, so you might want to punt at the outset and just have the
spine hold a list of Text instances, and down the road we can think
about a more efficient text collection if necessary.
Thinking out loud.... But for nonlinear coordinate systems, where
ticks may be oriented in different directions, the single Line2D idea
may not work so tread cautiously -- perhaps a line collection for the
tick lines....
I am willing to have some breakage in support of this, though we can
try to make the top level axes methods accessor (e get_xticklabels)
do the intuitive thing.
JDH
8 messages has been excluded from this view by a project administrator.

Showing results of 383

<< < 1 .. 10 11 12 13 14 .. 16 > >> (Page 12 of 16)
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 によって変換されたページ (->オリジナル) /