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

Showing results of 203

<< < 1 2 3 4 .. 9 > >> (Page 2 of 9)
From: Andrew S. <st...@cs...> - 2005年12月22日 04:35:17
Hi--
I'm trying to get matplotlib installed on my laptop before my holiday 
travels begin. I've acquired all the dependencies through synaptic and 
built matplotlib from source, but when I attempt to import pylab I get 
the following error:
andrew@idioteque:~/.matplotlib$ python
Python 2.4.2 (#2, Sep 30 2005, 22:23:39)
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pylab
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "lines.data_clipping" on line 55 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.major.size" on line 145 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.minor.size" on line 146 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.major.pad" on line 147 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.minor.pad" on line 148 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.color" on line 149 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.labelsize" on line 150 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ?
 from matplotlib.pylab import *
 File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 
194, in ?
 import cm
 File "/usr/lib/python2.4/site-packages/matplotlib/cm.py", line 5, in ?
 import colors
 File "/usr/lib/python2.4/site-packages/matplotlib/colors.py", line 
33, in ?
 from numerix import array, arange, take, put, Float, Int, where, \
 File 
"/usr/lib/python2.4/site-packages/matplotlib/numerix/__init__.py", line 
62, in ?
 from Matrix import Matrix
ImportError: No module named Matrix
 >>>
This happens with Numeric specified in my matplotlibrc. If I specify 
numarray, I get a different import error:
andrew@idioteque:~/.matplotlib$ python
Python 2.4.2 (#2, Sep 30 2005, 22:23:39)
[GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import pylab
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "lines.data_clipping" on line 55 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.major.size" on line 145 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.minor.size" on line 146 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.major.pad" on line 147 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.minor.pad" on line 148 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.color" on line 149 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
/usr/lib/python2.4/site-packages/matplotlib/__init__.py:843: 
UserWarning: Bad key "tick.labelsize" on line 150 in 
/home/andrew/.matplotlib/matplotlibrc
 warnings.warn('Bad key "%s" on line %d in %s' % (key, cnt, fname))
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ?
 from matplotlib.pylab import *
 File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 
194, in ?
 import cm
 File "/usr/lib/python2.4/site-packages/matplotlib/cm.py", line 5, in ?
 import colors
 File "/usr/lib/python2.4/site-packages/matplotlib/colors.py", line 
33, in ?
 from numerix import array, arange, take, put, Float, Int, where, \
 File 
"/usr/lib/python2.4/site-packages/matplotlib/numerix/__init__.py", line 
53, in ?
 from numarray.convolve import cross_correlate, convolve
ImportError: No module named convolve
 >>>
So, I suspect something is wrong in Numerix, but I have no idea what, or 
more importantly how to fix it. Could anyone help? It would be much 
appreciated.
Please cc me; I am not subscrived to the list.
Thanks in advance,
Andrew Stout
From: John H. <jdh...@ac...> - 2005年12月21日 23:35:06
>>>>> "Alan" == Alan G Isaac <ai...@am...> writes:
 Alan> In pylab: just choose the number of bins. Hope this helps.
 Alan> Alan Isaac
 >>>> import pylab as P help(P.hist)
 Alan> Help on function hist in module matplotlib.pylab:
If you know your data are integers, you might get nicer results by
specifying the bins rather than autogenerating them by passing in
number of bins. Eg for a 12 sided dice
 import matplotlib.numerix as nx
 bins = nx.arange(1,13)
 n,bins,patches = P.hist(throws, bins)
JDH
From: Alan G I. <ai...@am...> - 2005年12月21日 23:15:57
In pylab: just choose the number of bins.
Hope this helps.
Alan Isaac
>>> import pylab as P
>>> help(P.hist)
Help on function hist in module matplotlib.pylab:
hist(*args, **kwargs)
 HIST(x, bins=3D10, normed=3D0, bottom=3D0, orientiation=3D'vertical', *=
*kwargs)
 Compute the histogram of x. bins is either an integer number of
 bins or a sequence giving the bins. x are the data to be binned.
 The return values is (n, bins, patches)
 If normed is true, the first element of the return tuple will be the
 counts normalized to form a probability distribtion, ie,
 n/(len(x)*dbin)
 orientation =3D 'horizontal' | 'vertical'. If horizontal, barh
 will be used and the "bottom" kwarg will be the left.
 kwargs are used to update the properties of the
 hist bars
 Addition kwargs: hold =3D [True|False] overrides default hold state
>>>
From: Peter B. <pe...@ma...> - 2005年12月21日 23:09:21
Hi,
I have a data set (number of dice thrown showing a particular number) 
and I'm trying to create a histogram of it. The data is stored in a 
text file, one trial per line, and I'm loading it using load().
Sample data:
12
17
8
12
11
16
It appears I need to group the data somehow into counts, eg:
8 : 1
9 : 0
10 : 0
11 : 1
12 : 2
and so on...
Is there a way to do this in matplotlib or am I missing something 
about hist() or one of the other functions?
Thanks,
Peter
From: Jouni K S. <jk...@ik...> - 2005年12月21日 17:03:16
Steve Schmerler <el...@gm...> writes:
> 	plot(..., label = r'$x^2 = $' + str(3))
>
> produces labels like $x^2 = 3ドル
>
> I think this is because I try to join a "normal" string and a "raw"
> string. Is there a way to do this properly?
The raw-ness is not relevant to the problem; the only thing it does it
prevent special interpretation of backslashes. What is "raw" is the
string literal in your file, not the string value.
You need to keep the dollar signs at the beginning and end. What you
want is the percent-sign operator:
 label = r'$x^2 = %d$' % 3
-- 
Jouni
From: John H. <jdh...@ac...> - 2005年12月21日 14:02:30
I recently spent some time trying to debug what I thought was a memory
leak in matplotlib. I had added tried all sorts of shenanigans to
make sure my memory was freed and the memory collected, but the leak
persisted. I had written code like
for i in somerange:
 fig = figure()
 ...
 fig.savefig(somefile)
 del fig
 gc.collect()
I eventually realized/remembered why this fails: because pylab manages
figures behind the scenes (eg managing the current figure) there is a
dictionary in _pylab_helpers that retains a reference to the figure.
Calling close on the figure removes this reference, so all I really
needed to do was
for i in somerange:
 fig = figure()
 ...
 fig.savefig(somefile)
 close(fig)
and pylab handles the call to gc.collect.
Just a reminder to myself and you all, that even though it looks like
a fig is not being referenced in your local code, there are still
references to it in pylab so if you're using pylab you should balance
each call to figure with a call to close.
JDH
From: John H. <jdh...@ac...> - 2005年12月21日 12:38:42
>>>>> "Jiri" == Jiri Polcar <po...@ph...> writes:
 Jiri> On Tue, Dec 20, 2005 at 07:16:33PM -0600, John Hunter wrote:
 >> Just set the xscale attribute for the axes to be 'log' (and
 >> make sure you have strictly positive data, of course)
 >> 
 >> ax = subplot(111, xscale='log') ax.hist(X, 100)
 >> 
 Jiri> It works. Thanke you very mych. But if I want to set
 Jiri> logaritmic Y-axes also:
 Jiri> ax = subplot(111, xscale='log', yscale='log' )
 Jiri> I get:
My guess is that this is caused by having a histogram bin with no
values, and the log of 0 is undefined. It would be nice if we could
fix this code to be fault tolerant to invalid data, as we did for line
data.
You can inspect the hist output by doing
 n, bins = matplotlib.mlab.hist(X, 100)
and then seeing what the minimum n is. If it is 0, that is likely to
be the source of your troubles,
 Jiri> PS: 'X' contais whole nubers >= 1.
You might try setting the bins manually to workaround this problem, eg
define the bins such that there are no empty bins.
 mybins = nx.arange(1,20)
 n, bins = matplotlib.mlab.hist(X, bins)
Note that matplotlib.mlab.hist is the non-plotting version of hist
that actually computes the histogram. 
JDH
From: Steve S. <el...@gm...> - 2005年12月21日 12:38:39
Hi
I have a problem when joining 2 strings in a label:
	plot(..., label = r'$x^2$')
works, but
	plot(..., label = r'$x^2 = $' + str(3))
produces labels like $x^2 = 3ドル
I think this is because I try to join a "normal" string and a "raw" 
string. Is there a way to do this properly?
cheers,
steve
-- 
Should array indices start at 0 or 1? My compromise of 0.5 was rejected 
without, I thought, proper consideration.
-- Stan Kelly-Bootle
From: Jiri P. <po...@ph...> - 2005年12月21日 09:16:23
On Tue, Dec 20, 2005 at 07:16:33PM -0600, John Hunter wrote:
> 
> Just set the xscale attribute for the axes to be 'log' (and make sure
> you have strictly positive data, of course)
> 
> ax = subplot(111, xscale='log')
> ax.hist(X, 100)
> 
It works. Thanke you very mych. But if I want to set logaritmic Y-axes
also:
 ax = subplot(111, xscale='log', yscale='log' )
I get:
 Traceback (most recent call last):
 File "bin/plot_msg_len_dist.py", line 22, in ?
 savefig( 'smith_msg_length_dist.png' )
 File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 791,
 in savefig
 return fig.savefig(*args, **kwargs)
 File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line
 645, in savefig
 self.canvas.print_figure(*args, **kwargs)
 File
 "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py",
 line 93, in print_figure
 try: agg.print_figure(filename, dpi, facecolor, edgecolor,
 orientation)
 File
 "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py",
 line 445, in print_figure
 self.draw()
 File
 "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py",
 line 382, in draw
 self.figure.draw(renderer)
 File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line
 520, in draw
 for a in self.axes: a.draw(renderer)
 File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1402,
 in draw
 a.draw(renderer)
 File "/usr/lib/python2.4/site-packages/matplotlib/patches.py", line
 127, in draw
 tverts = self._transform.seq_xy_tups(verts)
 ValueError: Domain error on nonlinear Transformation::seq_xy_tups
 operator()(thisx, thisy)
 make: *** [smith_msg_length_dist.png] Error 1
PS: 'X' contais whole nubers >= 1.
--
JP
From: John H. <jdh...@ac...> - 2005年12月21日 03:28:11
>>>>> "Ken" == Ken McIvor <mc...@ii...> writes:
 Ken> The OO API is "the" interface to matplotlib in that it *is*
 Ken> matplotlib... 
If matplotlib had a QOTW .... :-)
JDH
From: John H. <jdh...@ac...> - 2005年12月21日 01:45:41
>>>>> "Ben" == Ben Jefferys <ben...@im...> writes:
 Ben> "/bmm/scratch/brj03/python-latest/lib/python2.4/site-packages/matplotlib/font_manager.py",
 Ben> line 39, in ? from matplotlib import ft2font ImportError:
 Ben> /bmm/scratch/brj03/python-latest/lib/python2.4/site-packages/matplotlib/ft2font.so:
 Ben> undefined symbol:
 Ben> _ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_jc
 Ben> There seem to be problems with the ft2font.so library. Can
 Ben> anyone help?
This looks a little like either a C++ name mangling issue (could you
have used two different versions of g++ in the compiling of mpl or
it's dependencies) or else a discrepancy between which freetype
include headers are found and which libraries you are linking with.
Nadia was working on a patch to statically include freetype and
similar libs. STScI folks: is this still in the works?
JDH
From: John H. <jdh...@ac...> - 2005年12月21日 01:41:21
>>>>> "Chris" == Chris Fonnesbeck <fon...@gm...> writes:
 Chris> I notice that when generating several plots, they are
 Chris> cascaded upon one another, one slightly to the right and
 Chris> below of the previous one. However, when the plots get
 Chris> near the bottom of the screen, they keep cascading even
 Chris> when only the top of the plot can be seen. Should the
 Chris> cascading not reset when the *bottom* of a frame touches
 Chris> the bottom of the screen, and not the top?
 Chris> Also, when the previous plot disappears prior to the
 Chris> current plot, is there any need to cascade them at all?
 Chris> Currently, the plots cascade even when prior plots have
 Chris> disappeared.
Me thinks this is backend dependent behavior, since we don't do
anything explicit here we fall back on the default behavior for each
backend. Backend dependent patches welcome!
JDH
From: John H. <jdh...@ac...> - 2005年12月21日 01:39:33
>>>>> "James" == James Boyle <bo...@ll...> writes:
 James> Ken - Thanks very much or the quick reply - but the problem
 James> is more fundamental:
Hey Jim,
Thanks for the bug report. I just fixed this in CVS. Give it a test
drive.
Checking in lib/matplotlib/dates.py;
/cvsroot/matplotlib/matplotlib/lib/matplotlib/dates.py,v <--
dates.py
new revision: 1.14; previous revision: 1.13
JDH
From: John H. <jdh...@ac...> - 2005年12月21日 01:30:30
>>>>> "Jouni" == Jouni K Seppanen <jk...@ik...> writes:
 Jouni> John Hunter <jdh...@ac...> writes:
 >> To just make clear, the tick.* properties in rc have now been
 >> replaced by xtick.* and ytick.*. If you don't update your rc
 >> file, you'll get lots of warnings when you start matplotlib.
 Jouni> On a related note, how about allowing multiple groups when
 Jouni> calling matplotlib.rc? Now we need to do something like
 Jouni> rc('xtick', **{'major.pad': 2.0, 'major.size': 2.0,
 Jouni> 'labelsize': 6.0}) rc('ytick', **{'major.pad': 2.0,
 Jouni> 'major.size': 2.0, 'labelsize': 6.0})
 Jouni> which is a bit of a nuisance compared to just calling rc
 Jouni> for 'tick'. Perhaps next someone wants to set the
 Jouni> properties separately for all four borders of the axes, and
 Jouni> then we need four calls?
 Jouni> (Also, aliases for the names with dots would be nice, so
 Jouni> the key=value notation could be used in the call.)
 Jouni> The following patch allows calling rc like
 Jouni> rc(('xtick','ytick'), ...)
Thanks Jouni,
I just applied this to CVS. A minor nit. matplotlib tests for
strings with the is_string_like function which is a bit more robust
than testing for isinstance. Normally, one grabs this from
matplotlib.cbook, but since you patch is for __init__.py, I just did a
cut-and-paste job to put it there as well.
JDH
From: John H. <jdh...@ac...> - 2005年12月21日 01:24:11
>>>>> "Jiri" == Jiri Polcar <po...@ph...> writes:
 Jiri> Hallo, I have (another) simple question. How can I make
 Jiri> logaritmic histogram? If I use ( X is an array of input
 Jiri> data ):
 Jiri> from pylab import * logX = log10( X ) n, bins, patches =
 Jiri> hist( logX, 50 ) show()
 Jiri> I must take a special care for x-axis labels. Is possible to
 Jiri> use semilogx()? How?
Just set the xscale attribute for the axes to be 'log' (and make sure
you have strictly positive data, of course)
 ax = subplot(111, xscale='log')
 ax.hist(X, 100)
JDH
I upgraded to Ghostscript 8.51 (not sure why I had an old version).
And it works now.
Sorry to bug you all,
Mark
On 12/20/05, Mark Bakker <ma...@gm...> wrote:
>
> Hello -
>
> I made a simple figure with a slash in a text label:
>
> from pylab import *
> plot([1,2,3])
> xlabel(r'$a^2/b$')
>
> Then I save this figure as EPS and convert to PDF using Ghostview.
>
> What happens? In the EPS file the slash between a^2 and b looks great,
> in the PDF file the slash has disappeared.
>
> Has anybody seen this before?? Any solution?
>
> Thanks,
>
> Mark
>
>
>
From: Darren D. <dd...@co...> - 2005年12月20日 21:41:26
On Tuesday 20 December 2005 16:18, Mark Bakker wrote:
> xlabel(r'$a^2/b$')
Works fine for me, using either ps2pdf or epstopdf. I have 
gnu-ghostscript-8.16.
From: Mark B. <ma...@gm...> - 2005年12月20日 21:18:19
Hello -
I made a simple figure with a slash in a text label:
from pylab import *
plot([1,2,3])
xlabel(r'$a^2/b$')
Then I save this figure as EPS and convert to PDF using Ghostview.
What happens? In the EPS file the slash between a^2 and b looks great,
in the PDF file the slash has disappeared.
Has anybody seen this before?? Any solution?
Thanks,
Mark
From: Gerald J. M. M. <Ger...@jp...> - 2005年12月19日 21:03:39
Attachments: swhk_jmap_145.png
Hi,
The attached png (generated from GMT) (also visible here:
http://sayatnova.jpl.nasa.gov/genesis/swhk_jmap_145.png )
shows a non-linear color scale which I am trying to replicate using
matplotlib. Could anyone point me in the right direction as to the best
approach to do this? I've seen posts where I can subclass the
colormap/normalize classes and customize them. I've also seen
James Boyle's gmtColormap.py script to load GMT colormaps into
matplotlib colormaps however I would like to achieve a general
solution to this. The following code is the generalized function
I use to generate maps:
def plotMap(pngFile,figsize,aspect,plotTitle,colorbarTitle,
 mapData,dataMin,dataMax,lonMin,lonMax,latMin,latMax,
 colorbarFormat='%1.1f',colorbarOrientation='horizontal',
 nanColor='k'):
 """Plot data on world map."""
 m=Basemap(projection='cyl',llcrnrlon=lonMin,llcrnrlat=latMin,
 urcrnrlon=lonMax,urcrnrlat=latMax,suppress_ticks=False)
 m.aspect=aspect
 palette=cm.jet
 palette.set_bad(nanColor,1.0)
 fig=m.createfigure(figsize=figsize)
 im=m.imshow(mapData,cmap=palette,norm=colors.normalize(vmin=dataMin,
 vmax=dataMax,clip =False))
 cax=fig.colorbar(im,tickfmt=colorbarFormat,
 orientation=colorbarOrientation)
 cax.set_xlabel(colorbarTitle)
 m.fillcontinents()
 m.drawmapboundary()
 gca().set_title(plotTitle)
 fig.savefig(pngFile)
 close(fig)
Any help is greatly appreciated.
Thanks,
Gerald
From: Ben J. <ben...@im...> - 2005年12月19日 16:17:37
Hello all,
I've looked through the archives and can't find a solution to this. 
Sorry if it is already there, please point me back in that direction if so!
matplotlib appears to compile and install fine. However when I try to 
import pylab, I get an error:
Python 2.3.4 (#5, Jul 12 2005, 11:42:21)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-24)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from pylab import *
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File "/bmm/scratch/brj03/python/lib/python2.3/site-packages/pylab.py", 
line 1, in ?
 from matplotlib.pylab import *
 File 
"/bmm/scratch/brj03/python/lib/python2.3/site-packages/matplotlib/pylab.py", 
line 198, in ?
 from axes import Axes, PolarAxes
 File 
"/bmm/scratch/brj03/python/lib/python2.3/site-packages/matplotlib/axes.py", 
line 14, in ?
 from axis import XAxis, YAxis
 File 
"/bmm/scratch/brj03/python/lib/python2.3/site-packages/matplotlib/axis.py", 
line 25, in ?
 from font_manager import FontProperties
 File 
"/bmm/scratch/brj03/python/lib/python2.3/site-packages/matplotlib/font_manager.py", 
line 39, in ?
 from matplotlib import ft2font
ImportError: 
/bmm/scratch/brj03/python/lib/python2.3/site-packages/matplotlib/ft2font.so: 
undefined symbol: PyUnicodeUCS2_GetSize
I tried upgrading to the latest version of Python, and get a slightly 
different error - a different symbol can't be found:
Python 2.4.2 (#1, Dec 19 2005, 15:46:55)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from pylab import *
Traceback (most recent call last):
 File "<stdin>", line 1, in ?
 File 
"/bmm/scratch/brj03/python-latest/lib/python2.4/site-packages/pylab.py", 
line 1, in ?
 from matplotlib.pylab import *
 File 
"/bmm/scratch/brj03/python-latest/lib/python2.4/site-packages/matplotlib/pylab.py", 
line 198, in ?
 from axes import Axes, PolarAxes
 File 
"/bmm/scratch/brj03/python-latest/lib/python2.4/site-packages/matplotlib/axes.py", 
line 14, in ?
 from axis import XAxis, YAxis
 File 
"/bmm/scratch/brj03/python-latest/lib/python2.4/site-packages/matplotlib/axis.py", 
line 25, in ?
 from font_manager import FontProperties
 File 
"/bmm/scratch/brj03/python-latest/lib/python2.4/site-packages/matplotlib/font_manager.py", 
line 39, in ?
 from matplotlib import ft2font
ImportError: 
/bmm/scratch/brj03/python-latest/lib/python2.4/site-packages/matplotlib/ft2font.so: 
undefined symbol: _ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_jc
There seem to be problems with the ft2font.so library. Can anyone help?
Cheers,
Ben.
From: Henotii <he...@gm...> - 2005年12月18日 13:54:53
I have just create a LineCollection, it's work well affter adding to axes
But I can't get the right output while want to add the legend to the
lines collection,
I try the axes's get_lines() method but get a "NULL" Line2D instants
I think this is why the legend() func can't work,
But how can I make the collection of lines legend?
many thanks!
I write the code like this:
ax =3D axes()
line_collection =3D LineCollection(...)
ax.add_collection(line_collection)
legend(some_label) # can't work
show()
On 12/18/05, Henotii <he...@gm...> wrote:
> i have call the set_label() method of LineCollection
> but still can't get the legend
>
> some one knows how to plot legend while using LineCollection?
>
From: Henotii <he...@gm...> - 2005年12月18日 11:44:08
i have call the set_label() method of LineCollection
but still can't get the legend
some one knows how to plot legend while using LineCollection?
From: James B. <bo...@ll...> - 2005年12月16日 18:02:14
Ken - Thanks very much or the quick reply - but the problem is more 
fundamental:
I probably obscured the issue by including the traceback.
The label rotation fails because there are no labels - the index is out 
of range - but circumventing this error still results in a plot with no 
x tick labels.
At the bottom of my original message, I indicated that commenting out 
the rotation enables the code to run to completion but no date labels 
are generated.
--Jim
On Dec 16, 2005, at 9:14 AM, Ken McIvor wrote:
> On 12/16/05 10:56, James Boyle wrote:
>> I get the following traceback:
>> Traceback (most recent call last):
>> File "_tmp_date_demo2.py", line 46, in ?
>> setp(labels, rotation=45)
>> File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
>> python2.3/site-packages/matplotlib/pylab.py", line 1533, in setp
>> ret = _setp(*args, **kwargs)
>> File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
>> python2.3/site-packages/matplotlib/artist.py", line 468, in setp
>> insp = ArtistInspector(h)
>> File 
>> "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
>> python2.3/site-packages/matplotlib/artist.py", line 260, in __init__
>> if iterable(o): o = o[0]
>> IndexError: list index out of range
>
> I think you've ran into the same problem Vinj Vinj had a little while 
> ago:
>
> 	http://sourceforge.net/mailarchive/message.php?msg_id=14103209
>
> John Hunter recommended the following solution:
>
> 	http://sourceforge.net/mailarchive/message.php?msg_id=14107408
>
> I'm not sure if you'll need to watch out for this, but Alan Isaac 
> cautioned that this fix may not work correctly under Python 2.4:
>
> 	http://sourceforge.net/mailarchive/message.php?msg_id=14108794
>
> I hope this helps!
>
> Ken
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log 
> files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Chris F. <fon...@gm...> - 2005年12月16日 17:44:39
I notice that when generating several plots, they are cascaded upon
one another, one slightly to the right and below of the previous one.
However, when the plots get near the bottom of the screen, they keep
cascading even when only the top of the plot can be seen. Should the
cascading not reset when the *bottom* of a frame touches the bottom of
the screen, and not the top?
Also, when the previous plot disappears prior to the current plot, is
there any need to cascade them at all? Currently, the plots cascade
even when prior plots have disappeared.
Thanks,
--
Chris Fonnesbeck
Atlanta, GA
From: Ken M. <mc...@ii...> - 2005年12月16日 17:14:22
On 12/16/05 10:56, James Boyle wrote:
> 
> I get the following traceback:
> 
> Traceback (most recent call last):
> File "_tmp_date_demo2.py", line 46, in ?
> setp(labels, rotation=45)
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/matplotlib/pylab.py", line 1533, in setp
> ret = _setp(*args, **kwargs)
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/matplotlib/artist.py", line 468, in setp
> insp = ArtistInspector(h)
> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ 
> python2.3/site-packages/matplotlib/artist.py", line 260, in __init__
> if iterable(o): o = o[0]
> IndexError: list index out of range
I think you've ran into the same problem Vinj Vinj had a little while ago:
	http://sourceforge.net/mailarchive/message.php?msg_id=14103209
John Hunter recommended the following solution:
	http://sourceforge.net/mailarchive/message.php?msg_id=14107408
I'm not sure if you'll need to watch out for this, but Alan Isaac cautioned 
that this fix may not work correctly under Python 2.4:
	http://sourceforge.net/mailarchive/message.php?msg_id=14108794
I hope this helps!
Ken

Showing results of 203

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