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
(3) |
|
3
(5) |
4
(7) |
5
(18) |
6
(4) |
7
(15) |
8
(7) |
9
(10) |
|
10
(4) |
11
(18) |
12
(15) |
13
(11) |
14
(11) |
15
(4) |
16
(28) |
|
17
(17) |
18
(22) |
19
(12) |
20
(19) |
21
(17) |
22
(14) |
23
(4) |
|
24
(3) |
25
(6) |
26
(8) |
27
(13) |
28
(11) |
29
(21) |
30
(3) |
|
31
(5) |
|
|
|
|
|
|
|
From: Charlie M. <cw...@gm...> - 2006-12-13 15:16:01
|
I don't think this has anything to do with eggs. It looks like you don't have a C++ compiler installed or configured correctly. On ubuntu/debian you should make sure "build-essentials" is installed. On 12/13/06, ch...@se... <ch...@se...> wrote: > Yes we all know the normal install of Matplotlib is rock solid and reliable. > > I'm having trouble doing an "egg" (setuptools) install of matplotlib. > > (I'm hoping eggs will be a nice way to have uniform install instructions across > all OSes.) > > I got numpy egg installed but got this when I tried matplotlib egg install.... > > gcc: installation problem, cannot exec `cc1plus': No such file or directory > gcc: installation problem, cannot exec `cc1plus': No such file or directory > error: Setup script exited with error: Command "gcc -pthread > -fno-strict-aliasin g -DNDEBUG -g > -O3 -Wall -Wstrict-prototypes -fPIC -Iagg23/include -Isrc -Iswig - > I/usr/include/python2.4 -c agg23/src/agg_trans_affine.cpp -o > build/temp.linux-i6 > 86-2.4/agg23/src/agg_trans_affine.o" failed with exit status 1 > Exception exceptions.OSError: (2, 'No such file or directory', > 'src/_ns_cntr.c') in <bound > method CleanUpFile.__del__ of <setupext.CleanUpFile instance at 0xb78 > d59ac>> ignored > Exception exceptions.OSError: (2, 'No such file or directory', > 'src/_ns_backend_ agg.cpp') in > <bound method CleanUpFile.__del__ of <setupext.CleanUpFile instance > at 0xb78d53cc>> ignored > Exception exceptions.OSError: (2, 'No such file or directory', > 'src/_ns_nxutils. c') in <bound > method CleanUpFile.__del__ of <setupext.CleanUpFile instance at 0x > b78d5b8c>> ignored > Exception exceptions.OSError: (2, 'No such file or directory', > 'src/_ns_image.cp p') in <bound > method CleanUpFile.__del__ of <setupext.CleanUpFile instance at 0x > b78d57ac>> ignored > Exception exceptions.OSError: (2, 'No such file or directory', > 'src/_ns_transfor ms.cpp') in > <bound method CleanUpFile.__del__ of <setupext.CleanUpFile instance > at 0xb796c12c>> ignored > > > Any help greatly appreciated. > > Chris > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: David C. <da...@ar...> - 2006-12-13 08:37:36
|
David Cournapeau wrote: > But the show case is more interesting: > > ncalls tottime percall cumtime percall filename:lineno(function) > 1 0.002 0.002 3.886 3.886 > slowmatplotlib.py:177(bench_imshow_show) > 1 0.000 0.000 3.884 3.884 > slowmatplotlib.py:163(bench_imshow) > 1 0.698 0.698 3.003 3.003 > /home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:70(show) > > 2 0.000 0.000 2.266 1.133 > /home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:275(expose_event) > > 1 0.009 0.009 2.266 2.266 > /home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py:71(_render_figure) > > 1 0.000 0.000 2.256 2.256 > /home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py:385(draw) > > 1 0.000 0.000 2.253 2.253 > /home/david/local/lib/python2.4/site-packages/matplotlib/figure.py:510(draw) > > 1 0.000 0.000 2.251 2.251 > /home/david/local/lib/python2.4/site-packages/matplotlib/axes.py:994(draw) > > 1 0.005 0.005 1.951 1.951 > /home/david/local/lib/python2.4/site-packages/matplotlib/image.py:173(draw) > > 1 0.096 0.096 1.946 1.946 > /home/david/local/lib/python2.4/site-packages/matplotlib/image.py:109(make_image) > > 1 0.002 0.002 1.850 1.850 > /home/david/local/lib/python2.4/site-packages/matplotlib/cm.py:50(to_rgba) > > 1 0.001 0.001 0.949 0.949 > /home/david/local/lib/python2.4/site-packages/matplotlib/colors.py:735(__call__) > > 1 0.097 0.097 0.899 0.899 > /home/david/local/lib/python2.4/site-packages/matplotlib/colors.py:568(__call__) > > 325 0.050 0.000 0.671 0.002 > /home/david/local/lib/python2.4/site-packages/numpy/core/ma.py:533(__init__) > > 1 0.600 0.600 0.600 0.600 > /home/david/local/lib/python2.4/site-packages/numpy/core/fromnumeric.py:282(resize) > > 1 0.000 0.000 0.596 0.596 > /home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:1894(imshow) > > 10 0.570 0.057 0.570 0.057 > /home/david/local/lib/python2.4/site-packages/numpy/oldnumeric/functions.py:117(where) > > 3 0.000 0.000 0.513 0.171 > /home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:883(gca) > > 1 0.000 0.000 0.513 0.513 > /home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:950(ishold) > > 4 0.000 0.000 0.408 0.102 > /home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:903(gcf) > > > For more details, see the .kc files which are the in the tbz2 archive, > with the script for generating profiles for kcachegrind, Here is some stuff I tried: - first, we can see that in expose_event (one is expensive, the other negligeable, from my understanding), two calls are pretty expensive: the __call__ at line 735 (for normalize functor) and one for __call__ at line 568 (for colormap functor). - for normalize functor, one line is expensive: val = ma.array(clip(val.filled(vmax), vmin, vmax), mask=mask). If I put a test on mask when mask is None (which it is in my case), then the function becomes negligeable. - for colormap functor, the 3 where calls are expensive. I am not sure to understand in which case they are useful; if I understand correctly, one tries to avoid values out of range (0, N), and force out of range values to be clipped. Isn't there an easier way than using where ? If I remove the where in the colormap functor, I have a 4x speed increase for the to_rgba function. After that, it becomes a bit more tricky to change things for someone like me who have no knowledge about matplotlib internals. Cheers, David |
|
From: David C. <da...@ar...> - 2006-12-13 07:07:22
|
John Hunter wrote:
> This is where you can help us. Saying specgram is slow is only
> marginally more useful than saying matplotlib is slow or python is
> slow. What is helpful is to post a complete, free-standing script
> that we can run, with some attached performance numbers. For
> starters, just run it with the Agg backend so we can isolate
> matplotlib from the respective GUIs. Show us how the performance
> scales with the specgram parameters (frames and samples). specgram is
> divided into two parts (if you look at the Axes.specgram you will see
> that it calls matplotlib.mlab.specgram to do the computation and
> Axes.imshow to visualize it. Which part is slow: the mlab.specgram
> computation or the visualizion (imshow) part or both? You can paste
> this function into your own python file and start timing different
> parts. The most helpful "this is slow" posts come with profiler
> output so we can see where the bottlenecks are.
(sorry for double posting)
Ok, here we go: I believe that the rendering of the figure returned by
imshow to be slow.
For example, let's say I have a 2 minutes signal @ 8kHz sampling-rate,
with windows of 256 samples with 50 % overlap. I have around 64 frames /
seconds, eg ~ 8000 frames of 256 windows.
So for benchmark purposes, we can just send random data of shape
8000x256 to imshow. In ipython, this takes a long time (around 2 seconds
for imshow(data), where data = random(8000, 256)).
Now, on a small script to have a better idea:
import numpy as N
import pylab as P
def generate_data_2d(fr, nwin, hop, len):
nframes = 1.0 * fr / hop * len
return N.random.randn(nframes, nwin)
def bench_imshow(fr, nwin, hop, len, show = True):
data = generate_data_2d(fr, nwin, hop,
len)
P.imshow(data)
if show:
P.show()
if __name__ == '__main__':
# 2 minutes (120 sec) of sounds @ 8 kHz with 256 samples with 50 %
overlap
bench_imshow(8000, 256, 128, 120, show = False)
Now, I have a problem, because I don't know how to benchmark when using
show to True (I have to manually close the figure).
If I run the above script with time, I got 1.5 seconds with show = False
(after several trials to be sure matplotlib files are in the system
cache: this matters because my home dir is on NFS). If I set show =
True, and close the figure by hand once the figure is plotted, I have
4.5 sec instead.
If I run the above script with -dAgg --versbose-helpful (I was looking
for this one to check numerix is correctly set to numpy:) ):
with show = False:
matplotlib data path
/home/david/local/lib/python2.4/site-packages/matplotlib/mpl-data
$HOME=/home/david
CONFIGDIR=/home/david/.matplotlib
loaded rc file /home/david/.matplotlib/matplotlibrc
matplotlib version 0.87.7
verbose.level helpful
interactive is False
platform is linux2
numerix numpy 1.0.2.dev3484
font search path
['/home/david/local/lib/python2.4/site-packages/matplotlib/mpl-data']
loaded ttfcache file /home/david/.matplotlib/ttffont.cache
backend Agg version v2.2
real 0m1.185s
user 0m0.808s
sys 0m0.224s
with show = True
matplotlib data path
/home/david/local/lib/python2.4/site-packages/matplotlib/mpl-data
$HOME=/home/david
CONFIGDIR=/home/david/.matplotlib
loaded rc file /home/david/.matplotlib/matplotlibrc
matplotlib version 0.87.7
verbose.level helpful
interactive is False
platform is linux2
numerix numpy 1.0.2.dev3484
font search path
['/home/david/local/lib/python2.4/site-packages/matplotlib/mpl-data']
loaded ttfcache file /home/david/.matplotlib/ttffont.cache
backend Agg version v2.2
real 0m1.193s
user 0m0.848s
sys 0m0.192s
So the problem is in the rendering, right ? (Not sure to understand
exactly what Agg backend is doing).
Now, using hotshot (kcache grind profiles attached to the email), for
the noshow case:
1 0.001 0.001 0.839 0.839
slowmatplotlib.py:181(bench_imshow_noshow)
1 0.000 0.000 0.837 0.837
slowmatplotlib.py:163(bench_imshow)
1 0.000 0.000 0.586 0.586
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:1894(imshow)
3 0.000 0.000 0.510 0.170
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:883(gca)
1 0.000 0.000 0.509 0.509
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:950(ishold)
4 0.000 0.000 0.409 0.102
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:903(gcf)
1 0.000 0.000 0.409 0.409
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:818(figure)
1 0.000 0.000 0.408 0.408
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py:36(new_figure_manager)
1 0.003 0.003 0.400 0.400
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:401(__init__)
1 0.000 0.000 0.397 0.397
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py:25(_get_toolbar)
1 0.001 0.001 0.397 0.397
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:496(__init__)
1 0.000 0.000 0.396 0.396
/home/david/local/lib/python2.4/site-packages/matplotlib/backend_bases.py:1112(__init__)
1 0.000 0.000 0.396 0.396
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:557(_init_toolbar)
1 0.008 0.008 0.396 0.396
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:595(_init_toolbar2_4)
1 0.388 0.388 0.388 0.388
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:967(__init__)
1 0.251 0.251 0.251 0.251
slowmatplotlib.py:155(generate_data_2d)
3 0.000 0.000 0.101 0.034
/home/david/local/lib/python2.4/site-packages/matplotlib/figure.py:629(gca)
1 0.000 0.000 0.101 0.101
/home/david/local/lib/python2.4/site-packages/matplotlib/figure.py:449(add_subplot)
1 0.000 0.000 0.100 0.100
/home/david/local/lib/python2.4/site-packages/matplotlib/axes.py:4523(__init__)
1 0.000 0.000 0.100 0.100
/home/david/local/lib/python2.4/site-packages/matplotlib/axes.py:337(__init__)
But the show case is more interesting:
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.002 0.002 3.886 3.886
slowmatplotlib.py:177(bench_imshow_show)
1 0.000 0.000 3.884 3.884
slowmatplotlib.py:163(bench_imshow)
1 0.698 0.698 3.003 3.003
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:70(show)
2 0.000 0.000 2.266 1.133
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py:275(expose_event)
1 0.009 0.009 2.266 2.266
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py:71(_render_figure)
1 0.000 0.000 2.256 2.256
/home/david/local/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py:385(draw)
1 0.000 0.000 2.253 2.253
/home/david/local/lib/python2.4/site-packages/matplotlib/figure.py:510(draw)
1 0.000 0.000 2.251 2.251
/home/david/local/lib/python2.4/site-packages/matplotlib/axes.py:994(draw)
1 0.005 0.005 1.951 1.951
/home/david/local/lib/python2.4/site-packages/matplotlib/image.py:173(draw)
1 0.096 0.096 1.946 1.946
/home/david/local/lib/python2.4/site-packages/matplotlib/image.py:109(make_image)
1 0.002 0.002 1.850 1.850
/home/david/local/lib/python2.4/site-packages/matplotlib/cm.py:50(to_rgba)
1 0.001 0.001 0.949 0.949
/home/david/local/lib/python2.4/site-packages/matplotlib/colors.py:735(__call__)
1 0.097 0.097 0.899 0.899
/home/david/local/lib/python2.4/site-packages/matplotlib/colors.py:568(__call__)
325 0.050 0.000 0.671 0.002
/home/david/local/lib/python2.4/site-packages/numpy/core/ma.py:533(__init__)
1 0.600 0.600 0.600 0.600
/home/david/local/lib/python2.4/site-packages/numpy/core/fromnumeric.py:282(resize)
1 0.000 0.000 0.596 0.596
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:1894(imshow)
10 0.570 0.057 0.570 0.057
/home/david/local/lib/python2.4/site-packages/numpy/oldnumeric/functions.py:117(where)
3 0.000 0.000 0.513 0.171
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:883(gca)
1 0.000 0.000 0.513 0.513
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:950(ishold)
4 0.000 0.000 0.408 0.102
/home/david/local/lib/python2.4/site-packages/matplotlib/pylab.py:903(gcf)
For more details, see the .kc files which are the in the tbz2 archive,
with the script for generating profiles for kcachegrind,
I will post an other email for the other problem (with several subplots)
cheers,
David
|
|
From: <ch...@se...> - 2006-12-13 07:02:28
|
Yes we all know the normal install of Matplotlib is rock solid and reliable. I'm having trouble doing an "egg" (setuptools) install of matplotlib. (I'm hoping eggs will be a nice way to have uniform install instructions across all OSes.) I got numpy egg installed but got this when I tried matplotlib egg install.... gcc: installation problem, cannot exec `cc1plus': No such file or directory gcc: installation problem, cannot exec `cc1plus': No such file or directory error: Setup script exited with error: Command "gcc -pthread -fno-strict-aliasin g -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -Iagg23/include -Isrc -Iswig - I/usr/include/python2.4 -c agg23/src/agg_trans_affine.cpp -o build/temp.linux-i6 86-2.4/agg23/src/agg_trans_affine.o" failed with exit status 1 Exception exceptions.OSError: (2, 'No such file or directory', 'src/_ns_cntr.c') in <bound method CleanUpFile.__del__ of <setupext.CleanUpFile instance at 0xb78 d59ac>> ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/_ns_backend_ agg.cpp') in <bound method CleanUpFile.__del__ of <setupext.CleanUpFile instance at 0xb78d53cc>> ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/_ns_nxutils. c') in <bound method CleanUpFile.__del__ of <setupext.CleanUpFile instance at 0x b78d5b8c>> ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/_ns_image.cp p') in <bound method CleanUpFile.__del__ of <setupext.CleanUpFile instance at 0x b78d57ac>> ignored Exception exceptions.OSError: (2, 'No such file or directory', 'src/_ns_transfor ms.cpp') in <bound method CleanUpFile.__del__ of <setupext.CleanUpFile instance at 0xb796c12c>> ignored Any help greatly appreciated. Chris |
|
From: Jeff W. <js...@fa...> - 2006-12-12 23:08:37
|
Orion Poplawski wrote:
> Jeff Whitaker wrote:
>> Orion Poplawski wrote:
>>> I've got a 2-D array of values that I'd like to plot onto a map with
>>> Basemap. The latitude and longitudes for each point are stored in
>>> their own 2-D array that matches that of the values. Can some one
>>> help with how to do this? Looks like basemap requires a square and
>>> uniform set of data to plot?
>>>
>> Orion: There's an example of this in the examples directory called
>> 'ccsm_popgrid.py'. Have a look at that, and if you have questions
>> let us know.
>>
>
>
> Actually, it looks like I may have been making things harder than I
> thought they would be. Is there any reason to believe that this isn't
> doing what it seems like it should? ccsm_popgrid.py seems much more
> complicated, and I'm don't really understand it yet.
>
> tpxyzo has data for 12 different altitudes, and I'm selecting one. It
> appears the x,y=m(lon,lat) is unneeded for cylindrical projections,
> but I've left it in here as a general case.
>
> --
> from matplotlib.toolkits.basemap import Basemap
> from pylab import *
>
> lat=load('lat.dat').reshape(270,90)
> lon=load('lon.dat').reshape(270,90)
> tpxyzo=load('tpxyzo.dat').reshape(12,270,90)
>
> m=Basemap(llcrnrlon=-80,llcrnrlat=-75,urcrnrlon=-40,urcrnrlat=-42,projection='cyl',resolution='l')
>
> m.drawcoastlines()
> x, y = m(lon,lat)
> m.contourf(x,y,tpxyzo[11,:,:],15)
> show()
> --
>
> The output is the attached image, which as you can see does not have a
> rectangular shape.
>
> Thanks!
>
Orion: If the image were rectangular on a cylindrical projection, then
you wouldn't need 2d arrays to describe the lats and lons of the grid.
Are you sure the image should be rectangular? What kind of a grid is it?
-Jeff
--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
|
|
From: Jeff W. <js...@fa...> - 2006-12-12 19:00:47
|
Orion Poplawski wrote: > I've got a 2-D array of values that I'd like to plot onto a map with > Basemap. The latitude and longitudes for each point are stored in their > own 2-D array that matches that of the values. Can some one help with > how to do this? Looks like basemap requires a square and uniform set of > data to plot? > > Thanks! > > Orion: There's an example of this in the examples directory called 'ccsm_popgrid.py'. Have a look at that, and if you have questions let us know. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: Orion P. <or...@co...> - 2006-12-12 18:30:10
|
I've got a 2-D array of values that I'd like to plot onto a map with Basemap. The latitude and longitudes for each point are stored in their own 2-D array that matches that of the values. Can some one help with how to do this? Looks like basemap requires a square and uniform set of data to plot? Thanks! -- Orion Poplawski Technical Manager 303-415-9701 x222 NWRA/CoRA Division FAX: 303-415-9702 3380 Mitchell Lane or...@co... Boulder, CO 80301 http://www.cora.nwra.com |
|
From: Eric F. <ef...@ha...> - 2006-12-12 17:57:55
|
Pierre, I will try to improve it. Eric Pierre GM wrote: > Folks, > Would it be possible to switch the current error message > > >>>>ValueError: Arguments x, y, z, mask (if present) must be 2D arrays. > > > in cntr.c to something more explicit, when x, y, and z are 2D arrays, but one > of them is complex ? Or force a downcast to float if needed ? > (I know, I should have forced a conversion myself. But I just spent one hour > trying to figure what was going wrong before thinking about checking the > dtypes...) > > Thx in advance > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Eric F. <ef...@ha...> - 2006-12-12 17:55:29
|
This slightly modified excerpt from the new version of spy may do what
you want:
nr, nc = Z.shape
extent = [-0.5, nc-0.5, nr-0.5, -0.5]
return self.imshow(Z, interpolation='nearest',
extent=extent, origin='upper')
Eric
John Travers wrote:
> Hi, I'm struggling to get an array plotted the way I want with imshow.
> I have an array A which i try to plot with
>
> e=(tdims[0], tdims[-1], wldims[-1], wldims[0])
> imshow(A,extent=e)
>
> The image displays fine in the x axis, with tdims marked correctly,
> but in the yaxis the dimensions are incorrect. And no combination of
> extent and origin gives the correect display. To be more clear,
> without extent set I get the array displayed the right way round, but
> my problem is that my y axis should be *decreasing* as it goes up the
> side of the image; if I set extent correctly, the image is scaled
> right with respect to the y axis, but it is flipped so that the y axis
> is increasing upwards. Is there a way to prevent this?
>
> Many thanks for any help!
> Ans thanks for an excellent plotting library!
>
> Best regards
> John
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Fernando P. <fpe...@gm...> - 2006-12-12 17:26:10
|
On 12/12/06, John Hunter <jdh...@ac...> wrote: > --verbose-helpful will confirm the setting). A good way to start is > to write a demonstration script that you find too slow which makes a > call to savefig, and run it with > > > time myscript.py --verbose-helpful -dAgg It may be worth mentioning here this little utility (Linux only, unfortunately): http://amath.colorado.edu/faculty/fperez/python/profiling/ For profiling more complex codes, it's really a godsend. And note that the generated cachegrind files are typically small and can be sent to others for analysis, so you can run it locally (if for example the run depends on data you can't share) and then send to the list the generated profile. Anyone with Kcachegrind will then be able to load your profile info and study it in detail. Cheers, f |
|
From: John H. <jdh...@ac...> - 2006-12-12 17:05:12
|
>>>>> "David" == David Cournapeau <da...@ar...> writes:
David> Hi, I am a regular user of matplotlib since I moved from
David> matlab to python/numpy/scipy. Even if I find matplotlib to
David> be a real help during the transition from matlab to python,
David> I must confess I found it the most disappointing compare
David> other packages ( essentially numpy/scipy/ipython). This is
Meatloaf: Now don't be sad, cause two out of three ain't bad
If you consider the fact that matplotlib was originally an ipython
patch that was rejected, you can see why we are such a bastard child
of the scientific python world. There is a seed of truth in this;
Numeric, scipy and ipython were all mature packages in widespread use
before the first line of matplotlib code was written. So they are
farther along in terms of maturity, documentation, usability,
etc... than matplotlib is.
But we've achieved a lot in a comparably short time. When I started
working on matplotlib there were probably two dozen plotting packages
that people used and recommended. Now we are down to 5 or 6, with
matplotlib doing most of what most people need. I've focused on
making something that does most of what people (and I) need rather
than doing it the fastest, so it is too slow for some purposes but
fast enough for most. When we get a well defined important test case
that is too slow, we typically try and optimize it, sometimes with
dramatic results (eg 25 fold speedups); more on this below.
A consequence of trying to support most of the needs of most users is
this: we run on all major operating systems and all major GUIs with
all major array packages. Consider the combinatorial problem: 5
graphical user interfaces with two or more versions in the wild across
3 operating systems and you will get a feel for what the support
problem we have. This is not an academic point. Most of the GUI
maintainers for *a single backend* burn out in short order. Most
graphics packages *solve* this problem by supporting a single output
format (PYX) or GUI (chaco) which is a damned fine and admirable
solution. But the consequence of this is plotting fragmentation:
people who need GTK cannot use Chaco, people who need SVG cannot use
PYX, and so on, and so they'll write their own plotting library for
their own GUI or output format (the situation before matplotlib). You
can certainly get closer to bare metal speed by reducing choices and
focusing on a single target -- part of the performance price we pay is
in our abstraction layers, part is in trying to support features that
may be rarely used but cost something (masked array support, rotated
text with newlines), part is because we need to get to work and
optimize the slow parts.
David> not a rant; I want to know if this slowness is coming from
David> my lack of matplotlib knowledge or not; I apologize in
David> advance if the following hurts anyone feelings :)
Meatloaf: But -- there ain't no way I'm ever gonna love you
OK, I'll stop now.
David> First, I must admit that whereas I took a significant
David> amount of time to study numpy and scipy, I didn't take that
David> same time for matplotlib. So this disappointment may just
David> be a consequences of this laziness.
I suspect this is partly true; see below.
David> My main problem with matplotlib is speed: I find it
David> really annoying to use in an interactive manner. For
David> example, when I need to display some 2d information, such
David> as spectrogramm or correlogram, this take 1 or 2 seconds
David> for a small signal (~4500 frames of 256 samples). My
David> function correlogram (similar to specgram, but compute
David> correlation instead of log spectrum) uses imshow, and this
David> function takes 20 times more time than imagesc of matlab
David> for the same size. Also, I found changing the size of the
This is where you can help us. Saying specgram is slow is only
marginally more useful than saying matplotlib is slow or python is
slow. What is helpful is to post a complete, free-standing script
that we can run, with some attached performance numbers. For
starters, just run it with the Agg backend so we can isolate
matplotlib from the respective GUIs. Show us how the performance
scales with the specgram parameters (frames and samples). specgram is
divided into two parts (if you look at the Axes.specgram you will see
that it calls matplotlib.mlab.specgram to do the computation and
Axes.imshow to visualize it. Which part is slow: the mlab.specgram
computation or the visualizion (imshow) part or both? You can paste
this function into your own python file and start timing different
parts. The most helpful "this is slow" posts come with profiler
output so we can see where the bottlenecks are.
Such a post by Fernando Perez on "plot" with markers yielded
performance boosts of 25x for large numbers of points when he showed
we were making about one hundred thousand function calls per plot.
David> matplotlib window really 'annoying to the eye': I compared
David> to matlab, and this may be due to the fact that the whole
David> window is redrawn with matplotlib, including the toolbar,
David> whereas in matlab, the top toolbar is not redrawn.
It would be nice if we exposed the underlying GTK widgets to you so
you could customize the "expand" and "fill" properties of the gtk
toolbar, but this gets us into the multiple GUI, multiple version
problem discussed above. Providing an abstract interface to such
details that works across the mpl backends is a lot of work that takes
us away from our core incompetency -- plotting. What we do is enable
you to write your own widgets and embed mpl in them; see
examples/embedding_in_gtk2.py which shows you how to do this for
GTK/GTKAgg. You can then customize the toolbar to your heart's
content.
David> Finally, plotting many data (using plot(X, Y) with X and Y
David> around 1000/10000 samples) is 'slow' (the '' are because I
David> don't know much about computer graphics, and I understand
David> that slow in the rendering is often just a perception)
This shouldn't be slow -- again a test script with some performance
numbers would help so we can compare what we are getting. One
thought: make sure you are using the numerix layer properly -- ie, if
you are creating arrays with numpy make sure you have numerix set to
numpy ( i see below that you set numerix to numpy but
--verbose-helpful will confirm the setting). A good way to start is
to write a demonstration script that you find too slow which makes a
call to savefig, and run it with
> time myscript.py --verbose-helpful -dAgg
and post the output and script. Then we might be able to help.
David> So, is this a current limitation of matplotlib, is
David> matplotlib optimized for good rendering for publication,
David> and not for interactive use, or I am just misguided in my
David> use of matplotlib ?
Many people use it interactively, but a number of power users find it
slow.
JDH
|
|
From: John T. <jt...@gm...> - 2006-12-12 17:00:17
|
On 12/12/06, Pierre GM <pgm...@gm...> wrote: > On Tuesday 12 December 2006 06:57, John Travers wrote: > > Hi, I'm struggling to get an array plotted the way I want with imshow. > > I have an array A which i try to plot with > > > > e=(tdims[0], tdims[-1], wldims[-1], wldims[0]) > > imshow(A,extent=e) > > > > if I set extent correctly, the image is scaled > > right with respect to the y axis, but it is flipped so that the y axis > > is increasing upwards. Is there a way to prevent this? > > MMh. You can always play with the limits on the y axis: > > gca().set_ylim(N.asarray(gca().get_ylim())[[-1,0]]) > > will invert (ymin, ymax) on the current axis (gca()) > Thanks for your answers! Pierre's method worked (I didn't try Scott's). Cheers, John |
|
From: Pierre GM <pgm...@gm...> - 2006-12-12 16:25:20
|
On Tuesday 12 December 2006 06:57, John Travers wrote: > Hi, I'm struggling to get an array plotted the way I want with imshow. > I have an array A which i try to plot with > > e=(tdims[0], tdims[-1], wldims[-1], wldims[0]) > imshow(A,extent=e) > > if I set extent correctly, the image is scaled > right with respect to the y axis, but it is flipped so that the y axis > is increasing upwards. Is there a way to prevent this? MMh. You can always play with the limits on the y axis: gca().set_ylim(N.asarray(gca().get_ylim())[[-1,0]]) will invert (ymin, ymax) on the current axis (gca()) |
|
From: David C. <da...@ar...> - 2006-12-12 12:41:13
|
Hi,
I am a regular user of matplotlib since I moved from matlab to
python/numpy/scipy. Even if I find matplotlib to be a real help during
the transition from matlab to python, I must confess I found it the most
disappointing compare other packages ( essentially numpy/scipy/ipython).
This is not a rant; I want to know if this slowness is coming from my
lack of matplotlib knowledge or not; I apologize in advance if the
following hurts anyone feelings :)
First, I must admit that whereas I took a significant amount of time
to study numpy and scipy, I didn't take that same time for matplotlib.
So this disappointment may just be a consequences of this laziness.
My main problem with matplotlib is speed: I find it really annoying
to use in an interactive manner. For example, when I need to display
some 2d information, such as spectrogramm or correlogram, this take 1 or
2 seconds for a small signal (~4500 frames of 256 samples). My function
correlogram (similar to specgram, but compute correlation instead of log
spectrum) uses imshow, and this function takes 20 times more time than
imagesc of matlab for the same size.
Also, I found changing the size of the matplotlib window really
'annoying to the eye': I compared to matlab, and this may be due to the
fact that the whole window is redrawn with matplotlib, including the
toolbar, whereas in matlab, the top toolbar is not redrawn.
Finally, plotting many data (using plot(X, Y) with X and Y around
1000/10000 samples) is 'slow' (the '' are because I don't know much
about computer graphics, and I understand that slow in the rendering is
often just a perception)
So, is this a current limitation of matplotlib, is matplotlib
optimized for good rendering for publication, and not for interactive
use, or I am just misguided in my use of matplotlib ?
Config info:
- ubuntu edgy on a bi xeon 3.2 Ghz with 2 Gb of Ram
- numpy SVN (post 1.0)
- matplotlib 0.87.7
- matplotlibrc: uses numpy for numeric, Gtk as a backend (or GtkAdd
for anti aliasing, but this makes the problem worse).
Cheers,
David
|
|
From: John T. <jt...@gm...> - 2006-12-12 11:57:18
|
Hi, I'm struggling to get an array plotted the way I want with imshow. I have an array A which i try to plot with e=(tdims[0], tdims[-1], wldims[-1], wldims[0]) imshow(A,extent=e) The image displays fine in the x axis, with tdims marked correctly, but in the yaxis the dimensions are incorrect. And no combination of extent and origin gives the correect display. To be more clear, without extent set I get the array displayed the right way round, but my problem is that my y axis should be *decreasing* as it goes up the side of the image; if I set extent correctly, the image is scaled right with respect to the y axis, but it is flipped so that the y axis is increasing upwards. Is there a way to prevent this? Many thanks for any help! Ans thanks for an excellent plotting library! Best regards John |
|
From: Robert C. <cim...@nt...> - 2006-12-12 09:29:12
|
Eric Firing wrote: > Robert Cimrman wrote: > [...] >> What could be done, though, is to raise an exception explaining that >> sparse matrices and the image mode don't like each other; as it is, >> the function spy3 just dies on asarray (should be st. like asarray( >> Z.todense() )) > > (I think it would be Z.toarray().) Yes. > Good point. Alternatives would be to automatically switch it to plot > mode, with a warning, or to automatically convert it. Probably the > former is the better of these two, and maybe your originally suggested > exception is best of all. What do you think? I am slightly more for raising the exception: IMHO, people really needing and using sparse matrices convert never to dense ones (they would not fit into memory in most cases); people happy with automatic conversion should use dense matrices from the very beginning - there is no gain in exploiting sparsity for them; people knowing what they are doing can convert explicitly prior to calling spy(). So: +1 raise an exception +0 switch to plot mode (ok, but inconsistent - why I got a plot when I wanted an image?) -10 automatic conversion r. |
|
From:
<dur...@ma...> - 2006-12-12 08:49:36
|
(sorry for my English)
The following code in Python causes leakage of memory:
################################################################
from pylab import *
import pygtk
pygtk.require('2.0')
import gtk
import matplotlib
matplotlib.use('GTKAgg') # or 'GTK'
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.figure import Figure
for i in range(200):
fig = Figure(figsize=(1,1))
canvas = FigureCanvas(fig)
axes = fig.add_subplot(111)
axes.grid(True)
ind = arange(200)
xx = rand(len(ind))
line= axes.plot(ind, xx)
canvas.show_all()
line[0].set_data(ind, xx)
canvas.draw()
line = None
axes.clear()
fig.delaxes(axes)
fig.clear()
fig = None
axes = None
canvas.destroy()
canvas = None
#####################################################
And next lines too (but smaller):
######################################################
fig = Figure(figsize=(1,1))
canvas = FigureCanvas(fig)
axes = fig.add_subplot(111)
axes.grid(True)
ind = arange(200)
xx = rand(len(ind))
line= axes.plot(ind, xx)
canvas.show_all()
for i in range(200):
canvas.draw()
#######################################################
How can I correct it?
Yours faithfully,
Andrey
|
|
From: Pierre GM <pgm...@gm...> - 2006-12-12 08:41:45
|
Folks, Would it be possible to switch the current error message >>> ValueError: Arguments x, y, z, mask (if present) must be 2D arrays. in cntr.c to something more explicit, when x, y, and z are 2D arrays, but one of them is complex ? Or force a downcast to float if needed ? (I know, I should have forced a conversion myself. But I just spent one hour trying to figure what was going wrong before thinking about checking the dtypes...) Thx in advance |
|
From: Russell E. O. <ro...@ce...> - 2006-12-11 19:57:49
|
In article <E87...@cs...>, belinda thom <bt...@cs...> wrote: > Hi again, > > At http://matplotlib.sourceforge.net/installing.html under topic OS X: > > "All of the backends run on OS X. Chris Barker has built a binary > package (fink users see below) for matplotlib which is hosted on > pythonmac, and works with Agg, Wx and Tk; see the step-by-step > instructions kindly provided by Michael Tobis." > > note that the step-by-step link leads to: > > Under revision. Please come back soon. That is indeed outdated (Charlie Moad has done most of the recent binary builds, though I got in first on a few). One source of "how to build" is: Building Matplotlib for MacOS <http://www.astro.washington.edu/rowen/BuildingMatplotlibForMac.html> -- Russell |
|
From: Eric F. <ef...@ha...> - 2006-12-11 18:30:48
|
Robert Cimrman wrote: [...] > What could be done, though, is to raise an exception explaining that > sparse matrices and the image mode don't like each other; as it is, the > function spy3 just dies on asarray (should be st. like asarray( > Z.todense() )) (I think it would be Z.toarray().) Good point. Alternatives would be to automatically switch it to plot mode, with a warning, or to automatically convert it. Probably the former is the better of these two, and maybe your originally suggested exception is best of all. What do you think? Eric |
|
From: Eric F. <ef...@ha...> - 2006-12-11 18:05:04
|
Yannick Copin wrote: > Hi, > > Eric Firing wrote: >>> from pylab import * >>> X, Y = meshgrid(linspace(-3,3,11),linspace(-3,3,11)) >>> Z = randn(*X.shape) >>> lev = linspace(Z.min(),Z.max(),11)[1:-1] >>> contourf(X,Y,Z, lev, extend='both') >>> contour(X,Y,Z, lev, colors='k') >>> show() >> >> Now, you may be wondering why we can't simply use the boundary of the >> filled regions for the lines as well, to guarantee they are the same. >> The reason is that filled contour boundaries include cuts connecting >> inner and outer contours, and also inner boundaries (edges of masked >> regions--except when affected by a bug) and the outer boundaries of >> the domain). It might be possible to simply exclude those line >> segments from the line contours, but it is not clear to me that the >> effort would be well-spent. > > OK, thanks for the explanations. I was using this dual approach > contourf+contour to emphasize the contours from contourf. So is there a > direct way to set the linewidth and linecolor (and linestyle?) of > contours from contourf? (I suspect not, according to contourf > documentation: > > contourf differs from the Matlab (TM) version in that it does not > draw the polygon edges, because the contouring engine yields > simply connected regions with branch cuts. To draw the edges, > add line contours with calls to contour. > > ) > You could turn on coloring of the edges, but I don't think you would like the result because the edges would include the boundary lines and the cut lines. The ContourSet object returned by contour and contourf has a .collections attribute. For contourf it is a list of PolyCollections, and you can set their attributes. >> I think that the differences illustrated in your example will occur >> almost entirely in pathologically ambiguous cases, but it is also > > Not necessarily pathological cases, just noisy data :-/ (I agree my > randn-based example was a bit extreme!) You might be able to avoid the problem most of the time by using some gridding routine, preferably something that uses a bit of curvature, to double the number of points in each dimension. I haven't tried it, but I suspect that this would turn even a very noisy field into something that would be contoured the same by contour and contourf. > > Cheers. |
|
From: Nicolas C. <nic...@ob...> - 2006-12-11 16:01:25
|
Steve Schmerler a =E9crit :
> Darren Dale wrote:
> =20
>> On Monday 11 December 2006 09:59, Nicolas Champavert wrote:
>> =20
>>> Steve Schmerler a =E9crit :
>>> =20
>>>> Nicolas Champavert wrote:
>>>> =20
>>>>> Hello,
>>>>>
>>>>> I have some problems when trying to save a figure with usetex=3DT=
rue.
>>>>> Sometimes, it is not possible to save the figure when trying to put=
an
>>>>> xlabel with LaTeX inside.
>>>>> It works with pylab.xlabel('M$_\odot$') but not with
>>>>> pylab.xlabel('10$^3$ M$_\odot$') (see below). Do you know why ?
>>>>> =20
>>>> Works fine here, with and w/o raw strings.
>>>> =20
>> [...]
>> =20
>>> I had matplotlib revision 2835. I made an upgrade. Now I have revisio=
n
>>> 2905. I still have problem but it is very strange:
>>> - when I plot [0,1] with xlabel(r'(10$^3$ M$_\odot$)'), it works.
>>> - when I plot [1,2] with xlabel(r'Upper mass for the IMF (10$^3$
>>> M$_\odot$)'), it works.
>>> - but it doesn't work if I plot [0,1] with xlabel(r'Upper mass for th=
e
>>> IMF (10$^3$ M$_\odot$)')...
>>> =20
>> It sounds like an issue with one of the dependencies, probably ghostsc=
ript. I=20
>> have matplotlib-0.87.7, svn revision 2905, and gpl-ghostscript-8.54. I=
can=20
>> not reproduce the problem here.
>>
>> =20
>
> I seem to be running ESP Ghostscript 8.15.3 (this is what 'gs --version=
'=20
> and 'apt-cache show gs' tell me). All the examples work fine here ...
>
> =20
I had Ghostscript 8.15.3 too. I have made an update to ghostscript 8.54=20
and now it works.
Nicolas
|
|
From: Steve S. <el...@gm...> - 2006-12-11 15:46:14
|
Darren Dale wrote:
> On Monday 11 December 2006 09:59, Nicolas Champavert wrote:
>> Steve Schmerler a écrit :
>>> Nicolas Champavert wrote:
>>>> Hello,
>>>>
>>>> I have some problems when trying to save a figure with usetex=True.
>>>> Sometimes, it is not possible to save the figure when trying to put an
>>>> xlabel with LaTeX inside.
>>>> It works with pylab.xlabel('M$_\odot$') but not with
>>>> pylab.xlabel('10$^3$ M$_\odot$') (see below). Do you know why ?
>>> Works fine here, with and w/o raw strings.
> [...]
>> I had matplotlib revision 2835. I made an upgrade. Now I have revision
>> 2905. I still have problem but it is very strange:
>> - when I plot [0,1] with xlabel(r'(10$^3$ M$_\odot$)'), it works.
>> - when I plot [1,2] with xlabel(r'Upper mass for the IMF (10$^3$
>> M$_\odot$)'), it works.
>> - but it doesn't work if I plot [0,1] with xlabel(r'Upper mass for the
>> IMF (10$^3$ M$_\odot$)')...
>
> It sounds like an issue with one of the dependencies, probably ghostscript. I
> have matplotlib-0.87.7, svn revision 2905, and gpl-ghostscript-8.54. I can
> not reproduce the problem here.
>
I seem to be running ESP Ghostscript 8.15.3 (this is what 'gs --version'
and 'apt-cache show gs' tell me). All the examples work fine here ...
--
cheers,
steve
Random number generation is the art of producing pure gibberish as
quickly as possible.
|
|
From: Darren D. <dd...@co...> - 2006-12-11 15:16:14
|
On Monday 11 December 2006 09:59, Nicolas Champavert wrote:
> Steve Schmerler a =E9crit :
> > Nicolas Champavert wrote:
> >> Hello,
> >>
> >> I have some problems when trying to save a figure with usetex=3DTrue.
> >> Sometimes, it is not possible to save the figure when trying to put an
> >> xlabel with LaTeX inside.
> >> It works with pylab.xlabel('M$_\odot$') but not with
> >> pylab.xlabel('10$^3$ M$_\odot$') (see below). Do you know why ?
> >
> > Works fine here, with and w/o raw strings.
[...]
>
> I had matplotlib revision 2835. I made an upgrade. Now I have revision
> 2905. I still have problem but it is very strange:
> - when I plot [0,1] with xlabel(r'(10$^3$ M$_\odot$)'), it works.
> - when I plot [1,2] with xlabel(r'Upper mass for the IMF (10$^3$
> M$_\odot$)'), it works.
> - but it doesn't work if I plot [0,1] with xlabel(r'Upper mass for the
> IMF (10$^3$ M$_\odot$)')...
It sounds like an issue with one of the dependencies, probably ghostscript.=
I=20
have matplotlib-0.87.7, svn revision 2905, and gpl-ghostscript-8.54. I can=
=20
not reproduce the problem here.
Darren
|
|
From: Nicolas C. <nic...@ob...> - 2006-12-11 15:09:31
|
No the '\' is not the problem. \odot is a LaTeX command. I still have=20
the problem if I don't use it (see below with only pylab.xlabel(r'Upper=20
mass for the IMF (10$^3$)')) and \\odot writes 'odot' and doesn't write=20
the 'odot' symbol.
Gary Ruben a =E9crit :
> I haven't tried it, but my guess is the '\' character is the problem.
>
> > pylab.xlabel('10$^3$ M$_\odot$')
>
> Try
> pylab.xlabel(r'10$^3$ M$_\odot$')
> ^
> Add raw string marker.
>
> or maybe
> pylab.xlabel('10$^3$ M$_\\odot$')
>
> Gary R.
>
> Nicolas Champavert wrote:
>> Hello,
>>
>> I have some problems when trying to save a figure with usetex=3DTrue=
.=20
>> Sometimes, it is not possible to save the figure when trying to put=20
>> an xlabel with LaTeX inside.
>> It works with pylab.xlabel('M$_\odot$') but not with=20
>> pylab.xlabel('10$^3$ M$_\odot$') (see below). Do you know why ?
>
In [1]:import matplotlib
In [2]:import pylab
In [3]:matplotlib.__version__
Out[3]:'0.87.7'
In [4]:matplotlib.__revision__
Out[4]:'$Revision: 2905 $'
In [5]:matplotlib.rc('text',usetex=3DTrue)
In [6]:pylab.plot([0,1])
Out[6]:[<matplotlib.lines.Line2D instance at 0xb67dde4c>]
In [7]:pylab.xlabel(r'Upper mass for the IMF (10$^3$)')
Out[7]:<matplotlib.text.Text instance at 0xb693d62c>
In [8]:pylab.savefig('test.eps')
sh: line 1: 19944 Erreur de segmentation gs -dBATCH -dNOPAUSE -r6000=20
-sDEVICE=3Dpswrite -sPAPERSIZE=3Dletter=20
-sOutputFile=3D"/tmp/098f6bcd4621d373cade4e832627b4f6.ps"=20
"/tmp/098f6bcd4621d373cade4e832627b4f6"=20
>"/tmp/098f6bcd4621d373cade4e832627b4f6.output"
-------------------------------------------------------------------------=
--
exceptions.RuntimeError Traceback (most=20
recent call last)
/home/champavert/<ipython console>
/usr/local/lib/python2.4/site-packages/matplotlib/pylab.py in=20
savefig(*args, **kwargs)
811 def savefig(*args, **kwargs):
812 fig =3D gcf()
--> 813 return fig.savefig(*args, **kwargs)
814 if Figure.savefig.__doc__ is not None:
815 savefig.__doc__ =3D _shift_string(Figure.savefig.__doc__)
/usr/local/lib/python2.4/site-packages/matplotlib/figure.py in=20
savefig(self, *args, **kwargs)
685 kwargs[key] =3D rcParams['savefig.%s'%key]
686
--> 687 self.canvas.print_figure(*args, **kwargs)
688
689 def colorbar(self, mappable, cax=3DNone, **kw):
/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.=
py=20
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,=20
**kwargs)
184 if dpi is None: dpi =3D rcParams['savefig.dpi']
185 agg =3D self.switch_backends(FigureCanvasAgg)
--> 186 agg.print_figure(filename, dpi, facecolor, edgecolor,=20
orientation,
187 **kwargs)
188 self.figure.set_canvas(self)
/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py=
=20
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,=20
**kwargs)
486 ps =3D self.switch_backends(FigureCanvasPS)
487 ps.print_figure(filename, dpi, facecolor, edgecol=
or,
--> 488 orientation, **kwargs)
489 elif ext.find('pdf')>=3D0:
490 from backend_pdf import FigureCanvasPdf
/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py=20
in print_figure(self, outfile, dpi, facecolor, edgecolor, orientation,=20
papertype)
1009 # Let's keep the usetex stuff seperate from the=20
generic postscript
1010 self._print_figure_tex(outfile, dpi, facecolor,=20
edgecolor,
-> 1011 orientation, papertype)
1012 else:
1013 if isinstance(outfile, file):
/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py=20
in _print_figure_tex(self, outfile, dpi, facecolor, edgecolor,=20
orientation, papertype)
1243 elif rcParams['text.usetex']:
1244 if False: pass # for debugging
-> 1245 else: gs_distill(tmpfile, ext=3D=3D'.eps',=20
ptype=3Dpapertype, bbox=3Dbbox)
1246
1247 if isinstance(outfile, file):
/usr/local/lib/python2.4/site-packages/matplotlib/backends/backend_ps.py=20
in gs_distill(tmpfile, eps, ptype, bbox)
1341 exit_status =3D os.system(command)
1342 fh =3D file(outfile)
-> 1343 if exit_status: raise RuntimeError('ghostscript was not able=20
to process \
1344 your image.\nHere is the full report generated by=20
ghostscript:\n\n' + fh.read())
1345 else: verbose.report(fh.read(), 'debug')
RuntimeError: ghostscript was not able to process your image.
Here is the full report generated by ghostscript:
ESP Ghostscript 8.15 (2006-04-19)
Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with NO WARRANTY: see the file COPYING for details.
|