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

Showing 9 results of 9

From: Ryan K. <rya...@gm...> - 2006年03月06日 22:50:40
Attachments: gray.pdf
I have a small problem when saving figures with
savefig.facecolor : gray #white # figure facecolor when saving
savefig.edgecolor : gray #white # figure edgecolor when saving
set in my rc file.
If I run
t=3Darange(0,1,0.1)
y=3Dsin(2*pi*t)
plot(t,y)
xlabel('Time (sec)')
ylabel('amplitude')
savefig('gray.eps')
and then epstopdf gray.eps, I get the attached file with the gray
border not going quite low enough. This doesn't occur when saving
.png. It also seems to be o.k. if I just use xlabel('time') without
the parenthesis and uppercase T.
I am including the figures in a Latex beamer presenation with a dark
background and I need the gray border for visability.
I tried switching to gs-8.50, but the problem didn't do away. I am
using version 0.86.2 which is probably cvs from a month ago.
Ryan
From: Gerald J. M. M. <Ger...@jp...> - 2006年03月06日 20:01:52
Hello,
Is there a way to specify that a legend show its items
horizontally instead of vertically, i.e.:
x-x-x-x label1 y-y-y-y label2 z-z-z-z label3
vs.
x-x-x-x label1
y-y-y-y label2
z-z-z-z label3
?
Thanks,
Gerald
From: John H. <jdh...@ac...> - 2006年03月06日 18:04:48
>>>>> "Christopher" == Christopher Barker <Chr...@no...> writes:
 Christopher> Nikolai Hlubek wrote:
 >> Wouldn't another 'axis' option make the whole thing more
 >> consistent?
 Christopher> <soapbox>
 Christopher> Using the OO interface everywhere would make the
 Christopher> whole thing more consistent:
 Christopher> fig = pylab.figure(1) ax = fig.add_subplot(111)
 Christopher> ax.set_xlim(-0.25,2.0) ax.set_ylim(0.0,1.3)
 Christopher> ax.set_aspect('scaled', True)
 Christopher> ax.set_autoscale_on(False) ax.plot((0,.2,.3,.4,1.5),
 Christopher> (0,.5,.3,.92,.48))
 Christopher> <\soapbox>
or if you want to save some typing
 fig = pylab.figure(1)
 ax = fig.add_subplot(111, 
 xlim=(-0.25,2.0), ylim=(0.0,1.3), 
 aspect=('scaled', True), autoscale_on=False)
 ax.plot((0,.2,.3,.4,1.5), (0,.5,.3,.92,.48))
JDH
From: Christopher B. <Chr...@no...> - 2006年03月06日 17:53:53
Nikolai Hlubek wrote:
> Wouldn't another 'axis' option make the
> whole thing more consistent?
<soapbox>
Using the OO interface everywhere would make the whole thing more 
consistent:
fig = pylab.figure(1)
ax = fig.add_subplot(111)
ax.set_xlim(-0.25,2.0)
ax.set_ylim(0.0,1.3)
ax.set_aspect('scaled', True)
ax.set_autoscale_on(False)
ax.plot((0,.2,.3,.4,1.5), (0,.5,.3,.92,.48))
<\soapbox>
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
 		
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Christopher B. <Chr...@no...> - 2006年03月06日 17:28:27
Steve Chaplin wrote:
> Using the latest cairo (git), pycairo (cvs) and matplotlib (svn) and
> running examples/simple_plot.py I get a 22K PDF file. But when I try to
> view it with evince and xpdf I get "unable to open document" type
> errors.
This is just a shot in the dark, but I've been playing with pycairo a 
bit, and found that you need to make sure to call:
cairo.Context.show_page()
When you're done with the rendering. I had similar symptoms before I did 
that.
John,
What are your plans regarding Cairo and the future of rendering for MPL? 
I'm in the need of alpha blended rendering for wxPython stuff, so I've 
been looking at Cairo and Agg. Agg is a great solution for really nice 
rendering, but Cairo has the promise of supporting everything else I 
need, like PDF for instance.
Now that Mozilla seems to be adopting Cairo, it might even live up to 
the promise of a fully cross-platform solution. If so, it would be great 
to develop a really general purpose, robust, numpy-aware, pythonic 
interface for it.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
 		
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Sarah M. <mou...@gm...> - 2006年03月06日 15:52:52
Hi all,
I've only started using matplotlib very recently, and it's hugely
impressive. My current plotting is (occasionally) failing with the
error copied below (Fedora Core 4 standard install, Python 2.4...).
Does anyone know what causes this and whether I can tell from the data
being plotted whether it might happen? Sorry if that's a dumb
question, but ....
Many thanks!
Sarah
matplotlib error report:
 File "./random_error3d.py", line 142, in plot_results
 pylab.plot(x, y0, 'ro', x, y1, 'g^', x, y2, 'b+')
 File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line
2129, in plot
 ret =3D gca().plot(*args, **kwargs)
 File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 2792, in=
 plot
 self.autoscale_view()
 File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line
817, in autoscale_view
 self.set_ylim(locator.autoscale())
 File "/usr/lib/python2.4/site-packages/matplotlib/ticker.py", line
797, in autoscale
 return take(self.bin_boundaries(dmin, dmax), [0,-1])
 File "/usr/lib/python2.4/site-packages/matplotlib/ticker.py", line
767, in bin_boundaries
 scale, offset =3D scale_range(vmin, vmax, nbins)
 File "/usr/lib/python2.4/site-packages/matplotlib/ticker.py", line
738, in scale_range
 ex =3D divmod(math.log10(meanv), 1)[0]
OverflowError: math range error
--
http://www.mis.coventry.ac.uk/research/imd/
http://varspool.blogspot.com
From: Nikolai H. <nik...@ma...> - 2006年03月06日 15:26:43
Hi everyone
When looking at the little code example below
it can be seen see that you have to mix programming
paradigms to disable autoscaling:
 figure(1)
 ax = subplot(111)
 axis((-0.25,2.0,0.0,1.3))
 axis('scaled')
 ax.set_autoscale_on(False)
Wouldn't another 'axis' option make the
whole thing more consistent?
 figure(1)
 axis((-0.25,2.0,0.0,1.3))
 axis('scaled')
 axis(autoscale=False)
Best regards,
Nikolai
-- 
"1984" is not a howto!
From: John H. <jdh...@ac...> - 2006年03月06日 14:14:20
>>>>> "Toon" == Toon Verstraelen <Too...@UG...> writes:
 Toon> Currently I have written a wrapper script that allows me to
 Toon> set all types of margins in inches instead of relative
 Toon> coordinates:
 Toon> I wonder if their is a cleaner way of doing this, without a
 Toon> wrapper function? Is it possible to organize multiple axes
 Toon> in a plot in another way than using the pylab.subplot
 Toon> function?
Yes, you want to use the pylab axes function
 http://matplotlib.sourceforge.net/matplotlib.pylab.html#-axes
which allows you to place an axes anywhere. Still uses relative
coords, but your arithmetic will be *much easier* than it was for
subplots. Eg where leftrel is the relative left border and leftin is
the left border in inches, you can compute letfrel (which is what axes
wants) with 
 leftrel = leftin / figwidth
 Toon> I'm currently preparing a publication for which the plots
 Toon> are created with matplotlib, and I would like to share some
 Toon> of my experiences. The (future) ambition of matplotlib is to
 Toon> create plots that are publication-ready. For basic plots
 
I would argue that this is the current ambition, as I do believe
people are submitting matplotlib plots for publication :-) 
I know I have. But you are right, there is certainly work to do,
because there is no end to the tinkering people have to do to comply
with journal guidelines. And to satisfy their own need to tinker and
avoid real work :-)
 Toon> this is certainly no problem at all, but for complex plots
 Toon> containing multiple axes etc, the pylab.subplot function is
 Toon> too restrictive.
Right, it's just a special case helper function. Here is a screenshot
using axes
 http://matplotlib.sourceforge.net/screenshots.html#axes_demo
 Toon> As an example, I have attached one of the types of plots I'm
 Toon> working on. I have to use wrapper functions like the one
 Toon> given above, to make sure that the subplots are squares and
 Toon> the horizontal and vertical distances between them are
 Toon> equal. This is luckily not a blocker, but the choice of
 Toon> working with relative coordinates, is not always ideal. A
 
I agree. It would be nice to be able to pass in units of your choice,
inches, points, cm, relative, pixel, data for all locations. You can
do this relatively easy for some datatypes (eg lines, text, etc) by
using custom transforms, but not everywhere (eg axes positions are
always relative).
 Toon> problem I could not solve up to know, is aligning the labels
 Toon> at the left and the bottom of the plot. Don't get me wrong,
 Toon> I know that it is very difficult to implement a plotting
 Toon> interface that is able to deal with all these details.
 Toon> Are their any development plans to go further that the
 Toon> subplot- interface? I have some experience with writing
 Toon> GTK-applications. The GTK library contains a series of
 Toon> widgets (tables, hboxes, vboxes, ...) that are purely used
 Toon> for organizing the positions and sizes of the actual widgets
We've talked about this. layout engines like this are pretty hard to
do well. As you've noticed, matplotlib doesn't try to be smart, but
does try and give you handles to tweak things so that you can
ultimately get them where you want them. 
 Toon> of interest (entries, buttons, labels, ...). A similar
 Toon> approach in matplotlib would be a great improvement. The
 Toon> organizational widgets should have properties like margins,
 Toon> spacings, ..., that can be given in different units
 Toon> (relative or absolute). The actual widgets of interest in
 Toon> this analogy are axes, labels (for the title and
 Toon> axislabels), ticks with labels and legends.
 Toon> What do you matplotlib-people think of such an idea? Is it
 Toon> completely over-engineered? Maybe some parts are already
 Toon> partially implemented? I would be happy to work out this
 Toon> idea and start implementing it. It's a rather huge job, as I
 Toon> am not yet familiar with the complete matplotlib code. Some
 Toon> discussion in advance, also with non-developers, is
 Toon> therefore more than welcome. Shoot!
You are welcome to work on this. I think it would be a nice
addition. You might want to start by looking at the Axis code for
example to see how the xlabel and ylabel position are chosen to not
overlap the tick labels, as an example of how to work with the
matplotlib bounding boxes. This kind of stuff will be essential for
your layout algorithms.
Cheers, 
JDH
From: Toon V. <Too...@UG...> - 2006年03月06日 11:17:29
Hi,
I'm not sure whether my previous mail has really reached the mailing 
list or not. Excuse me if it is posted twice.
Currently I have written a wrapper script that allows me to set all 
types of margins in inches instead of relative coordinates:
width -- the width of the figure in inches
height -- the height of the figure in inches
margins -- a list of margins [left, right, bottom, top] in inches
spacing -- a list containing the horizontal and the vertical spacing
 between the subplots.
pylab.gcf().set_figsize_inches(width, height)
all_axes_width = (width - margins[0] - margins[1])
axes_width = (all_axes_width - (pylab.gca().numCols - 
1)*spacings[0])/pylab.gca().numCols
all_axes_height = (self.height - margins[2] - margins[3])
axes_height = (all_axes_height - (pylab.gca().numRows - 
1)*spacings[1])/pylab.gca().numRows
pylab.subplots_adjust(
 left=margins[0]/width,
 right=1-margins[1]/width,
 bottom=margins[2]/height,
 top=1-margins[3]/height,
 wspace=spacings[0]/axes_width,
 hspace=spacings[1]/axes_height
)
I wonder if their is a cleaner way of doing this, without a wrapper 
function? Is it possible to organize multiple axes in a plot in another 
way than using the pylab.subplot function?
I'm currently preparing a publication for which the plots are created 
with matplotlib, and I would like to share some of my experiences. The 
(future) ambition of matplotlib is to create plots that are 
publication-ready. For basic plots this is certainly no problem at all, 
but for complex plots containing multiple axes etc, the pylab.subplot 
function is too restrictive.
As an example, I have attached one of the types of plots I'm working on. 
I have to use wrapper functions like the one given above, to make sure 
that the subplots are squares and the horizontal and vertical distances 
between them are equal. This is luckily not a blocker, but the choice of 
working with relative coordinates, is not always ideal. A problem I 
could not solve up to know, is aligning the labels at the left and the 
bottom of the plot. Don't get me wrong, I know that it is very difficult 
to implement a plotting interface that is able to deal with all these 
details.
Are their any development plans to go further that the subplot- 
interface? I have some experience with writing GTK-applications. The GTK 
library contains a series of widgets (tables, hboxes, vboxes, ...) that 
are purely used for organizing the positions and sizes of the actual 
widgets of interest (entries, buttons, labels, ...). A similar approach 
in matplotlib would be a great improvement. The organizational widgets 
should have properties like margins, spacings, ..., that can be given in 
different units (relative or absolute). The actual widgets of interest 
in this analogy are axes, labels (for the title and axislabels), ticks 
with labels and legends.
What do you matplotlib-people think of such an idea? Is it completely 
over-engineered? Maybe some parts are already partially implemented? I 
would be happy to work out this idea and start implementing it. It's a 
rather huge job, as I am not yet familiar with the complete matplotlib 
code. Some discussion in advance, also with non-developers, is therefore 
more than welcome. Shoot!
regards,
Toon

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