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


Showing results of 310

<< < 1 .. 6 7 8 9 10 .. 13 > >> (Page 8 of 13)
From: Michael D. <md...@st...> - 2008年01月15日 20:01:52
Thanks for pointing that out -- I didn't even notice.
There was an ordering problem in how colors were being set. This should 
be fixed in r4870.
Cheers,
Mike
Paul Novak wrote:
> I have another problem after updating to SVN r4869. The ticks take the 
> color of the plotted line without regard to the default. For example,
> 
> matplotlib.rc('xtick', color='black')
> matplotlib.rc('ytick', color='black')
> plot(x, y, 'red')
> 
> will give red ticks.
> 
> Paul
> 
> Michael Droettboom wrote:
>> It's a bug. It's now possible for rgba colors to make their way all 
>> the way down to that level, so the code needs to truncate that to rgb 
>> (Ps can't handle alpha anyway).
>>
>> This is committed in SVN r4869.
>>
>> Cheers,
>> Mike
>>
>> Paul Novak wrote:
>>> Hello,
>>>
>>> I am trying to use the PS backend to make some simple line plots, 
>>> using the following script, but I get the error messages included 
>>> below when I try to plot with usetex=True. I have also included the 
>>> output from --verbose=helpful. I am using the current SVN, and I 
>>> don't recall having this problem when using 0.91.1.
>>>
>>> Thanks,
>>> Paul
>>>
>>> ---
>>> #!/usr/bin/env python
>>>
>>> import matplotlib
>>> matplotlib.use('PS')
>>> matplotlib.rc('text', usetex = 'True')
>>> from pylab import *
>>>
>>> x = arange(0,5)
>>> y = 2 * x
>>> figure(1)
>>> plot(x, y)
>>> savefig('psfig')
>>> show()
>>>
>>> ---
>>> $HOME=/home/pnovak
>>> CONFIGDIR=/home/pnovak/.matplotlib
>>> matplotlib data path 
>>> /usr/lib/python2.5/site-packages/matplotlib/mpl-data
>>> loaded rc file /home/pnovak/.matplotlib/matplotlibrc
>>> matplotlib version 0.98pre
>>> verbose.level helpful
>>> interactive is False
>>> units is False
>>> platform is linux2
>>> numerix numpy 1.0.3.1
>>> Using fontManager instance from 
>>> /home/pnovak/.matplotlib/fontManager.cache
>>> backend PS version Level II
>>> Found dvipng version 1.5
>>>
>>> Traceback (most recent call last):
>>> File "junk.py", line 15, in <module>
>>> savefig('psfig')
>>> File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 
>>> 271, in savefig
>>> return fig.savefig(*args, **kwargs)
>>> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
>>> 854, in savefig
>>> self.canvas.print_figure(*args, **kwargs)
>>> File 
>>> "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 
>>> 1085, in print_figure
>>> **kwargs)
>>> File 
>>> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
>>> line 837, in print_ps
>>> return self._print_ps(outfile, 'ps', *args, **kwargs)
>>> File 
>>> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
>>> line 863, in _print_ps
>>> orientation, isLandscape, papertype)
>>> File 
>>> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
>>> line 1051, in _print_figure_tex
>>> self.figure.draw(renderer)
>>> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
>>> 698, in draw
>>> for a in self.axes: a.draw(renderer)
>>> File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 
>>> 1397, in draw
>>> a.draw(renderer)
>>> File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 
>>> 680, in draw
>>> tick.draw(renderer)
>>> File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 
>>> 179, in draw
>>> self.label1.draw(renderer)
>>> File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 
>>> 761, in draw
>>> Text.draw(self, renderer)
>>> File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 
>>> 309, in draw
>>> self._fontproperties, angle)
>>> File 
>>> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
>>> line 544, in draw_tex
>>> color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb()
>>> TypeError: not all arguments converted during string formatting
>>>
>>> ------------------------------------------------------------------------- 
>>>
>>> This SF.net email is sponsored by: Microsoft
>>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Paul N. <pn...@ui...> - 2008年01月15日 19:42:08
I have another problem after updating to SVN r4869. The ticks take the 
color of the plotted line without regard to the default. For example,
matplotlib.rc('xtick', color='black')
matplotlib.rc('ytick', color='black')
plot(x, y, 'red')
will give red ticks.
Paul
Michael Droettboom wrote:
> It's a bug. It's now possible for rgba colors to make their way all the 
> way down to that level, so the code needs to truncate that to rgb (Ps 
> can't handle alpha anyway).
> 
> This is committed in SVN r4869.
> 
> Cheers,
> Mike
> 
> Paul Novak wrote:
>> Hello,
>>
>> I am trying to use the PS backend to make some simple line plots, 
>> using the following script, but I get the error messages included 
>> below when I try to plot with usetex=True. I have also included the 
>> output from --verbose=helpful. I am using the current SVN, and I don't 
>> recall having this problem when using 0.91.1.
>>
>> Thanks,
>> Paul
>>
>> ---
>> #!/usr/bin/env python
>>
>> import matplotlib
>> matplotlib.use('PS')
>> matplotlib.rc('text', usetex = 'True')
>> from pylab import *
>>
>> x = arange(0,5)
>> y = 2 * x
>> figure(1)
>> plot(x, y)
>> savefig('psfig')
>> show()
>>
>> ---
>> $HOME=/home/pnovak
>> CONFIGDIR=/home/pnovak/.matplotlib
>> matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data
>> loaded rc file /home/pnovak/.matplotlib/matplotlibrc
>> matplotlib version 0.98pre
>> verbose.level helpful
>> interactive is False
>> units is False
>> platform is linux2
>> numerix numpy 1.0.3.1
>> Using fontManager instance from 
>> /home/pnovak/.matplotlib/fontManager.cache
>> backend PS version Level II
>> Found dvipng version 1.5
>>
>> Traceback (most recent call last):
>> File "junk.py", line 15, in <module>
>> savefig('psfig')
>> File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 
>> 271, in savefig
>> return fig.savefig(*args, **kwargs)
>> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
>> 854, in savefig
>> self.canvas.print_figure(*args, **kwargs)
>> File 
>> "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", line 
>> 1085, in print_figure
>> **kwargs)
>> File 
>> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
>> line 837, in print_ps
>> return self._print_ps(outfile, 'ps', *args, **kwargs)
>> File 
>> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
>> line 863, in _print_ps
>> orientation, isLandscape, papertype)
>> File 
>> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
>> line 1051, in _print_figure_tex
>> self.figure.draw(renderer)
>> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
>> 698, in draw
>> for a in self.axes: a.draw(renderer)
>> File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 
>> 1397, in draw
>> a.draw(renderer)
>> File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 
>> 680, in draw
>> tick.draw(renderer)
>> File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 
>> 179, in draw
>> self.label1.draw(renderer)
>> File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 
>> 761, in draw
>> Text.draw(self, renderer)
>> File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 
>> 309, in draw
>> self._fontproperties, angle)
>> File 
>> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
>> line 544, in draw_tex
>> color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb()
>> TypeError: not all arguments converted during string formatting
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Microsoft
>> Defy all challenges. Microsoft(R) Visual Studio 2008.
>> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Michael D. <md...@st...> - 2008年01月15日 19:33:16
It's a bug. It's now possible for rgba colors to make their way all the 
way down to that level, so the code needs to truncate that to rgb (Ps 
can't handle alpha anyway).
This is committed in SVN r4869.
Cheers,
Mike
Paul Novak wrote:
> Hello,
> 
> I am trying to use the PS backend to make some simple line plots, using 
> the following script, but I get the error messages included below when I 
> try to plot with usetex=True. I have also included the output from 
> --verbose=helpful. I am using the current SVN, and I don't recall having 
> this problem when using 0.91.1.
> 
> Thanks,
> Paul
> 
> ---
> #!/usr/bin/env python
> 
> import matplotlib
> matplotlib.use('PS')
> matplotlib.rc('text', usetex = 'True')
> from pylab import *
> 
> x = arange(0,5)
> y = 2 * x
> figure(1)
> plot(x, y)
> savefig('psfig')
> show()
> 
> ---
> $HOME=/home/pnovak
> CONFIGDIR=/home/pnovak/.matplotlib
> matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data
> loaded rc file /home/pnovak/.matplotlib/matplotlibrc
> matplotlib version 0.98pre
> verbose.level helpful
> interactive is False
> units is False
> platform is linux2
> numerix numpy 1.0.3.1
> Using fontManager instance from /home/pnovak/.matplotlib/fontManager.cache
> backend PS version Level II
> Found dvipng version 1.5
> 
> Traceback (most recent call last):
> File "junk.py", line 15, in <module>
> savefig('psfig')
> File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 
> 271, in savefig
> return fig.savefig(*args, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
> 854, in savefig
> self.canvas.print_figure(*args, **kwargs)
> File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", 
> line 1085, in print_figure
> **kwargs)
> File 
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
> line 837, in print_ps
> return self._print_ps(outfile, 'ps', *args, **kwargs)
> File 
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
> line 863, in _print_ps
> orientation, isLandscape, papertype)
> File 
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
> line 1051, in _print_figure_tex
> self.figure.draw(renderer)
> File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
> 698, in draw
> for a in self.axes: a.draw(renderer)
> File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 
> 1397, in draw
> a.draw(renderer)
> File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 680, 
> in draw
> tick.draw(renderer)
> File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 179, 
> in draw
> self.label1.draw(renderer)
> File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 761, 
> in draw
> Text.draw(self, renderer)
> File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 309, 
> in draw
> self._fontproperties, angle)
> File 
> "/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
> line 544, in draw_tex
> color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb()
> TypeError: not all arguments converted during string formatting
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Paul N. <pn...@ui...> - 2008年01月15日 19:16:25
Hello,
I am trying to use the PS backend to make some simple line plots, using 
the following script, but I get the error messages included below when I 
try to plot with usetex=True. I have also included the output from 
--verbose=helpful. I am using the current SVN, and I don't recall having 
this problem when using 0.91.1.
Thanks,
Paul
---
#!/usr/bin/env python
import matplotlib
matplotlib.use('PS')
matplotlib.rc('text', usetex = 'True')
from pylab import *
x = arange(0,5)
y = 2 * x
figure(1)
plot(x, y)
savefig('psfig')
show()
---
$HOME=/home/pnovak
CONFIGDIR=/home/pnovak/.matplotlib
matplotlib data path /usr/lib/python2.5/site-packages/matplotlib/mpl-data
loaded rc file /home/pnovak/.matplotlib/matplotlibrc
matplotlib version 0.98pre
verbose.level helpful
interactive is False
units is False
platform is linux2
numerix numpy 1.0.3.1
Using fontManager instance from /home/pnovak/.matplotlib/fontManager.cache
backend PS version Level II
Found dvipng version 1.5
Traceback (most recent call last):
 File "junk.py", line 15, in <module>
 savefig('psfig')
 File "/usr/lib/python2.5/site-packages/matplotlib/pyplot.py", line 
271, in savefig
 return fig.savefig(*args, **kwargs)
 File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
854, in savefig
 self.canvas.print_figure(*args, **kwargs)
 File "/usr/lib/python2.5/site-packages/matplotlib/backend_bases.py", 
line 1085, in print_figure
 **kwargs)
 File 
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
line 837, in print_ps
 return self._print_ps(outfile, 'ps', *args, **kwargs)
 File 
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
line 863, in _print_ps
 orientation, isLandscape, papertype)
 File 
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
line 1051, in _print_figure_tex
 self.figure.draw(renderer)
 File "/usr/lib/python2.5/site-packages/matplotlib/figure.py", line 
698, in draw
 for a in self.axes: a.draw(renderer)
 File "/usr/lib/python2.5/site-packages/matplotlib/axes.py", line 
1397, in draw
 a.draw(renderer)
 File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 680, 
in draw
 tick.draw(renderer)
 File "/usr/lib/python2.5/site-packages/matplotlib/axis.py", line 179, 
in draw
 self.label1.draw(renderer)
 File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 761, 
in draw
 Text.draw(self, renderer)
 File "/usr/lib/python2.5/site-packages/matplotlib/text.py", line 309, 
in draw
 self._fontproperties, angle)
 File 
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_ps.py", 
line 544, in draw_tex
 color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb()
TypeError: not all arguments converted during string formatting
From: chuckwhite <chu...@ch...> - 2008年01月15日 16:04:48
Hello: I need to create a chart which shows the effect of promotions (eg.
forms of advertisement, discounts, etc.) on sales. The data that I have is:
weekly sales -- sales[sku, week]
promotions -- promotion[prom_name, day]
Currently, I have aggregated the promotion data to week whereby if a
promotion runs during any part of the week I show it against the week. In 
http://www.nabble.com/file/p14841528/Example1.png Example1.png , the
promotions (abbreviated using the first two letters) are shown in yellow
labels. Holidays are shown using blue labels.
The **problem** is that there are part week promotions -- so "Ta" may
produce a very different uplift depending on whether it runs for part of the
week or the whole week, and even if it is running part of the week, which
days it runs.
To display the promotions during each day of the week, I can construct a
matrix of size [rows = 7 days in week, cols = #weeks shown on X axis ]. I
would assign values by powers of 2 for the promotions. None - 1, Ta - 2, Ma
- 4, BA - 8, etc. So, for a day which has Ta and Ba, I would end up with a
value of 10. Hence, I will have a matrix which needs to be displayed on the
chart.
My first attempt at displaying a randomly generated matrix is shown in 
http://www.nabble.com/file/p14841528/Example2.png Example2.png . The code I
used is:
 ax2 = fig.add_subplot(211)
 ax2.set_xlim((lstDateOrd[0],lstDateOrd[-1]))
 a = PL.uniform(low=0,high=1,size=(7,len(lstDateOrd)-1))
 ax2.imshow(a, origin='lower', interpolation='nearest', alpha=0.8)
 ax2.set_xticks([])
 ax2.set_yticks([])
Questions -- (1) should I use matshow, imshow, pcolor or pcolormesh? (2) is
it possible to align the columns in the "promotions" color bar with the bars
below? (3) I am not able to set a colorbar; the error I get is:
 File "C:\Python25\Lib\site-packages\matplotlib\colorbar.py", line 525, in
__init__
 mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: 'NoneType' object has no attribute 'autoscale_None'
Thanks.
-- 
View this message in context: http://www.nabble.com/Barchart-and-imshow-tp14841528p14841528.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2008年01月15日 13:46:40
Ah -- just thought of something else.
If I adjust simple_plot_fps.py to have 100,000 data points rather than 
1,000 I see something that starts to match with what you're seeing:
GtkAgg:
wallclock: 4.23297405243
user: 3.33
fps: 23.6240522057
Gtk:
wallclock: 15.0203828812
user: 14.92
fps: 6.65761990165
TkAgg:
wallclock: 4.8252530098
user: 4.67
fps: 20.7243018754
You can see that the Gtk time is starting to explode. If I go to 
1,000,000 points, Gtk runs out of memory before the first plot, whereas 
the other two continue to chug along at a reasonable pace.
 From looking at the code, I suspect the crucial difference is that the 
Gdk backend uses the Python sequence API (rather slow) to access the 
data as it gets rendered, whereas GtkAgg uses the numpy array interface 
which is essentially raw access to a C array.
So -- try using GtkAgg if you can get away with it. The only real 
advantage of the raw Gtk (Gdk specifically) backend is when running over 
a remote X connection. If that's not an option for you, I don't have 
any easy solution that comes to mind. It's sort of a pygtk issue -- it 
would have to be rewritten to take numpy arrays which is probably 
unlikely to happen in the official codebase. Matplotlib has a little 
more control over what happens in the Agg backend, since the Python 
wrapper is included in matplotlib.
Hope that information helps.
Cheers,
Mike
Michael Droettboom wrote:
> In my own tests, using the built-in GUI windows I get the following 
> numbers on the simple_plot_fps.py speed test (which essentially tests 
> redrawing speed, which is pretty GUI-backend dependent, as opposed to 
> the first drawing operation which involves more common code):
> 
> GtkAgg:
> wallclock: 3.73636507988
> user: 2.9
> fps: 26.7639799276
> 
> Gtk:
> wallclock: 1.99883008003
> user: 1.99
> fps: 50.0292651181
> 
> TkAgg:
> wallclock: 4.55140709877
> user: 4.41
> fps: 21.9712273216
> 
> So you can see that GtkAgg is actually slightly faster than TkAgg, and 
> Gtk (if you can accept the lower rendering quality), is almost 2x as fast.
> 
> So, if you're certain the same amount of data is being plotted in the 
> default Tk window and your custom Gtk window, it seems to suggest that 
> the slowdown is probably something in how you're embedding it. 
> (Obviously the number of data points as a significant impact on speed 
> regardless of backend.) I'm not enough of a Gtk expert that anything in 
> what you're doing jumps out at me. What triggers the call to 
> "plotFrictionProfile?" Is that possible that is getting called more 
> times than you expect?
> 
> Cheers,
> Mike
> 
> steve george wrote:
>> Hi,
>>
>> I don't have conclusive proof, .. but I suspect that the draw() of a 
>> graph in a pyGTK application is order of magnitudes slower than I can 
>> plot the same data in the default Tk graphing widget.
>>
>> i.e. 5 sec in tk, ... and >1 minute in gtk
>>
>> Obvious question, ... is this a know issue?
>> Is there any tricks in gtk to speed up the draw()
>>
>> Attached is a heavily snipped example of bits and pieces of my code, 
>> maybe I have structured my program incorrectly?
>>
>> Thanks for any comments
>> Steve
>>
>>
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2008年01月15日 13:28:30
You can use a numpy masked array, and mask the values that you don't 
want to plot. Or you can use a normal numpy array and set the missing 
values to numpy.nan. (There seem to be a few side cases where the 
second option doesn't do what you would expect in 0.91.2, but AFAIK it 
works in recent revisions of the SVN trunk.)
In either case, you will still need to assign dates to correspond to 
those "missing" values. See masked_demo.py for an example (which 
doesn't use dates, but the concepts are the same).
Cheers,
Mike
Lucas Di Pentima wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi all,
> 
> I'm starting with matplotlib, using it to build a performance monitor
> web application.
> 
> The plots I'm using mostly are date based graphs, what's the best way to
> go when I have to plot some data that have gaps inside the date ranges?
> The default behaviour is to just connect the last known value with the
> first one after the gap and I would prefer that the graph simply don't
> graph anything in that range.
> 
> Thanks in advance
> - --
> Lucas Di Pentima - http://lucas.di-pentima.com.ar
> GnuPG Public Key:
> http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6AA54FC9
> Key fingerprint = BD3B 08C4 661A 8C3B 1855 740C 8F98 3FCF 6AA5 4FC9
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> 
> iD8DBQFHjKg4j5g/z2qlT8kRAtc7AKCORvzHbT8vy5os2TfzgttzrgIycACdE2dH
> Rj0iCiSnVZMB3rdnFMWbBcQ=
> =0v0+
> -----END PGP SIGNATURE-----
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Michael D. <md...@st...> - 2008年01月15日 13:22:43
In my own tests, using the built-in GUI windows I get the following 
numbers on the simple_plot_fps.py speed test (which essentially tests 
redrawing speed, which is pretty GUI-backend dependent, as opposed to 
the first drawing operation which involves more common code):
GtkAgg:
wallclock: 3.73636507988
user: 2.9
fps: 26.7639799276
Gtk:
wallclock: 1.99883008003
user: 1.99
fps: 50.0292651181
TkAgg:
wallclock: 4.55140709877
user: 4.41
fps: 21.9712273216
So you can see that GtkAgg is actually slightly faster than TkAgg, and 
Gtk (if you can accept the lower rendering quality), is almost 2x as fast.
So, if you're certain the same amount of data is being plotted in the 
default Tk window and your custom Gtk window, it seems to suggest that 
the slowdown is probably something in how you're embedding it. 
(Obviously the number of data points as a significant impact on speed 
regardless of backend.) I'm not enough of a Gtk expert that anything in 
what you're doing jumps out at me. What triggers the call to 
"plotFrictionProfile?" Is that possible that is getting called more 
times than you expect?
Cheers,
Mike
steve george wrote:
> 
> Hi,
> 
> I don't have conclusive proof, .. but I suspect that the draw() of a 
> graph in a pyGTK application is order of magnitudes slower than I can 
> plot the same data in the default Tk graphing widget.
> 
> i.e. 5 sec in tk, ... and >1 minute in gtk
> 
> Obvious question, ... is this a know issue?
> Is there any tricks in gtk to speed up the draw()
> 
> Attached is a heavily snipped example of bits and pieces of my code, 
> maybe I have structured my program incorrectly?
> 
> Thanks for any comments
> Steve
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Lucas Di P. <lu...@di...> - 2008年01月15日 12:34:12
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
I'm starting with matplotlib, using it to build a performance monitor
web application.
The plots I'm using mostly are date based graphs, what's the best way to
go when I have to plot some data that have gaps inside the date ranges?
The default behaviour is to just connect the last known value with the
first one after the gap and I would prefer that the graph simply don't
graph anything in that range.
Thanks in advance
- --
Lucas Di Pentima - http://lucas.di-pentima.com.ar
GnuPG Public Key:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x6AA54FC9
Key fingerprint = BD3B 08C4 661A 8C3B 1855 740C 8F98 3FCF 6AA5 4FC9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFHjKg4j5g/z2qlT8kRAtc7AKCORvzHbT8vy5os2TfzgttzrgIycACdE2dH
Rj0iCiSnVZMB3rdnFMWbBcQ=
=0v0+
-----END PGP SIGNATURE-----
From: steve g. <ste...@op...> - 2008年01月15日 12:04:39
Attachments: SnippedPlotExample.py
Hi,
I don't have conclusive proof, .. but I suspect that the draw() of a 
graph in a pyGTK application is order of magnitudes slower than I can 
plot the same data in the default Tk graphing widget.
i.e. 5 sec in tk, ... and >1 minute in gtk
Obvious question, ... is this a know issue?
Is there any tricks in gtk to speed up the draw()
Attached is a heavily snipped example of bits and pieces of my code, 
maybe I have structured my program incorrectly?
Thanks for any comments
Steve
-- 
NO to the Microsoft Office format as an ISO standard
http://www.noooxml.org/petition
From: sunzen w. <su...@gm...> - 2008年01月15日 07:54:33
Attachments: xlim-change.py
Hi, all
I found a problem about xlim. It sometimes changes when there is no explicit
calling of set_xlim.
My application scenario is : at some situation replot the second one of two
subplots, which shares x axis with the first one. To finish the replot
operation, i first use clear() method to remove the previous image, and then
plot a new one. The problem is that, there is an 'unexpected' change of
xlim.
The attached code is tried to reproduce the problem. I'm sorry for that it
is not small enough and that it even seems ugly. But after all, the problem
can be showed by it. Its text output simply shows the 'unexpected' changes.
As it can be seen, plot operation causes change of xlim. While, i'd like to
see that xlim changes only when responding to call ing set_xlim().
What's the possible reason? How should i do to avoid the unexpected
change? As the sample code shows, the unexpected change can be reverted by
calling set_xlim(). but this solution doesn't seem a graceful one.
Thank you for your any help.
-- 
sunzen
<<freedom & enjoyment>>
From: Russell E. O. <ro...@ce...> - 2008年01月15日 01:12:50
In article 
<638...@ma...>,
 "Charlie Moad" <cw...@gm...> wrote:
> I have replaced the binary with a working version.
I'm running into an odd issue with that version (at least). If I unzip 
the egg and run easy_install on it it ends up in site-packages with odd 
permissions:
% pwd
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-pack
ages
% ls -l
drwx------ 9 rowen admin 306 Jan 14 16:59 
matplotlib-0.91.2-py2.5-macosx-10.3-fat.egg
The permissions inside look normal so this is easy to fix with chmod, 
but it seems strange. Any idea if I am doing something wrong or if 
something is wrong with the package?
-- Russell
From: Christopher B. <Chr...@no...> - 2008年01月14日 23:48:41
Michael Droettboom wrote:
> All that said, you could experiment with rendering to a vector format 
> (e.g. Pdf or Svg) and then have wxPython render it directly with each 
> window resize. 
If you did want to go that route, someone wrote a SVG renderer for 
wxPython -- search the wxpython-users list to find it.
I do question why you want this -- MPLs current behavior generally makes 
the most sense -- you generally want the same font sizes and line 
thicknesses in a GUI app regardless of how large your Window is.
Unless you really need it to look that same as it would on paper, for 
instance.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Chris S. <so...@st...> - 2008年01月14日 23:24:41
Jurgen,
I generally lurk on the list, but I'll speak up now since I have 
basically done what you are talking about. I integrated MPL (TkAgg) 
into an existing application that resizes (PyRAF).
The path I chose isn't particularly pretty, but it does the job and 
sounds like it might be flexible enough for what you are doing. I 
created an adapter class which wraps the MPL calls. The adapter is what 
the existing application calls to make plots instead of calling MPL 
directly. The adapter also keeps a normalized (0-1) copy of all plot 
data arrays (and any lines and other items). When the canvas is 
resized, I go through all my lines (Line2D), patches (Rectangle), and 
text, and scale each based on the new canvas dimensions. Then the new 
items are inserted directly into the Figure object, replacing the old 
values. This resizes everything so that it is correct when redrawn. I 
was initially concerned about performance, but the resizings are very 
smooth (thanks matplotlib!). You could also enforce an aspect ratio 
this way.
I had to write this adapter not because of the resizing issue, but due 
to the constraints of the existing application with which I was 
working. It did however make resizing easy. As long as your plotted 
items are relatively simple (lines, patches, text), this works very 
well. Using more complicated items like legends would not work as well 
unless you either allowed them to stay a static size or manually 
composed them of simpler objects. In general, this idea is probably 
more work than John's DPI suggestions.
Chris
From: Michael D. <md...@st...> - 2008年01月14日 23:24:21
Doh! Why didn't I think of that?
Mike
John Hunter wrote:
> On Jan 14, 2008 3:55 PM, Michael Droettboom <md...@st...> wrote:
> 
>> I think what you're asking for would require a pretty major overhaul of
>> matplotlib. The fact that all the text etc. remains the same size is a
> 
> matplotlib is designed to scale in the way Jurgen requests with DPI
> (eg fonts, line thicknesses and the like scale with DPI).
> 
> In [65]: fig = figure()
> 
> In [66]: plot([1,2,3])
> Out[66]: [<matplotlib.lines.Line2D instance at 0xbf965ec>]
> 
> In [67]: fig.dpi.set(200)
> 
> In [68]: fig.canvas.draw()
> 
> with a little work, one could hook into the resize mechanism to
> increase the dpi to create the desired effect w/o a major overhaul.
> By default what happens is the width and height in inches are changed
> with a resize but the dpi is held constant. One could trick
> matplotlib by computing a new width, height in inches, and a new dpi
> so that the resized canvas width in pixels is the requested size based
> on the resize event but the dpi is increased to create the microcal
> effect
> 
> JDH
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: John H. <jd...@gm...> - 2008年01月14日 22:31:59
On Jan 14, 2008 3:55 PM, Michael Droettboom <md...@st...> wrote:
> I think what you're asking for would require a pretty major overhaul of
> matplotlib. The fact that all the text etc. remains the same size is a
matplotlib is designed to scale in the way Jurgen requests with DPI
(eg fonts, line thicknesses and the like scale with DPI).
In [65]: fig = figure()
In [66]: plot([1,2,3])
Out[66]: [<matplotlib.lines.Line2D instance at 0xbf965ec>]
In [67]: fig.dpi.set(200)
In [68]: fig.canvas.draw()
with a little work, one could hook into the resize mechanism to
increase the dpi to create the desired effect w/o a major overhaul.
By default what happens is the width and height in inches are changed
with a resize but the dpi is held constant. One could trick
matplotlib by computing a new width, height in inches, and a new dpi
so that the resized canvas width in pixels is the requested size based
on the resize event but the dpi is increased to create the microcal
effect
JDH
From: Michael D. <md...@st...> - 2008年01月14日 21:55:33
DaFudl wrote:
> I integrated mpl into my wxPython application for plotting simple lines.
> I would like my canvas to behave differently when the containing window is
> being resized.
> At the moment all text, all lines, all markers, the legend... remain in the
> same state (same size and thickness) regardless whether the plot is small or
> big. As a result the plot looks fine at one size only.
> I need all elements to be resized with the window just like it happens in
> Microcal's scientific plotting software "origin". Everything should resize
> as a "whole".
I think what you're asking for would require a pretty major overhaul of 
matplotlib. The fact that all the text etc. remains the same size is a 
deliberate design decision, and actually requires a lot more work to 
make fast enough, since a lot more must be recalculated with each 
redraw, rather than just multiplying everything by a scale factor.
All that said, you could experiment with rendering to a vector format 
(e.g. Pdf or Svg) and then have wxPython render it directly with each 
window resize. (This would be much the same way that resizing a PDF 
generated by matplotlib in Acrobat Reader scales everything as a whole).
Alternatively, you could try using a backend (e.g. Cairo) that allows 
you to push a global affine transformation onto the transformation 
stack. (At present, the Agg backends don't have that functionality -- 
but it could be added, especially since the recent overhaul of 
transformations in general in matplotlib.) That way, you could tell the 
underlying rendering engine (below matplotlib) to scale everything up 
and down for any subsequent commands it receives from matplotlib.
But, anyway you slice it, I think you're looking at getting your hands 
dirty in some matplotlib internals. I'm happy to help if you want to 
work through it, but I don't think I would have time myself.
> Also, it would be great to keep the aspect ratio of the plot when resizing
> and zooming. I could not figure out how to do that. Using methods like
> apply_aspect and set_adjustable is not enough.
That seems to be easy enough to do in the window resize callback -- just 
programmatically force-resize the window to the desired aspect ratio.
Cheers,
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: DaFudl <jue...@gm...> - 2008年01月14日 21:26:40
I integrated mpl into my wxPython application for plotting simple lines.
I would like my canvas to behave differently when the containing window is
being resized.
At the moment all text, all lines, all markers, the legend... remain in the
same state (same size and thickness) regardless whether the plot is small or
big. As a result the plot looks fine at one size only.
I need all elements to be resized with the window just like it happens in
Microcal's scientific plotting software "origin". Everything should resize
as a "whole".
Also, it would be great to keep the aspect ratio of the plot when resizing
and zooming. I could not figure out how to do that. Using methods like
apply_aspect and set_adjustable is not enough.
Is there a way to make those things work?
Thanks,
Jurgen
-- 
View this message in context: http://www.nabble.com/resizing-behaviour-like-in-Mircrocal-Origin-tp14814996p14814996.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: John H. <joh...@gm...> - 2008年01月14日 20:25:41
>
I have some code that produces a series of graphs of data over time. 
For the most part it works well, but for certain combinations of 
dates the two plots do not line up, due to the width of the bars in 
the first subplot. What is the best way for force my second 
subplot's x axis to be identical to that of the first subplot?
Thanks!
Here is minimal code reproducing the problem:
import matplotlib
from datetime import *
import time
from pylab import *
def toOrd(strDate):
	return datetime(*time.strptime(strDate,"%m/%d/%y")[0:5]).toordinal()
def main():
	
	startDate = toOrd("05/24/05")
	endDate = toOrd("11/21/06")
	
	dates = range(startDate,endDate,7)
	figure(1)
	
	axis = subplot(211,axisbelow=True)
	plot_date(dates,dates,visible = False)
	axis.bar(dates,dates, width=3.0)
	
	axis = subplot(212,axisbelow=True)
	plot_date(dates,dates) #,'-',color = priceColor)
	
	show()
	
if __name__ == '__main__':
	main()
From: Jeff W. <js...@fa...> - 2008年01月14日 19:20:51
j. vickroy wrote:
> Hello, I am a first-time user of matplotlib.
>
> When trying to run the plotmap.py example, the following traceback is 
> generated:
>
> >plotmap.py
> Traceback (most recent call last):
> File "C:\Documents and Settings\jim.vickroy\My 
> Documents\Projects\High-latitudes D-region\plotmap.py", line 13, in 
> <module>
> topoin = load('etopo20data.gz')
> File "C:\Python25\Lib\site-packages\matplotlib\mlab.py", line 1252, in 
> load
> fh = cbook.to_filehandle(fname)
> File "C:\Python25\Lib\site-packages\matplotlib\cbook.py", line 236, in 
> to_filehandle
> fh = gzip.open(fname, flag)
> File "C:\Python25\lib\gzip.py", line 49, in open
> return GzipFile(filename, mode, compresslevel)
> File "C:\Python25\lib\gzip.py", line 95, in __init__
> fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
> IOError: [Errno 2] No such file or directory: 'etopo20data.gz'
>
> How do I obtain this file and where should it reside?
>
> I have downloaded proj446_win32_bin.zip and unzipped it, but I do not 
> see any such file.
>
> I have also attempted to search this user-group archive for references 
> to "etopo20data.gz" but repeatedly get an "Unable to connect to Search 
> Server" error so I do not know what I'm doing incorrectly.
>
> I have installed:
> - matplotlib-0.91.2.win32-py2.5.exe
> - basemap-0.9.9.1.win32-py2.5.exe
> - httplib2-0.4.0.zip
> for use with Python 2.5.1.
>
> I apologize if this has been previously addressed.
>
> Thanks,
> -- jv
> 
It's in the examples directory of the basemap source tarball 
(basemap-0.9.9.1.tar.gz). The examples directory is not included with 
the binary installers.
-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: j. v. <jgv...@co...> - 2008年01月14日 19:05:10
Hello, I am a first-time user of matplotlib.
When trying to run the plotmap.py example, the following traceback is 
generated:
 >plotmap.py
Traceback (most recent call last):
 File "C:\Documents and Settings\jim.vickroy\My 
Documents\Projects\High-latitudes D-region\plotmap.py", line 13, in 
<module>
 topoin = load('etopo20data.gz')
 File "C:\Python25\Lib\site-packages\matplotlib\mlab.py", line 1252, in 
load
 fh = cbook.to_filehandle(fname)
 File "C:\Python25\Lib\site-packages\matplotlib\cbook.py", line 236, in 
to_filehandle
 fh = gzip.open(fname, flag)
 File "C:\Python25\lib\gzip.py", line 49, in open
 return GzipFile(filename, mode, compresslevel)
 File "C:\Python25\lib\gzip.py", line 95, in __init__
 fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
IOError: [Errno 2] No such file or directory: 'etopo20data.gz'
How do I obtain this file and where should it reside?
I have downloaded proj446_win32_bin.zip and unzipped it, but I do not 
see any such file.
I have also attempted to search this user-group archive for references 
to "etopo20data.gz" but repeatedly get an "Unable to connect to Search 
Server" error so I do not know what I'm doing incorrectly.
I have installed:
- matplotlib-0.91.2.win32-py2.5.exe
- basemap-0.9.9.1.win32-py2.5.exe
- httplib2-0.4.0.zip
for use with Python 2.5.1.
I apologize if this has been previously addressed.
Thanks,
-- jv
From: Carol L. <car...@sr...> - 2008年01月14日 18:12:12
Hi folks,
I have encountered a problem using colorbar and set_under with a color 
map that has only 32 colors. The downward arrow is not filled with the 
correct color. If 64 colors are used, the arrow is filled correctly. I 
actually want 8 colors.
The test code is essentially image_masked.py from the 0.90.0 examples.
if I use: palette = cm.get_cmap("gray", 64)
the plot is OK.
if I use: palette = cm.get_cmap("gray", 32)
it is not OK.
In both cases, the upper arrow is the correct color.
I am using matplotlib version 0.90.0.
Here is the complete code:
#!/usr/bin/env python
'''imshow with masked array input and out-of-range colors.
'''
from pylab import *
import matplotlib.numerix.ma as ma
import matplotlib.colors as colors
delta = 0.025
x = y = arange(-3.0, 3.0, delta)
X, Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10 * (Z2-Z1) # difference of Gaussians
# Set up a colormap:
#palette = cm.gray	# OK
palette = cm.get_cmap("gray",32)	# Not OK
#palette = cm.get_cmap("gray",64)	# OK
palette.set_over('r', 1.0)
palette.set_under('g', 1.0)
palette.set_bad('b', 1.0)
# Alternatively, we could use
# palette.set_bad(alpha = 0.0)
# to make the bad region transparent. This is the default.
# If you comment out all the palette.set* lines, you will see
# all the defaults; under and over will be colored with the
# first and last colors in the palette, respectively.
Zm = ma.masked_where(Z > 1.2, Z)
# By setting vmin and vmax in the norm, we establish the
# range to which the regular palette color scale is applied.
# Anything above that range is colored based on palette.set_over, etc.
im = imshow(Zm, interpolation='bilinear',
 cmap=palette,
 norm = colors.Normalize(vmin = -1.0, vmax = 1.0, clip = False),
 origin='lower', extent=[-3,3,-3,3])
title('Green=low, Red=high, Blue=bad')
# extend choices are "both", "min", "max" and "neither"
colorbar(im, extend='both', shrink=0.8)
show()
-- 
Ms. Carol A. Leger
SRI International			Phone: (650) 859-4114
333 Ravenswood Avenue G-273
Menlo Park, CA 94025 e-mail: le...@sr...
From: BL <bra...@gm...> - 2008年01月14日 18:11:56
 Hi,
I need to make some Weibull analysis and I wanted to make it with numpy and
scipy.
Theses analysis are based on Weibull plots :
 - on X, time values are reported according to a log scale
 - on Y, probability (F) is reported according to a special scale, which
lets Weibull random variables fit on a line.
So the pair (t, F) should be plotted on ( ln(t), ln( -ln(1-F)) )
You can find an example of weibull plot here :
http://www.itl.nist.gov/div898/handbook/eda/section3/weibplot.htm
Here is my way to make weibull plot with matplotlib :
[code]
from numpy import *
from matplotlib.ticker import FuncFormatter
import pylab as p
# I'm used to the ln notation for the natural log
from numpy import log as ln
# Paramters
beta = 5.2
eta = 12
# Genrate 10 numbers following a Weibull distribution
x = eta *random.weibull(beta, size=10)
F = 1 - exp( -(x/eta)**beta )
# Estimate Weibull parameters
lnX = ln(x)
lnF = ln( -ln(1-F) )
a, b = polyfit(lnF, lnX, 1)
beta0 = 1/a
eta0 = exp(b)
# ideal line
F0 = array([1e-3, 1-1e-3])
x0 = eta0 * (-ln(1-F0))**(1/beta0)
lnF0 = ln(-ln(1-F0))
# Weibull plot
p.figure()
ax = p.subplot(111)
p.semilogx(x, lnF, "bs")
p.plot(x0, lnF0, 'r-', label="beta= %5G\neta = %.5G" % (beta0, eta0) )
p.grid()
p.xlabel('x')
p.ylabel('Cumulative Distribution Function')
p.legend(loc='lower right')
# ticks
def weibull_CDF(y, pos):
 return "%G %%" % (100*(1-exp(-exp(y))))
formatter = FuncFormatter(weibull_CDF)
ax.yaxis.set_major_formatter(formatter)
yt_F = array([ 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5,
 0.6, 0.7, 0.8, 0.9, 0.95, 0.99])
yt_lnF = ln( -ln(1-yt_F))
p.yticks(yt_lnF)
p.show()
[/code]
This works, but I 'm pretty sure this could be improved :
1) Is there a way to use matplotlib.transforms to handle the convertion
between F and y=ln(-ln(1-F)) ?
2) I would like to have vertical lines for major and minor ticks. How can I
do that ?
3) In this case, the log notation for the X axis is not pertinent. How could
I switch to a more common floating point notation ?
Any hints ?
Thanks
-- 
LB
From: Darren D. <dar...@co...> - 2008年01月14日 13:24:55
On Monday 14 January 2008 02:27:28 am Tom Johnson wrote:
> I was looking at rc_params() and saw
>
> if not os.path.exists(fname):
> message = 'could not find rc file; returning defaults'
> ret = dict([ (key, tup[0]) for key, tup in defaultParams.items()])
> warnings.warn(message)
> return ret
>
> Is this correct? It seems that it returns a regular dictionary rather
> than an instance of RcParams.
You have a sharp eye. It is incorrect, but it turns out that block of code is 
never executed (unless the user deletes the default rc file from 
site-packages/matplotlib/mpl-data). But I changed it in the trunk to return 
an RcParams object. Thanks for the report.
Darren 
From: Michael D. <md...@st...> - 2008年01月14日 13:18:54
I've committed these changes to matplotlib SVN, and it should make it 
into the next release of 0.91.x, if we decide to make one.
You may be right that Qt's SVG support is iffy (I don't know enough 
about the spec to be sure, so I'm not conceding that), but either way it 
doesn't bother me to make changes that help SVG work in more places. 
It's like all those pragmatic web developers who have to make things 
work with IE...
Thanks for your help. I'll try to get the Qt SVG demo installed here so 
I can test with that the next time our SVG code changes.
Cheers,
Mike
Christiaan Putter wrote:
> Hi Michael,
> 
> Sorry for getting back to you only now, and thanks for the help.
> 
> If you have Qt installed there should be an sample Svg viewer app in the 
> examples somewhere. If you'd like I can send it to you somehow, just 
> let me know.
> 
> I tested the new .svg you sent me it's rendering the same in Firefox and 
> Qt. So it works.
> 
> Once again thanks for your help and let me know if I can send you 
> something to help with testing in Qt. Personally I think Qt's support 
> for svg is still a bit iffy.
> 
> Have a nice,
> 
> Christiaan
> 
> On 04/01/2008, *Michael Droettboom* <md...@st... 
> <mailto:md...@st...>> wrote:
> 
> Can you please test the attached SVG file?
> 
> Cheers,
> Mike
> 
> Michael Droettboom wrote:
> > Between 0.90 and 0.91, the SVG backend was changed to store the glyph
> > outlines of the characters in the SVG file itself. (This is on by
> > default, but can be turned off with the rc parameter
> > svg.embed_char_paths). This helps make the SVG files much more
> > portable, as the need to install the math fonts has long been a
> FAQ on
> > this list. I've been doing all my testing with Firefox and
> Inkscape.
> > Is there a simple Qt-based SVG viewer I could add to my testing
> regimen?
> >
> > I won't pretend to be an expert on the SVG spec, but it does say
> this:
> >
> > < http://www.w3.org/TR/SVG/struct.html#Head>
> >
> > ====
> >
> > To provide some SVG user agents with an opportunity to implement
> > efficient implementations in streaming environments, creators of SVG
> > content are encouraged to place all elements which are targets of
> local
> > URI references within a 'defs' element which is a direct child of
> one of
> > the ancestors of the referencing element. For example:
> >
> > <?xml version="1.0" standalone="no"?>
> > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
> > " http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
> > <svg width="8cm" height="3cm"
> > xmlns="http://www.w3.org/2000/svg">
> > <desc>Local URI references within ancestor's 'defs'
> element.</desc>
> > <defs>
> > <linearGradient id="Gradient01">
> > <stop offset="20%" stop-color="#39F" />
> > <stop offset="90%" stop-color="#F3F" />
> > </linearGradient>
> > </defs>
> > <rect x="1cm" y="1cm" width="6cm" height="1cm"
> > fill="url(#Gradient01)" />
> > <!-- Show outline of canvas using 'rect' element -->
> > <rect x=".01cm" y=".01cm" width="7.98cm" height=" 2.98cm"
> > fill="none" stroke="blue" stroke-width=".02cm" />
> > </svg>
> >
> > View this example as SVG (SVG-enabled browsers only)
> >
> > In the document above, the linear gradient is defined within a
> 'defs'
> > element which is the direct child of the 'svg' element, which in
> turn is
> > an ancestor of the 'rect' element which references the linear
> gradient.
> > Thus, the above document conforms to the guideline.
> >
> > ====
> >
> > So we are complying to that part of the spec. The spec doesn't
> seem to
> > say anything about whether the defs must appear before or after their
> > use -- but maybe I just can't find the relevant paragraph.
> >
> > In any case, this should be easy enough to fix on matplotlib's
> end, and
> > certainly won't break compliance with the spec. I'll have a
> look, and
> > may come back to you for help with testing with Qt if you don't
> mind.
> >
> > Cheers,
> > Mike
> >
> > Christiaan Putter wrote:
> >> Hi there,
> >>
> >> Just an update regarding the svg problem I was having:
> >>
> >> I simply went back to 0.90 and that's working now.
> >>
> >> Would still be nice to know if the svg output from matplotlib
> complies
> >> with the standard or whether it's Qt that's messing things up.
> >>
> >> Merry x-mass!
> >>
> >> cputter
> >>
> >>
> >>
> >> On 21/12/2007, *Christiaan Putter* <cep...@go...
> <mailto:cep...@go...>
> >> <mailto: cep...@go...
> <mailto:cep...@go...>>> wrote:
> >>
> >> Hi guys and girls,
> >>
> >> Quick question regarding matplotlib's svg backend...
> >>
> >> I've embeded pyhton into c++ and Qt's (4.3.3) svg support is
> having
> >> some problems with .svg files created by matplotlib. Text isn't
> >> showing up. Firefox displays the same .svg file correctly
> though...
> >>
> >> The problem:
> >>
> >> It seems some text stuff is stored in a section called defs
> at the
> >> end of the file with stuff linking to this earlier in the
> file. Qt
> >> doesn't like that and only displays the normal plot stuff
> (lines,
> >> etc.) but not the labels and other text.
> >>
> >> More exact:
> >>
> >> <use xlink:href="#c_7" .....
> >>
> >> references
> >>
> >> <path id="c_7" d="M10.6875 .....
> >>
> >> at the end of the file.
> >>
> >>
> >>
> >> When I simply cut and paste the defs section to the
> beginning of the
> >> file it solves the problem.
> >>
> >> What does the svg standard say about this? I assume Qt's
> >> implementation is defect...
> >>
> >> Has anybody else encountered this problem? I'll send an
> e-mail to
> >> Qt too and ask them about it.
> >>
> >> Hope you're all having a nice day.
> >>
> >> Regards,
> >> cputter
> >>
> >>
> >>
> >> 
> -------------------------------------------------------------------------
> 
> >> This SF.net email is sponsored by: Microsoft
> >> Defy all challenges. Microsoft(R) Visual Studio 2005.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> <http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/>
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> <mailto:Mat...@li...>
> >> <mailto:Mat...@li...
> <mailto:Mat...@li...>>
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
> >>
> >>
> >>
> >>
> ------------------------------------------------------------------------
> >>
> >>
> -------------------------------------------------------------------------
> 
> >> This SF.net email is sponsored by: Microsoft
> >> Defy all challenges. Microsoft(R) Visual Studio 2005.
> >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> <http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/>
> >>
> >>
> >>
> ------------------------------------------------------------------------
> >>
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> <mailto:Mat...@li...>
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> <https://lists.sourceforge.net/lists/listinfo/matplotlib-users>
> >
> 
> --
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
2 messages has been excluded from this view by a project administrator.

Showing results of 310

<< < 1 .. 6 7 8 9 10 .. 13 > >> (Page 8 of 13)
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 によって変換されたページ (->オリジナル) /