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

Showing 10 results of 10

From: Eric F. <ef...@ha...> - 2006年06月15日 23:19:05
Fernando Perez wrote:
> On 6/15/06, Stefan van der Walt <st...@su...> wrote:
> 
> 
>>That's exactly what I need -- except that it forces the creation of a
>>new figure, which doesn't play well with subplot. Specifying a figure
>>number is, like it says in the docstring, rather unpredictable. Is
>>there an easy way to work around that limitation?
> 
> 
> Well, the reason behind creating a new figure was to have tight
> control of the aspect ratio: if you draw into an existing figure, you
> have no idea what its aspect ratio will be. There might have been a
> cleaner solution, but I just punted and went for the obvious: make a
> new figure you /know/ will have the right aspect ratio always. Feel
> free to submit an improved version :)
One can control the aspect ratio with Axes.set_aspect(), so making a new 
figure is not really necessary now.
Eric
From: Fernando P. <fpe...@gm...> - 2006年06月15日 22:26:21
On 6/15/06, Stefan van der Walt <st...@su...> wrote:
> That's exactly what I need -- except that it forces the creation of a
> new figure, which doesn't play well with subplot. Specifying a figure
> number is, like it says in the docstring, rather unpredictable. Is
> there an easy way to work around that limitation?
Well, the reason behind creating a new figure was to have tight
control of the aspect ratio: if you draw into an existing figure, you
have no idea what its aspect ratio will be. There might have been a
cleaner solution, but I just punted and went for the obvious: make a
new figure you /know/ will have the right aspect ratio always. Feel
free to submit an improved version :)
Cheers,
f
From: Stefan v. d. W. <st...@su...> - 2006年06月15日 22:20:24
On Thu, Jun 15, 2006 at 11:02:47AM -0600, Fernando Perez wrote:
> On 6/15/06, Stefan van der Walt <st...@su...> wrote:
> > I often want to plot matrices, with the axes labeled according to the
> > matrix index. I.e. the top-lefthand element should be (0,0) and the
> > bottom-righthand element (rows,columns). Setting the extent does
> > work, i.e.
> >
> > ax.imshow(im,extent=3D(1,columns,rows,1))
> >
> > If others also use this frequently, it may be useful to have a quick
> > way of doing it (or maybe, there already is, and I've missed it).
>=20
> See matshow(), by yours truly :) One of my few direct contributions
> to mpl. There may be a better way to do what it does with today's
> mpl, but it works for me (all the figures from the SANUM talk were
> done with it).
That's exactly what I need -- except that it forces the creation of a
new figure, which doesn't play well with subplot. Specifying a figure
number is, like it says in the docstring, rather unpredictable. Is
there an easy way to work around that limitation?
An example plot of what I would like to see is at
http://mentat.za.net/results/lp.jpg
Cheers
St=E9fan
From: John H. <jdh...@ac...> - 2006年06月15日 19:22:13
>>>>> "Tony" == Tony Mannucci <Ton...@jp...> writes:
 Tony> axvline does not appear to work correctly. It appears to
 Tony> change the plot axes. For example:
Thanks for the bug-report and example code, this is now fixed in svn
2481. To fix this, I also added support for selective autoscaling in
ax.autoscale_view and ax.plot, so you can say
 ax.autoscale_view(scaley=False)
or 
 ax.plot(something, scaley=False)
JDH
From: Fernando P. <fpe...@gm...> - 2006年06月15日 17:02:55
On 6/15/06, Stefan van der Walt <st...@su...> wrote:
> I often want to plot matrices, with the axes labeled according to the
> matrix index. I.e. the top-lefthand element should be (0,0) and the
> bottom-righthand element (rows,columns). Setting the extent does
> work, i.e.
>
> ax.imshow(im,extent=(1,columns,rows,1))
>
> If others also use this frequently, it may be useful to have a quick
> way of doing it (or maybe, there already is, and I've missed it).
See matshow(), by yours truly :) One of my few direct contributions
to mpl. There may be a better way to do what it does with today's
mpl, but it works for me (all the figures from the SANUM talk were
done with it).
Cheers,
f
From: Tony M. <Ton...@jp...> - 2006年06月15日 16:10:43
axvline does not appear to work correctly. It appears to change the plot axes.
For example:
import matplotlib
import pylab as PLT
>>> x
array([ 0., 1., 2., 3.])
>>> y
array([ 2., 3., 5., 6.])
>>> PLT.plot(x,y)
[<matplotlib.lines.Line2D instance at 0x51aa828>]
>>> PLT.axis([0.0,3.0,0.0,5.0])
[0.0, 3.0, 0.0, 5.0]
>>> PLT.axvline(1.5)
<matplotlib.lines.Line2D instance at 0x51c1300>
>>> PLT.axis()
[0.0, 3.0, 0.0, 6.0]
***NOTE changed plot axes!
>>> matplotlib.__version__
'0.87.2'
The call to axvline changes the axis values. Seems to me it should not do that.
-Tony
-- 
Tony Mannucci
Supervisor, Ionospheric and Atmospheric Remote Sensing Group
 Mail-Stop 138-308, Tel > (818) 354-1699
 Jet Propulsion Laboratory, Fax > (818) 393-5115
 California Institute of Technology, Email > Ton...@jp...
 4800 Oak Grove Drive, http://genesis.jpl.nasa.gov
 Pasadena, CA 91109
From: Hanno K. <kl...@ph...> - 2006年06月15日 15:23:58
I have a very silly question: I have data in the format
x y data(x,y)
and now I would like to plot a point with a color corresponding to
data at position x,y (pretty much like with imshow). Unfortunately,
the data does not always fill a rectangular grid, so that using imshow
just as it is, does not work. What is the best method to do this in
matplotlib?
Thanks in advance,
Hanno 
-- 
Hanno Klemm
kl...@ph...
From: Stefan v. d. W. <st...@su...> - 2006年06月15日 09:26:38
On Tue, Jun 13, 2006 at 06:21:22AM -0500, John Hunter wrote:
> setting the xscale and yscale to 'log' should work fine, as long as
> you make sure the xaxis and yaxis do not contain nonpositive limits.
> For an MxN image, the default limits are 0..N-1 and 0..M-1 and the 0
> will break the log transform. You can work around this by setting the
> image "extent"
>=20
> from pylab import figure, show, nx
> fig =3D figure()
> ax =3D fig.add_subplot(111)
> im =3D nx.mlab.rand(500,500)
> ax.imshow(im, extent=3D(1,501,1,501))
I often want to plot matrices, with the axes labeled according to the
matrix index. I.e. the top-lefthand element should be (0,0) and the
bottom-righthand element (rows,columns). Setting the extent does
work, i.e.
ax.imshow(im,extent=3D(1,columns,rows,1))
If others also use this frequently, it may be useful to have a quick
way of doing it (or maybe, there already is, and I've missed it).
Regards
St=E9fan
From: John P. <joh...@st...> - 2006年06月15日 07:46:26
Hi John
Your suggestions worked perfectly. Thanks!
As an aside, I had been composing my image as a GTK Pixbuf object (via
the gtk.gdk.pixbuf_new_from_data method: hacking about, poking values
into a big array of char) and I did notice that the
gtk.gdk.Pixbuf.get_pixels_array method didn't give me a correct plot. So
im=gtk.Image() then im=set_from_pixbuf(p) and im.show() doesn't give the
same thing as im=p.get_pixels.array() and imshow(im). Evidently the GTK
pixels array isn't laid out the same way as the Matplotlib pixels array.
Is that right? In any case, the answer was to write out to a png file,
then read back in using 'imread'.
wrt 'logspace', I think that a logspace implementation should be pretty
simple (the challenge would be more to know that it's doing all the
right things with namespaces and exceptions and ufuncs etc).
def logspace(low,high,num):
 return pylab.exp(pylab.linspace(pylab.log(low),pylab.log(high),num))
Perhaps someone else could clarify whether or not this implementation is
100% compatible with the Matlab one.
Cheers
JP
John Hunter wrote:
>>>>>> "John" == John Pye <joh...@st...> writes:
>>>>>> 
>
> John> Hi John, The image is correct when plotted using
> John> i=imread('plot.png') then imshow(i), but I want to add
> John> axes. I generated the image directly using GTK commands,
> John> then saved the pixbuf as png. The pixels in the image
> John> correspond to sample points in both x- and y-directions
> John> generated using exp(linspace(log(low),log(high),num). Why is
> John> there no logspace in matplotlib, btw?
>
> I'll be happy to add it -- how about sending a version?
>
> John> All I basically need is a way to say what the range and
> John> distribution of the pixels is: I don't want the axes to
> John> default to integer-numbered linear-spaced values as they
> John> currently do.
>
> John> I tried to see if I could use the set_xscale command but it
> John> seems to be internal and/or only applicable to polar plots?
>
>
> setting the xscale and yscale to 'log' should work fine, as long as
> you make sure the xaxis and yaxis do not contain nonpositive limits.
> For an MxN image, the default limits are 0..N-1 and 0..M-1 and the 0
> will break the log transform. You can work around this by setting the
> image "extent"
>
> from pylab import figure, show, nx
> fig = figure()
> ax = fig.add_subplot(111)
> im = nx.mlab.rand(500,500)
> ax.imshow(im, extent=(1,501,1,501))
> ax.set_xscale('log')
> ax.set_yscale('log')
> show()
>
> Hope this helps,
> JDH
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
-- 
John Pye
School of Mechanical and Manufacturing Engineering
The University of New South Wales
Sydney NSW 2052 Australia
t +61 2 9385 5127
f +61 2 9663 1222
mailto:john.pye_AT_student_DOT_unsw.edu.au
http://pye.dyndns.org/
From: Darren D. <dd...@co...> - 2006年06月15日 00:18:48
I agree that this little experiment of trying to work around latex's 
limitations has been too much trouble. I suggest we go back to the old 
behavior, and anyone who wants sans-serif fonts in their exponents can use 
regular mathtext. I'm hopeful that Edin can make some strides with mpl's 
mathtext support, and in the meantime, people should get decent results if 
they set ps.useafm : True in their rc settings.
Comments?
On Wednesday 14 June 2006 19:53, Ryan Krauss wrote:
> (Sorry, I submitted this email with a real figure instead of a toy
> example and the file size was too big and it awaits moderator
> approval).
>
> I am afraid I asked you to open a can of worms and now I don't know
> what we should do. With my font size settings, \small looks to small
> for the exponents. I tried \normalsize and actually got decent
> results with \large (replacing all occurances of \small in your
> ticker.py). See that attached file. But if \small looked good with
> your settings, I am afraid things are now dependent on the font
> settings in the rc file as far as what should go in the latex command
> for the exponents.
>
> I remember that this problem came up because I complained about serif
> fonts in my exponents and we were having a hard time making tex use
> sans serif math fonts.
>
> Maybe the best solution is for me to go back in time and retract that
> complaint.
>
> I don't know. Sorry about the mess this had made. I have plots I am
> fairly happy with (I will poke around in my rc file and see if I can
> find out why my x and y axis fonts look different).
>
> Ryan
>
> On 6/14/06, Ryan Krauss <rya...@gm...> wrote:
> > I am afraid I asked you to open a can of worms and now I don't know
> > what we should do. With my font size settings, \small looks to small
> > for the exponents. I tried \normalsize and actually got decent
> > results with \large (replacing all occurances of \small in your
> > ticker.py). See that attached file. But if \small looked good with
> > your settings, I am afraid things are now dependent on the font
> > settings in the rc file as far as what should go in the latex command
> > for the exponents.
> >
> > I remember that this problem came up because I complained about serif
> > fonts in my exponents and we were having a hard time making tex use
> > sans serif math fonts.
> >
> > Maybe the best solution is for me to go back in time and retract that
> > complaint.
> >
> > I don't know. Sorry about the mess this had made. I have plots I am
> > fairly happy with (I will poke around in my rc file and see if I can
> > find out why my x and y axis fonts look different).
> >
> > Ryan
> >
> > On 6/14/06, Ryan Krauss <rya...@gm...> wrote:
> > > I feel bad that I caused this problem and am now asking you to fix it.
> > >
> > > Ryan
> > >
> > > On 6/14/06, Darren Dale <dd...@co...> wrote:
> > > > This is an artifact that was introduced when I tried to give you
> > > > support for sans-serif fonts in the exponent. Try the attached
> > > > ticker.py, it wraps the exponent in {\small}. Let me know if this is
> > > > acceptable, and I'll commit it.
> > > >
> > > > On Wednesday 14 June 2006 19:14, Ryan Krauss wrote:
> > > > > I still have the problem with large exponents with your
> > > > > matplotlibrc file (but the y-axis plots are no longer different).
> > > > >
> > > > > Any thoughts on what I should try next?
> > > > >
> > > > > Ryan
> > > > >
> > > > > On 6/14/06, Darren Dale <dd...@co...> wrote:
> > > > > > On Wednesday 14 June 2006 18:51, you wrote:
> > > > > > > There was a lot of stuff in my tex.cache, but deleting didn't
> > > > > > > solve my problem.
> > > > > > >
> > > > > > > I may have some strange choices for my fonts and font sizes. 
> > > > > > > Can you send me a copy of your matplotlibrc file.
> > > > > > >
> > > > > > > Ryan
> > > > > > >
> > > > > > > On 6/14/06, Darren Dale <dd...@co...> wrote:
> > > > > > > > Hi Ryan,
> > > > > > > >
> > > > > > > > I'm using the latest svn as well (2479), and I cant reproduce
> > > > > > > > your problem. Try deleting your tex.cache.
> > > > > > > >
> > > > > > > > Darren
> > > > > > > >
> > > > > > > > On Wednesday 14 June 2006 18:14, Ryan Krauss wrote:
> > > > > > > > > I am having a problem with the fonts for exponents on
> > > > > > > > > semilog plots with usetex.
> > > > > > > > >
> > > > > > > > > The attached figure can be generated on my machine with
> > > > > > > > > figure(1)
> > > > > > > > > t=arange(0,10,0.01)
> > > > > > > > > y=sin(2*pi*t)
> > > > > > > > > semilogx(t,y)
> > > > > > > > >
> > > > > > > > > I just upgraded to the latest svn and now the y-axis plots
> > > > > > > > > look different from the x-axis.
> > > > > > > > > matplotlib.__version__
> > > > > > > > > Out[6]: '0.87.3'
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Ryan
> > > > > > > >
> > > > > > > > --
> > > > > > > > Darren S. Dale, Ph.D.
> > > > > > > > Cornell High Energy Synchrotron Source
> > > > > > > > Cornell University
> > > > > > > > 200L Wilson Lab
> > > > > > > > Rt. 366 & Pine Tree Road
> > > > > > > > Ithaca, NY 14853
> > > > > > > >
> > > > > > > > dd...@co...
> > > > > > > > office: (607) 255-9894
> > > > > > > > fax: (607) 255-9001
> > > > > > > >
> > > > > > > >
> > > > > > > > _______________________________________________
> > > > > > > > Matplotlib-users mailing list
> > > > > > > > Mat...@li...
> > > > > > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > > > > > >
> > > > > > > _______________________________________________
> > > > > > > Matplotlib-users mailing list
> > > > > > > Mat...@li...
> > > > > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > > > > >
> > > > > > --
> > > > > > Darren S. Dale, Ph.D.
> > > > > > Cornell High Energy Synchrotron Source
> > > > > > Cornell University
> > > > > > 200L Wilson Lab
> > > > > > Rt. 366 & Pine Tree Road
> > > > > > Ithaca, NY 14853
> > > > > >
> > > > > > dd...@co...
> > > > > > office: (607) 255-9894
> > > > > > fax: (607) 255-9001
> > > >
> > > > --
> > > > Darren S. Dale, Ph.D.
> > > > Cornell High Energy Synchrotron Source
> > > > Cornell University
> > > > 200L Wilson Lab
> > > > Rt. 366 & Pine Tree Road
> > > > Ithaca, NY 14853
> > > >
> > > > dd...@co...
> > > > office: (607) 255-9894
> > > > fax: (607) 255-9001
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Matplotlib-users mailing list
> > > > Mat...@li...
> > > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Darren S. Dale, Ph.D.
Cornell High Energy Synchrotron Source
Cornell University
200L Wilson Lab
Rt. 366 & Pine Tree Road
Ithaca, NY 14853
dd...@co...
office: (607) 255-9894
fax: (607) 255-9001

Showing 10 results of 10

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