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

1 2 3 .. 16 > >> (Page 1 of 16)
From: John H. <jdh...@ac...> - 2006年03月31日 18:20:24
>>>>> "Norbert" == Norbert Nemec <Nor...@gm...> writes:
 Norbert> Nice work, Halldor! I've spent a bit of time on data
 Norbert> interpolation recently, but this Stineman interpolation
 Norbert> method beats everything I came up with in quality and
 Norbert> simplicity.
Wow, you two make a potent team! 
Norbert, I took your revision and made some minor modifications to
support numeric and numarray and added it to matplotlib.mlab. It was
a crime to take your nice code utilizing numpy/numarray array indexing
and backport it to the Numeric.take ugly equivalents, but that's the
price we pay for supporting Numeric.
See examples/interp_demo.py in svn revision 2244
JDH
From: Norbert N. <Nor...@gm...> - 2006年03月31日 13:03:36
Attachments: stinemaninterp.py
Nice work, Halldor!
I've spent a bit of time on data interpolation recently, but this
Stineman interpolation method beats everything I came up with in quality
and simplicity.
I took the freedom of going over your code and putting in all the
experience I gathered before working with Python on data interpolation
and related issues. See attached what I came up with. Compared with your
version this is heavily modified:
* The core change was to get rid of the explicit loop in the
interpolation routine. The method now fully exploits the power of numpy.
* The interface of the interpolation routine is changed. Intention was
to move yp to the back and make it optional. If it is not given, the
"slopes" routine is called automatically.
* The "slopes" routine is changed in its core. Instead of a circular
interpolation (which is problematic if the aspect ratio between the x-
and the y-axis is not known) it now uses a parabola interpolation to
estimate the slope at inner points. For most curves where the original
gave reasonable results, this new version should give something similar.
It should, however, also cover many cases where the original "slopes"
routine would have produced garbage.
* The slopes at the endpoints are now also extrapolated in a much
simpler manner. The intent of the original version was not clear to me,
but it would definitely caused problems in several corner cases.
If you could privately send my a scan of the original paper, I would be
very grateful.
I believe, it would be quite some gain for the matplotlib library to
have this algorithm incorporated. As far as I can see, it should indeed
be very robust for producing nice looking interpolations. One should,
however, warn against its use in scientific context: Interpolation is
always a way of making data look nicer than it actually was measured...
Greetings,
Norbert
From: John H. <jdh...@ac...> - 2006年03月31日 05:22:08
>>>>> "Halldor" =3D=3D Halldor Bj=F6rnsson <ha...@ve...> writes:
 Halldor> The main point of the method was that it did not generate
 Halldor> spline like excursions. The claim was that the method was
 Halldor> "consistantly well behaved".
I took a second look at this, and am curious about the notion of
"consistently well behaved". Do you have some example use cases where
this algorithm "does the right thing" but typical interpolation
algorithms like splines fail? Could you look over the
scipy.interpolate algorithms and see if this one does something that
they do not? test cases in which your algorithm produced good results
but scipy.interpolate algorithms fail would be particularly useful.
Are the excursions you refer to the case of wild extrapolations beyond
the end points of the data being interpolated, or wild fluctuations
between interpolated points?
If you can demonstrate some use-cases, a cleaned up version might be a
useful contribution to scipy.interpolate.
Cheers,
JDH
From: Malte M. <Mal...@cs...> - 2006年03月30日 23:47:51
oops shouldn't have gone to developers...
You are looking for
matplotlib.axes.Subplot.set_position
set_position(self, pos) method of matplotlib.axes.Subplot instance
 Set the axes position with pos = [left, bottom, width, height]
 in relative 0,1 coords
 ACCEPTS: len(4) sequence of floats
axes_top.set_position([left, bottom, width, height])
etc.
On Friday 31 March 2006 08:38, Andrew B. Young wrote:
> Hello:
>
> How does one go about controlling the size of a subplot?
> I've got--
>
> figure = matplotlib.pylab.Figure()
> canvas = FigureCanvas( figure )
> axes_top = figure.add_subplot(211)
> axes_bottom = figure.add_subplot(212)
>
> and I want the _top to occupy 4/5 of the png
> and the _bottom to occupy the remaining 1/5.
>
> Thanks!
> Andrew
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live
> webcast and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Malte Marquarding - Scientific Computing Group
Australia Telescope National Facility
Radiophysics Laboratory, PO Box 76, Epping, Australia, 1710
Phone: (+61) 2 9372 4485 (work) 
 (+61) 421 805 164 (mobile)
email: Mal...@cs...
From: Andrew B. Y. <and...@sr...> - 2006年03月30日 21:38:57
Hello:
How does one go about controlling the size of a subplot?
I've got--
 figure = matplotlib.pylab.Figure()
 canvas = FigureCanvas( figure )
 axes_top = figure.add_subplot(211)
 axes_bottom = figure.add_subplot(212)
and I want the _top to occupy 4/5 of the png
and the _bottom to occupy the remaining 1/5.
Thanks!
Andrew
From: John H. <jdh...@ac...> - 2006年03月30日 21:05:37
>>>>> "Caleb" == Caleb Hattingh <cal...@gm...> writes:
 Caleb> Hi John I posted the following item on comp.lang.python,
 Caleb> but actually you're exactly who I was looking for, and I
 Caleb> could your address off one of your responses to another's
 Caleb> question (I didn't know you read news). By the way,
 Caleb> Matplotlib is one of the best python addons I have ---no
 Caleb> more printing Excel graphs to postscript files :)
Thanks!
 Caleb> I tried several Google searches to no avail. I read
 Caleb> through pretty much most of the online docs at the
 Caleb> matplotlib sourceforge site, but didn't find what I was
 Caleb> looking for. I went through the axis.py and ticker.py code
 Caleb> today, trying to find out how to set the number of points
 Caleb> (ticks) on an axis in Matplotlib.
 Caleb> I know that something like
 >>>> xticks(arange(5))
 Caleb> will make the x-axis have the values specified, but
 Caleb> Matplotlib appears to have a very nice way of setting axis
 Caleb> ticks with human-friendly values that round in just the
 Caleb> right way for a given set of data. I still want that
 Caleb> functionality, but I want to set how many ticks are on a
 Caleb> given axis.
 Caleb> It seems that the locater() classes are where I should
 Caleb> look, and there seem to be some defaults in ticker.py:
 Caleb> class AutoLocator(MaxNLocator): def __init__(self):
 Caleb> MaxNLocator.__init__(self, nbins=9, steps=[1, 2, 5, 10])
 Caleb> I don't understand what this means :)
 Caleb> I would prefer not to hack this directly in the matplotlib
 Caleb> code. How can I change the number of ticks on an axis
 Caleb> programmatically without messing with the other ticklabel
 Caleb> functionality? Caleb
 Caleb> You probably know exactly what I need to do?
Yes, you will want to use a MaxNLocator. Note that the MaxNLocator
sets the maximum number of *intervals* so the maxnumber of ticks will
be the max number of intervals plus one. You could probably adapt
this code to make an ExactNLocator. If you do, please send it our way.
 from matplotlib.ticker import MaxNLocator
 from pylab import figure, show, nx
 fig = figure()
 ax = fig.add_subplot(111)
 ax.plot(nx.mlab.rand(1000))
 ax.xaxis.set_major_locator(MaxNLocator(4))
 show()
Also, please post questions to the matplotlib-users mailing list
rather than to me directly, as there are plenty of experts there
(unlink on c.l.python) who can help you.
Glad you're enjoying matplotlib!
JDH
From: Nicolas D. <du...@pe...> - 2006年03月30日 17:29:29
Yes indeed, I upgraded from 0.87.1 to 0.87.2 and now it works perfectly.
Thanks!
Le Jeudi 30 Mars 2006 19:02, Theodore R Drain a =E9crit=A0:
> Nicolas,
> I'm guessing you're using an older version. I believe this has been fixed
> in the current repository.
>
> Ted
> ps: Anytime you have a problem, it would help a lot if you could supply a=
ll
> the available information (version, platform, sample script, etc).
>
> ----- Original Message -----
> From: Nicolas Dubuit <du...@pe...>
> Date: Thursday, March 30, 2006 4:00 am
> Subject: [Matplotlib-users] figsize with QtAgg backend.
>
> > Hi there,
> >
> > It seems that figsize is not taken into account when using the
> > QtAgg backend,
> > neither with rc, nor as argument , ie figure (figsize=3D(2,3))
> >
> > Does anyone have a workaround for this?
> >
> > Thanks
> >
> > Nicolas
> >
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by xPML, a groundbreaking scripting
> > languagethat extends applications into web and mobile media.
> > Attend the live webcast
> > and join the prime developer group breaking into this new coding
> > territory!http://sel.as-
> > us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=3D121642_____=
__________
> >________________________________ Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting langua=
ge
> that extends applications into web and mobile media. Attend the live
> webcast and join the prime developer group breaking into this new coding
> territory!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat=
=3D121642
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
=2D-=20
=2D------------------------------------------------------------
 Nicolas Dubuit (+33 4 42 25 40 25)
 CEA-Cadarache bat.513 / 13100 ST PAUL LEZ DURANCE CEDEX
=2D------------------------------------------------------------
From: Theodore R D. <The...@jp...> - 2006年03月30日 17:02:45
Nicolas,
I'm guessing you're using an older version. I believe this has been fixed in the current repository.
Ted
ps: Anytime you have a problem, it would help a lot if you could supply all the available information (version, platform, sample script, etc).
----- Original Message -----
From: Nicolas Dubuit <du...@pe...>
Date: Thursday, March 30, 2006 4:00 am
Subject: [Matplotlib-users] figsize with QtAgg backend.
> 
> Hi there, 
> 
> It seems that figsize is not taken into account when using the 
> QtAgg backend, 
> neither with rc, nor as argument , ie figure (figsize=(2,3))
> 
> Does anyone have a workaround for this?
> 
> Thanks
> 
> Nicolas
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting 
> languagethat extends applications into web and mobile media. 
> Attend the live webcast
> and join the prime developer group breaking into this new coding 
> territory!http://sel.as-
> us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: John H. <jdh...@ac...> - 2006年03月30日 16:28:01
>>>>> "Sarah" == Sarah Mount <mou...@gm...> writes:
 Sarah> Hi all, maybe this is a daft question, but is there a
 Sarah> simple way of drawing several histograms on top of one
 Sarah> another on the same axes?
 Sarah> Right now I can't even figure out how to change the bar
 Sarah> colour in a script. I've looked through the code in axes.py
 Sarah> and this looks like it *ought* to be right, but isn't:
 Sarah> ax1 = pylab.axes(...) n, bins, patches = ax1.hist(data,
 Sarah> color='r')
 Sarah> Any ideas would be very much appreciated ...
Ahh yes, the docs could be a little clearer. They say
 kwargs are used to update the properties of the
 hist bars
To make sense of this you would need to know that the bars are
matplotlib.patch.Rectangle objects, and know what properties could be
set on them. We have a goal of making the documentation thorough with
respect to kwargs. In the meantime, scroll through the rectangle
class documentation at
http://matplotlib.sf.net/matplotlib.patches.html for insight.
Here is a hint about how to find these kinds of things out yourself:
Fire up an interactive python shell with support for matplotlib (see
http://matplotlib.sf.net/interactive.html). I use ipython
(http://ipython.scipy.org) in pylab mode. Make a histogram and use
the setp functionality to inspect the properties of the patches
returned by hist. patches are 2D objects like polygons, circles and
rectangles.
johnh@jitter:~> ipython -pylab
/home/titan/johnh/local/lib/python2.3/site-packages/matplotlib/__init__.py:892:
Python 2.3.4 (#12, Jul 2 2004, 09:48:10)
Type "copyright", "credits" or "license" for more information.
IPython 0.7.2.svn -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
 Welcome to pylab, a matplotlib-based Python environment.
 For more information, type 'help(pylab)'.
In [1]: n,bins,patches = hist(randn(1000), 20)
In [2]: setp(patches)
 alpha: float
 animated: [True | False]
 antialiased or aa: [True | False]
 bounds: (left, bottom, width, height)
 clip_box: a matplotlib.transform.Bbox instance
 clip_on: [True | False]
 edgecolor or ec: any matplotlib color - see help(colors)
 facecolor or fc: any matplotlib color - see help(colors)
 figure: a matplotlib.figure.Figure instance
 fill: [True | False]
 hatch: unknown
 height: float
 label: any string
 linewidth or lw: float
 lod: [True | False]
 transform: a matplotlib.transform transformation instance
 visible: [True | False]
 width: float
 x: float
 y: float
 zorder: any number
Scrolling through this list, you see things like edgecolor and
facecolor. You can pass these as kwargs to hist, or use setp
In [3]: setp(patches, edgecolor='g', facecolor='b', linewidth=2);
Hope this helps,
JDH
From: Sarah M. <mou...@gm...> - 2006年03月30日 15:57:18
Hi all,
maybe this is a daft question, but is there a simple way of drawing
several histograms on top of one another on the same axes?
Right now I can't even figure out how to change the bar colour in a
script. I've looked through the code in axes.py and this looks like it
*ought* to be right, but isn't:
ax1 =3D pylab.axes(...)
n, bins, patches =3D ax1.hist(data, color=3D'r')
Any ideas would be very much appreciated ...
Sarah
--
http://www.mis.coventry.ac.uk/research/imd/
http://varspool.blogspot.com
From: John H. <jdh...@ac...> - 2006年03月30日 15:22:58
>>>>> "Halldor" =3D=3D Halldor Bj=F6rnsson <ha...@ve...> writes:
 Halldor> First, I want to thank John Hunter and Jouni Seppanen for
 Halldor> their very useful help with my xticklabel problems. I
 Halldor> have little experience with python, and am a total newbie
 Halldor> wrt. matplotlib (- which is very impressive...).
Thanks!
 Halldor> Few days ago I was looking for a method to interpolate
 Halldor> 12hourly data, and was not happy with the python
 Halldor> alternatives I found. I wanted something in native
 Halldor> python, not wrappers to C or Fortran programs (in this
I think the best reason for writing it up in python is that it is fun
and instructive, but I don't agree with the "not wrappers of C or
Fortran". Note that pylab is built on top of Numeric, which is
written in C, the font handling is built on top of freetype, another C
library, and the antigrain renderer engine is a C++ library.
matplotlib ships with a fair amount of C/C++ code, and scipy does the
same for C, C++ and FORTRAN. The strength of python is its fluid
integration with other languages.
Also, the agg engine provides many 2d interpolation algorithms:
 nearest, bilinear, bicubic, spline16, spline36, hanning, hamming,
 hermite, kaiser, quadric, catrom, gaussian, bessel, mitchell,
 sinc, lanczos, blackman
It would be nice to provide a more direct interface to these, and
other agg image functionality, in matplotlib.
Thanks for your code -- you may also want to look at scipy.interpolate
NAME
 scipy.interpolate
FILE
 /usr/lib/python2.4/site-packages/scipy/interpolate/__init__.py
DESCRIPTION
 Interpolation Tools
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 Wrappers around FITPACK functions:
 splrep -- find smoothing spline given (x,y) points on curve.
 splprep -- find smoothing spline given parametrically defined
 curve.
 splev -- evaluate the spline or its derivatives.
 splint -- compute definite integral of a spline.
 sproot -- find the roots of a cubic spline.
 spalde -- compute all derivatives of a spline at given
 points.
 bisplrep -- find bivariate smoothing spline representation.
 bisplev -- evaluate bivariate smoothing spline.
 Interpolation Class
 interp1d -- Create a class whose instances can linearly
 interpolate
 to compute unknown values.
From: Nicolas D. <du...@pe...> - 2006年03月30日 11:59:14
Hi there, 
It seems that figsize is not taken into account when using the QtAgg backend, 
neither with rc, nor as argument , ie figure (figsize=(2,3))
Does anyone have a workaround for this?
Thanks
Nicolas
From: <ha...@ve...> - 2006年03月30日 11:33:37
Attachments: niceinterp.py
First, I want to thank John Hunter and Jouni Seppanen for their very=20
useful help with my xticklabel problems. I have little experience with=20
python, and am a total newbie wrt. matplotlib (- which is very=20
impressive...).
Few days ago I was looking for a method to interpolate 12hourly data,=20
and was not happy with the python alternatives I found. I wanted=20
something in native python, not wrappers to C or Fortran programs
(in this case speed is not a big issue). It so happened that few weeks=20
ago a coworker gave me a faint photocopy of a photocopy from an article=20
published 26 years ago with an interpolation method I had not seen before.
The main point of the method was that it did not generate spline like=20
excursions. The claim was that the method was "consistantly well behaved".
So, I wrote it up in Python (well, I translated my Matlab code). It=20
seems to work as the author claimed. The interpolation method needs x,y=20
and y' (the slope of y(x)) as input, but the article also provided a=20
simple algorithm to estimate the slope. I am including these functions=20
in an attachment. To use them is very simple:
Example where y' is known
	x =3D seq(0,2*pi,10); y =3D sin(x); yp =3D cos(x)
	xi =3D seq(0,2*pi,40);
	yi =3D StinemanInterp(x,y,yp,xi);
	plot(x,y,'o',xi,yi)
Example where y' is calculated using slopes()
	x =3D seq(0,2*pi,10); y =3D sin(x);
 yp =3D slopes(x,y)
	xi =3D seq(0,2*pi,40);
	yi =3D StinemanInterp(x,y,yp,xi);
	plot(x,y,'o',xi,yi)
I make no claim that the method is fast, nor that my coding is optimal.=20
- I am sure it can be sped up, but it is fast enough for my uses.
Nor do I claim that this is the best interpolation algorithm, - I have=20
no interest in taking part in a religous debate on the merits of=20
different interpolation methods.
For me this is simply a consise method that works resonably well. The=20
slope y' can be calculated using other methods than slopes(),- using=20
divided differences to get the derivative of a quadratic through any=20
three points is straightforward (but not implemented here). Also if yp=20
is simply the linear slope the method yields linear interpolation.
As I said, I have not seen this method before, but it may well be that=20
it is known under a different guise....My coworker got it from a 	Swiss=20
glaciologist....
Sincerely,
Halld=F3r
--=20
Halldor Bjornsson
Bustadavegur 9 IS150 Reykjavik Iceland.
e: halldor()vedur.is tel:+354-522600
From: John H. <jdh...@ac...> - 2006年03月30日 04:50:39
>>>>> "Ralf" == Ralf Gommers <r.g...@uc...> writes:
 Ralf> Hi everyone, Guess no-one has a trick yet to put in an axis
 Ralf> break. My question is now, should this not be on the goals
 Ralf> list at least?
 Ralf> If the developers think it is a good idea to implement this,
 Ralf> I would like to have a go at it. As I'm not all that
 Ralf> familiar with the matplotlib internals it would be great if
 Ralf> someone has any ideas on how to go about it.
This is not possible and is not easy. Currently, we don't even have
independent control of the lines that surround the white axes box (the
left and right y-axis lines and the upper and lower x-axis lines. It
is a long-standing wish to be able to control these independently of
the axes box, and this would be a good place for you to start. See
axis.py and axes.py.
JDH
From: John H. <jdh...@ac...> - 2006年03月30日 04:48:15
>>>>> "Steve" == Steve Schmerler <el...@gm...> writes:
 Steve> Hi I discovered that when I plot many (e.g. 20) data sets
 Steve> in one plot and request a normal boxed legend the
 Steve> whitespace between the lower and upper box bounds and the
 Steve> firet and last legend entries increases with the number of
 Steve> data sets (i.e. legend entries). Is there a way to make
 Steve> this whitespace offset independent from the length of the
 Steve> legend?
Not currently, though it is a good idea. Right now you can control
the legend "pad" which is the fractional whitespace inside the legend
border. So you should be able to tweak this parameter in the final
output to get something that looks about right, but having this in
points rather than in relative coords makes more sense ultimately.
JDH
From: John H. <jdh...@ac...> - 2006年03月30日 01:02:00
>>>>> "James" == James Boyle <bo...@ll...> writes:
 James> The effects are observed from with a single python session.
 James> Out of curiosity - Is there any way of clearing the cache
 James> within a session ?
OK, I think I see what is going on. text.Text is calling
FigureCanvas.draw_text with a font_manager.FontProperties instance.
backend_ps is using the __hash__ method of the FontProperties class to
create a cache mapping the font property to the ttf font found in the
RendererPS._get_font_ttf method.
 def _get_font_ttf(self, prop):
 key = hash(prop)
 font = _fontd.get(key)
 if font is None:
 fname = fontManager.findfont(prop)
 font = FT2Font(str(fname))
 _fontd[key] = font
 if fname not in _type42:
 _type42.append(fname)
 font.clear()
 size = prop.get_size_in_points()
 font.set_size(size, 72.0)
 return font
the hash(prop) call as noted above calls the __hash__ method of the
FontProperties
 def __hash__(self):
 return hash( (
 tuple(self.__family), self.__style, self.__variant,
 self.__weight, self.__stretch, self.__size,
 self.__parent_size, self.fname))
My first guess w/o looking further was that the "family" entry is
'sans-serif' but not the actual font list (eg Lucida versus Bitstream)
and this is the source of your woes. Basically, we need to make the
hash method smarter to take account of the actual family list.
You might insert some debug print statements into the font_manager
class to see what this tuple being passed to hash actually is.
On second glance, the family seems to be set properly
 if family is None: family = rcParams['font.'+rcParams['font.family']]
if rcParams['font.family]' is 'sans-serif', then family should be
rcParams['font.sans-serif'] which is what we want since this is your
new list. But this is only on the family=None branch, so we need to
find out if a) it is working like it should on this branch and b) what
is being passed if family is not None.
You asked about clearing the cache:
 import matplotlib.backends.backend_ps as ps
 ps._fontd = {}
Let us know what you find out...
JDH
From: James B. <bo...@ll...> - 2006年03月29日 22:44:11
The effects are observed from with a single python session.
Out of curiosity - Is there any way of clearing the cache within a 
session ?
Thanks
--Jim
On Mar 29, 2006, at 1:27 PM, John Hunter wrote:
>>>>>> "James" == James Boyle <bo...@ll...> writes:
> James> changed. However, if I just run the rc(font, **fontDict)
> James> command sequence first without ever trying the defaults
> James> fonts all goes well and I get a fine PS file. Evidently,
> James> some aspects of the old font are retained.
>
> Are these effects observed within a single python session (all tests
> in one script or a single interactive session from the shell).
> matplotlib does cache some font information within a single run.
>
> If it is *between* python sessions, you might want to try clearing the
> font cache between runs and see if this makes a difference
>
>> rm -rf ~/.matplotlib/ttffont.cache
>
> JDH
>
From: Diwaker G. <diw...@gm...> - 2006年03月29日 21:50:04
In gnuplot, as one plots multiple lines on the same graph, the default
behavior is that gnuplot automatically selects linestyle, colors and
markers. In matplotlib, the default behavior (if I don't specify
format etc) is to draw every line in solid style, no markers, blue
color. I much prefer gnuplot's default behavior -- is there some way
of configuring matplotlib to do the same?
Thanks,
Diwaker
--
Web/Blog/Gallery: http://floatingsun.net/blog
From: John H. <jdh...@ac...> - 2006年03月29日 21:29:50
>>>>> "James" == James Boyle <bo...@ll...> writes:
 James> changed. However, if I just run the rc(font, **fontDict)
 James> command sequence first without ever trying the defaults
 James> fonts all goes well and I get a fine PS file. Evidently,
 James> some aspects of the old font are retained.
Are these effects observed within a single python session (all tests
in one script or a single interactive session from the shell).
matplotlib does cache some font information within a single run.
If it is *between* python sessions, you might want to try clearing the
font cache between runs and see if this makes a difference
 > rm -rf ~/.matplotlib/ttffont.cache
JDH
From: James B. <bo...@ll...> - 2006年03月29日 20:55:30
Thanks for your help. Encouraged by your results I tried some more 
experiments.
There appears to be some hysteresis in matplotlib fonts ( at least my 
installation).
Unsaid(!!!) in my message was that I initially ran the PS plot with 
the default fonts and generated a defective PS file, and then I tried 
to change the font properties. After running the rc(font, **fontDict) 
command I still generated a defective file but a different size - so 
something changed.
However, if I just run the rc(font, **fontDict) command sequence first 
without ever trying the defaults fonts all goes well and I get a fine 
PS file.
Evidently, some aspects of the old font are retained.
Thanks again,
--Jim
On Mar 29, 2006, at 8:54 AM, js...@fa... wrote:
>
> On 2006年3月29日 10:34:08 -0500, "Darren Dale" <dd...@co...>
> said:
>> On Tuesday 28 March 2006 19:05, you wrote:
>>> plotlibrc setting:
>>> font.sans-serif : Lucida Grande, Verdana, Geneva, Lucida, 
>>> Bitstream
>>> Vera Sans, Arial, Helvetica, Avant Garde, sans-serif
>>> I get a postscript file that I cannot view.
>>> BUT if I change the matplotlibrc file to:
>>> font.sans-serif : Bitstream Vera Sans
>>> All goes well and the PS file is fine. This has been discussed on the
>>> list previously as an OS X font issue.
>>>
>>> My idea was to use the following code to set the font.sans-serif
>>> dynamically.
>>> However, it does not seem to work in that the ps file is not usable 
>>> as
>>> if Lucida Grande was still the font.sans-serif setting.
>>> There might well be something very obvious - From the font manager
>>> code I surmised that the 'sans-serif' entry was a list but I could be
>>> mistaken:
>>>
>>> import matplotlib
>>> matplotlib.use('PS')
>>> from matplotlib import pylab
>>> import Numeric
>>> N = Numeric
>>> PL = pylab
>>> x = N.arrayrange(100.)
>>> y = N.arrayrange(100.)
>>> fontDict = {'family':'sans-serif',
>>> 'style': 'normal',
>>> 'variant':'normal',
>>> 'weight': 'medium',
>>> 'stretch':'normal',
>>> 'size': 12.0,
>>> 'sans-serif':['Bitstream Vera Sans']}
>>> PL.rc('font',**fontDict)
>>> PL.plot(x,y**2)
>>> PL.savefig('crap')
>>> PL.clf()
>>
>> Your second script works fine for me. I was able to switch the font in
>> the
>> postscript file, between Bitstream Vera Sans and Arial, by modifying 
>> your
>> fontDict. I'm using svn mpl on linux, but I dont think anything has
>> changed
>> since 0.87.2 that would effect the results.
>>
>> Are there any Mac users with a free moment to run his script?
>>
>> Darren
>>
>
> Darren and Jim: Works for me on 10.4. -Jeff
>
From: John H. <jdh...@ac...> - 2006年03月29日 20:19:51
>>>>> "Imara" == Imara Jarrett <im...@gm...> writes:
 Imara> Hi there, I am using a 'for loop' to generate multiple
 Imara> scatter plots from my data. So far, so good.
 Imara> I would like to have consistent xticks and yticks for each
 Imara> scatter plot. However, it seems that when I define xticks
 Imara> and yticks (remains the same for each scatter plot), I get
 Imara> different xticks and yticks for each scatterplot depending
 Imara> on the data.
 Imara> How can I make the xticks and yticks consistent over ALL my
 Imara> scatterplots, regardless of the data used to generate them?
some thing like:
xvals = 1,2,3
yvals = 4,5,6
for data in mydata:
 fig = figure(1)
 ax = fig.add_subplot(111)
 ax.scatter(blah, blah, data)
 ax.set_xticks(xvals)
 ax.set_yticks(yvals)
 fig.savefig('myfig')
 close(1)
 
From: Alan G I. <ai...@am...> - 2006年03月29日 20:17:55
> John Hunter <jdh...@ac...> writes: 
>> why would you ask for ticks midnight and noon, and then hide half of 
>> them. Why not just ask for them at noon 
On 2006年3月29日, Jouni K Seppanen apparently wrote: 
> Because I want the tick lines at midnight and labels at noon. 
> If I add an extra show() to the script, it works... there is something 
> going on that I don't understand: 
I do not think this is so unusual for time series data. 
Example: year end marked with tick marks, but year label set 
at June, between the tick marks.
Cheers,
Alan Isaac
From: John H. <jdh...@ac...> - 2006年03月29日 20:13:26
>>>>> "Jouni" == Jouni K Seppanen <jk...@ik...> writes:
 Jouni> John Hunter <jdh...@ac...> writes:
 >> why would you ask for ticks midnight and noon, and then hide
 >> half of them. Why not just ask for them at noon
 Jouni> Because I want the tick lines at midnight and labels at
 Jouni> noon.
I see -- one hack would be to use major and minor ticks. Make the
major ticks at midnight and the minor ticks at noon. Make the major
ticklabels invisible and the minor tick labels visible. Should work.
One way of making the major ticks invisible is to use a NullFormatter
for the major formatter.
 Jouni> If I add an extra show() to the script, it works... there
 Jouni> is something going on that I don't understand:
What you may be seeing with the double show is a side effect of
matplotlib not creating all the ticks it needs until it is drawn , and
when it creates extra ticks it uses the first tick, the protoTick from
axis.py, to determine the properties of the new ticks.
JDH
From: Christopher B. <Chr...@no...> - 2006年03月29日 20:13:15
Charlie Moad wrote:
> Typically I use OSX's python, but I don't want to start that debate. 
No need for debate, I just wanted to know, so I wouldn't be duplicating 
effort. I'm trying to support the new Universal Build (and the 2.4.1 
Framework Build before that), so I wanted to know if I'm duplicating effort.
> New users should probably be
> pointed to the prebuilt 2.4 framework on pythonmac.
Yup!
> I haven't been keeping up with the intel status though.
There is a new universal build of 2.4.3 We're all hoping it will become 
the "standard" build for OS-X >= 10.3.9, for both PPC and Intel. 
However, it can't really be that until we can get all the critical 
packages built for it. wxPython is a big hang up now, and I consider 
matplotlib critical too.
> Are eggs accepted by pythonmac yet or they still using mpkg's exclusively?
We'd like to put eggs on there too. ideally, we'd make a little launcher 
app that would fire up and run easy_install to install them when double 
clicked. That's been talked about, but not yet done. In the meantime, 
something is better than nothing!
> Cocoa-agg works and has been there for the last few releases.
Will it build by default on OS-X?
> Apple's
> python interface to quartz doesn't have much of the text support
> included.
Darn. And it's proprietary isn't it?
> I think it is much better to focus on the Agg backend and
> use it in gui toolkits.
That is a good plan, unless we go to using All-Cairo Doing both seems 
way too redundant. I'm investigating Cairo vs. Agg for another project.
These are my quick thoughts:
Cairo Pluses:
 In theory: native, hardware accelerated back-ends for various platforms
 PDF and PS support: That's very nice, then we'd really have only one 
back-end! (what about Tex?)
 It's being used for GTK2 and part of Mozilla, so it should see a lot 
of activity and testing.
Cairo Minuses:
 It doesn't look like there's much activity on Windows, but that's 
gotten better with the Mozilla folks getting involved. I don't know 
about OS-X
Agg pluses:
 It works now!
 It has fabulous anti-aliasing (I haven't compared to Cairo yet)
 It's smaller and simpler.
Anyone else have some thoughts?
-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: Imara J. <im...@gm...> - 2006年03月29日 20:08:41
Hi there,
I am using a 'for loop' to generate multiple scatter plots from my data. S=
o
far, so good.
I would like to have consistent xticks and yticks for each scatter plot.
However, it seems that when I define xticks and yticks (remains the same fo=
r
each scatter plot), I get different xticks and yticks for each scatterplot
depending on the data.
How can I make the xticks and yticks consistent over ALL my scatterplots,
regardless of the data used to generate them?
Thanks in advance!
5 messages has been excluded from this view by a project administrator.

Showing results of 398

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