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) |
|
|
|
From: Lorenzo I. <lor...@gm...> - 2008-01-15 23:37:56
|
Dear All,
I am sending this email out of frustration, but I hope that someone will
be able to tell me what is going on.
I am using pylab on a Debian testing box.
I have the feeling that there is some problem with pylab when I
alternate, as I am doing now, many linear and log-log plots. Very often,
pylab complains about the fact that I cannot take the log of a negative
number even if all the quantities are positive or even if I have
replaced the loglog with a linear plot...
An example (sorry but there are long arrays involved and I cannot
reproduce all my code here):
#! /usr/bin/env python
import scipy as s
import numpy as n
import pylab as p
#from rpy import r
#import distance_calc as d_calc
# now I try performing a least-square fitting
import scipy.optimize as sopt
#do my stuff here
print "my_n_clus_fit is, ", my_n_clus_fit
print "my_r_sq_fit",my_r_sq_fit
print "n_clu_rep2 is, ", n_clu_rep2
print "R_sq is", R_sq
p.plot(n_clu_rep2,R_sq,"bo",my_n_clus_fit,my_r_sq_fit, "ro")
p.xlabel('particles in cluster')
p.ylabel('R square')
#p.legend(('beta=1e-2,100 part','beta=1e-1, 100 part', 'beta=1e-1, 200
part'))
p.title('Cluster-size vs average radius of gyration')
p.grid(True)
p.savefig("R_gyr_vs_N_fit.pdf")
p.hold(False)
and the relevant part of the output is:
my_n_clus_fit is, [ 1.73717793 1.80682874 1.87927215
1.95462012 2.03298911
2.11450025 2.19927951 2.28745793 2.3791718 2.47456287
2.57377856 2.67697224 2.78430338 2.89593788 3.01204829
3.13281405 3.25842182 3.38906574 3.52494773 3.66627779
3.81327439 3.96616469 4.12518502 4.29058114 4.46260869
4.64153356 4.82763228 5.02119248 5.22251334 5.43190599
5.64969409 5.87621423 6.11181652 6.35686511 6.61173873
6.87683131 7.15255258 7.43932868 7.73760284 8.04783608
8.37050788 8.70611696 9.05518203 9.41824259 9.79585979
10.18861726 10.59712204 11.0220055 11.46392434 11.92356157
12.40162761 12.89886134 13.41603127 13.95393673 14.5134091
15.09531308 15.70054806 16.33004946 16.98479025 17.66578236
18.37407832 19.11077287 19.87700462 20.67395784 21.50286429
22.3650051 23.26171279 24.19437329 25.16442809 26.17337649
27.22277791 28.31425426 29.44949252 30.63024729 31.85834351
33.13567931 34.4642289 35.84604567 37.28326532 38.77810918
40.33288767 41.9500038 43.63195696 45.38134673 47.20087695
49.09335983 51.06172036 53.10900079 55.23836536 57.45310516
59.75664325 62.15253993 64.64449825 67.23636972 69.93216028
72.73603649 75.65233197 78.68555407 81.84039088 85.12171845]
my_r_sq_fit [ -2.44174991 -2.39098053 -2.3384157 -2.28399191
-2.22764342
-2.16930217 -2.10889768 -2.04635699 -1.98160454 -1.91456212
-1.84514875 -1.77328057 -1.69887077 -1.62182947 -1.5420636
-1.45947681 -1.37396934 -1.2854379 -1.19377555 -1.09887155
-1.00061127 -0.89887602 -0.7935429 -0.68448467 -0.5715696
-0.45466128 -0.3336185 -0.20829504 -0.07853952 0.05580481
0.19490022 0.33891475 0.48802235 0.64240314 0.80224361
0.96773685 1.13908274 1.31648829 1.50016779 1.69034312
1.88724399 2.09110827 2.30218221 2.52072078 2.74698797
2.98125709 3.22381115 3.47494314 3.73495641 4.00416505
4.28289426 4.57148072 4.87027305 5.17963218 5.49993179
5.8315588 6.1749138 6.53041155 6.89848148 7.27956821
7.67413208 8.0826497 8.50561455 8.94353755 9.3969477
9.86639271 10.35243964 10.85567563 11.37670856 11.91616783
12.47470507 13.05299499 13.65173614 14.27165177 14.91349073
15.57802832 16.26606729 16.97843877 17.71600327 18.47965174
19.27030664 20.08892307 20.93648986 21.81403087 22.72260612
23.66331314 24.63728827 25.64570804 26.68979058 27.77079711
28.89003345 30.04885158 31.24865133 32.49088201 33.77704418
35.10869149 36.48743251 37.91493273 39.3929165 40.92316917]
n_clu_rep2 is, [ 4. 5. 6. 7. 8. 10. 11. 12. 13.
14. 15. 16.
17. 18. 19. 20. 21. 22. 23. 24. 25. 27. 28. 30.
31. 32. 33. 34. 35. 36. 37. 38. 40. 41. 42. 43.
44. 45. 46. 47. 48. 50. 51. 54. 55. 56. 57. 58.
61. 62. 63. 67. 68. 72. 74. 77. 85. 86. 89. 91.
92. 93. 99. 108. 113. 114. 120. 145. 196.]
R_sq is [ 0.41290231 0.63219481 0.50921663 0.60545032
0.71055003
1.24577182 1.01656939 1.35542652 1.68938719 1.96960734
1.8587407 1.25335718 3.38501487 1.73960942 2.66786771
0.78304002 1.9472814 2.59527354 2.82129068 1.95855193
3.97830788 2.42530912 4.77505413 8.87282622 2.6755995
3.53707475 1.36507753 3.87191511 6.63215895 3.45373196
8.22450598 5.15409505 3.28241933 11.51525185 1.11042409
4.69324094 4.337342 7.0230309 6.98027636 2.10322888
3.63283609 3.69895425 2.39382279 24.86394803 6.14874073
6.59253038 7.7958188 20.11261061 9.22805741 1.60984999
4.08915341 13.37680959 10.7330271 9.19988106 18.86681803
16.01119253 16.7679522 12.83288125 28.15284186 2.96382532
28.60613768 10.38346233 24.59404975 3.06332058 120.46780399
29.27275139 25.00389411 17.40801449 21.23510666]
Traceback (most recent call last):
File "./r_gyr.py", line 322, in ?
p.plot(n_clu_rep2,R_sq,"bo",my_n_clus_fit,my_r_sq_fit, "ro")
File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line
2028, in plot
ret = gca().plot(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 2540,
in plot
self.autoscale_view(scalex=scalex, scaley=scaley)
File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1207,
in autoscale_view
self.set_xlim(XL)
File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1493,
in set_xlim
raise ValueError('Cannot set nonpositive limits with log transform')
ValueError: Cannot set nonpositive limits with log transform
But there is no log transform here! True, before I was plotting
n_clu_rep2 and R_sq in a loglog plot, but this should not be a problem.
Is there anything wrong with:
p.plot(n_clu_rep2,R_sq,"bo",my_n_clus_fit,my_r_sq_fit, "ro")
p.xlabel('particles in cluster')
p.ylabel('R square')
#p.legend(('beta=1e-2,100 part','beta=1e-1, 100 part', 'beta=1e-1, 200
part'))
p.title('Cluster-size vs average radius of gyration')
p.grid(True)
p.savefig("R_gyr_vs_N_fit.pdf")
p.hold(False)
?? It looks like pylab is not able to "forget" the previous plots.
Any help here is really appreciated.
Many thanks
Lorenzo
|
|
From: Paul N. <pn...@ui...> - 2008-01-15 22:16:03
|
The patch for legends works except for LineCollection. For any call to
legend(), I get the errors below,
Paul
Traceback (most recent call last):
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py",
line 331, in expose_event
self._render_figure(self._pixmap, w, h)
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py",
line 75, in _render_figure
FigureCanvasAgg.draw(self)
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py",
line 257, in draw
self.figure.draw(self.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/legend.py", line
206, in draw
h.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line
480, in draw
lineFunc(renderer, gc, tpath, affine.frozen())
File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line
740, in _draw_dashed
renderer.draw_path(gc, path, trans)
ValueError: Dash sequence must be an even length sequence; found 1
Traceback (most recent call last):
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py",
line 331, in expose_event
self._render_figure(self._pixmap, w, h)
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py",
line 75, in _render_figure
FigureCanvasAgg.draw(self)
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py",
line 257, in draw
self.figure.draw(self.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/legend.py", line
206, in draw
h.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line
480, in draw
lineFunc(renderer, gc, tpath, affine.frozen())
File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line
740, in _draw_dashed
renderer.draw_path(gc, path, trans)
ValueError: Dash sequence must be an even length sequence; found 1
Traceback (most recent call last):
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtk.py",
line 331, in expose_event
self._render_figure(self._pixmap, w, h)
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_gtkagg.py",
line 75, in _render_figure
FigureCanvasAgg.draw(self)
File
"/usr/lib/python2.5/site-packages/matplotlib/backends/backend_agg.py",
line 257, in draw
self.figure.draw(self.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/legend.py", line
206, in draw
h.draw(renderer)
File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line
480, in draw
lineFunc(renderer, gc, tpath, affine.frozen())
File "/usr/lib/python2.5/site-packages/matplotlib/lines.py", line
740, in _draw_dashed
renderer.draw_path(gc, path, trans)
ValueError: Dash sequence must be an even length sequence; found 1
Michael Droettboom wrote:
> [I'm bringing this back to the list. Hope you don't mind.]
>
> I've been doing a lot of non-matplotlib work lately and this fell off my
> radar. Thanks for the reminder.
>
> The patch looks good to me. I'm not concerned about doing all this in
> _get_handles as opposed to Legend.__init__. I actually think it's
> better in _get_handles because then it's more connected to the creation
> of the handles themselves. (And of course _get_handles is only ever
> called from __init__ anyway, so it really is just an organizational
> extension of __init__). I moved all references to _xdata to
> _get_handles to be consistent.
>
> The one concern I had is that _xdata is being stored as a member
> variable, which implicitly assumes that it will be the same for all
> handles. After your patch, it can be different for each handle -- for
> instance a line made of markers vs. dashing. So I've just made it a
> local variable to _get_handles and recreate it separately for each
> handle. There's no reason to try to share something so small, and it
> just feels safer (fewer potential side effects) that way.
>
> I've committed this in r4871. Please check it out and kick the tires
> with all the test cases you came up with along the way and let me know
> how it goes.
>
> Cheers,
> Mike
>
> Paul Novak wrote:
>> Mike,
>>
>> Thank you for handling the PS backend issues. Below is an email I sent
>> earlier about an updated patch for fixing legends with numpoints=1; I
>> didn't get any response probably because of my delay in responding. If
>> I should restart this thread on the mailing list, I can.
>>
>> Included below is an updated patch fixing the legend with numpoints=1.
>> The patch has been made against SVN and works for Line2D,
>> LineCollection, Patch, and RegularPolyCollection. The patch could be
>> merged.
>>
>> I also think the patch could be improved. Currently, handle._marker is
>> examined to determine if the legend should contain lines or symbols,
>> but this is done in the _get_handles function. It would be better if
>> that could be moved into the Legend class definition, however, I do
>> not know how to examine handle._marker in the Legend class definition.
>>
>> Again, I would appreciate any comments or improvements.
>>
>> Thanks,
>>
>> Paul
>>
>> diff -u a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py
>> --- a/lib/matplotlib/legend.py 2008-01-09 13:11:00.000000000 -0600
>> +++ b/lib/matplotlib/legend.py 2008-01-09 13:08:36.000000000 -0600
>> @@ -175,9 +175,7 @@
>> # make a trial box in the middle of the axes. relocate it
>> # based on it's bbox
>> left, top = 0.5, 0.5
>> - if self.numpoints == 1:
>> - self._xdata = npy.array([left + self.handlelen*0.5])
>> - else:
>> + if self.numpoints > 1:
>> self._xdata = npy.linspace(left, left + self.handlelen,
>> self.numpoints)
>> textleft = left+ self.handlelen+self.handletextsep
>> self.texts = self._get_texts(labels, textleft, top)
>> @@ -236,6 +234,7 @@
>>
>> def _get_handles(self, handles, texts):
>> HEIGHT = self._approx_text_height()
>> + left = 0.5
>>
>> ret = [] # the returned legend lines
>>
>> @@ -243,6 +242,10 @@
>> x, y = label.get_position()
>> x -= self.handlelen + self.handletextsep
>> if isinstance(handle, Line2D):
>> + if self.numpoints == 1 and handle._marker == 'None':
>> + self._xdata = npy.linspace(left, left +
>> self.handlelen, 2)
>> + elif self.numpoints == 1:
>> + self._xdata = npy.array([left + self.handlelen*0.5])
>> ydata = (y-HEIGHT/2)*npy.ones(self._xdata.shape, float)
>> legline = Line2D(self._xdata, ydata)
>> legline.update_from(handle)
>> @@ -253,7 +256,8 @@
>>
>> ret.append(legline)
>> elif isinstance(handle, Patch):
>> -
>> + if self.numpoints == 1:
>> + self._xdata = npy.linspace(left, left +
>> self.handlelen, 2)
>> p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT),
>> width = self.handlelen, height=HEIGHT/2,
>> )
>> @@ -263,6 +267,8 @@
>> p.set_clip_path(None)
>> ret.append(p)
>> elif isinstance(handle, LineCollection):
>> + if self.numpoints == 1:
>> + self._xdata = npy.linspace(left, left +
>> self.handlelen, 2)
>> ydata = (y-HEIGHT/2)*npy.ones(self._xdata.shape, float)
>> legline = Line2D(self._xdata, ydata)
>> self._set_artist_props(legline)
>> @@ -277,6 +283,8 @@
>> ret.append(legline)
>>
>> elif isinstance(handle, RegularPolyCollection):
>> + if self.numpoints == 1:
>> + self._xdata = npy.array([left])
>> p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT),
>> width = self.handlelen, height=HEIGHT/2,
>> )
>>
>>
>>
>> Michael Droettboom wrote:
>>> 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
>>>>>
>>>
>
|
|
From: Michael D. <md...@st...> - 2008-01-15 20:54:28
|
[I'm bringing this back to the list. Hope you don't mind.]
I've been doing a lot of non-matplotlib work lately and this fell off my
radar. Thanks for the reminder.
The patch looks good to me. I'm not concerned about doing all this in
_get_handles as opposed to Legend.__init__. I actually think it's
better in _get_handles because then it's more connected to the creation
of the handles themselves. (And of course _get_handles is only ever
called from __init__ anyway, so it really is just an organizational
extension of __init__). I moved all references to _xdata to
_get_handles to be consistent.
The one concern I had is that _xdata is being stored as a member
variable, which implicitly assumes that it will be the same for all
handles. After your patch, it can be different for each handle -- for
instance a line made of markers vs. dashing. So I've just made it a
local variable to _get_handles and recreate it separately for each
handle. There's no reason to try to share something so small, and it
just feels safer (fewer potential side effects) that way.
I've committed this in r4871. Please check it out and kick the tires
with all the test cases you came up with along the way and let me know
how it goes.
Cheers,
Mike
Paul Novak wrote:
> Mike,
>
> Thank you for handling the PS backend issues. Below is an email I sent
> earlier about an updated patch for fixing legends with numpoints=1; I
> didn't get any response probably because of my delay in responding. If I
> should restart this thread on the mailing list, I can.
>
> Included below is an updated patch fixing the legend with numpoints=1.
> The patch has been made against SVN and works for Line2D,
> LineCollection, Patch, and RegularPolyCollection. The patch could be
> merged.
>
> I also think the patch could be improved. Currently, handle._marker is
> examined to determine if the legend should contain lines or symbols, but
> this is done in the _get_handles function. It would be better if that
> could be moved into the Legend class definition, however, I do not know
> how to examine handle._marker in the Legend class definition.
>
> Again, I would appreciate any comments or improvements.
>
> Thanks,
>
> Paul
>
> diff -u a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py
> --- a/lib/matplotlib/legend.py 2008-01-09 13:11:00.000000000 -0600
> +++ b/lib/matplotlib/legend.py 2008-01-09 13:08:36.000000000 -0600
> @@ -175,9 +175,7 @@
> # make a trial box in the middle of the axes. relocate it
> # based on it's bbox
> left, top = 0.5, 0.5
> - if self.numpoints == 1:
> - self._xdata = npy.array([left + self.handlelen*0.5])
> - else:
> + if self.numpoints > 1:
> self._xdata = npy.linspace(left, left + self.handlelen,
> self.numpoints)
> textleft = left+ self.handlelen+self.handletextsep
> self.texts = self._get_texts(labels, textleft, top)
> @@ -236,6 +234,7 @@
>
> def _get_handles(self, handles, texts):
> HEIGHT = self._approx_text_height()
> + left = 0.5
>
> ret = [] # the returned legend lines
>
> @@ -243,6 +242,10 @@
> x, y = label.get_position()
> x -= self.handlelen + self.handletextsep
> if isinstance(handle, Line2D):
> + if self.numpoints == 1 and handle._marker == 'None':
> + self._xdata = npy.linspace(left, left +
> self.handlelen, 2)
> + elif self.numpoints == 1:
> + self._xdata = npy.array([left + self.handlelen*0.5])
> ydata = (y-HEIGHT/2)*npy.ones(self._xdata.shape, float)
> legline = Line2D(self._xdata, ydata)
> legline.update_from(handle)
> @@ -253,7 +256,8 @@
>
> ret.append(legline)
> elif isinstance(handle, Patch):
> -
> + if self.numpoints == 1:
> + self._xdata = npy.linspace(left, left +
> self.handlelen, 2)
> p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT),
> width = self.handlelen, height=HEIGHT/2,
> )
> @@ -263,6 +267,8 @@
> p.set_clip_path(None)
> ret.append(p)
> elif isinstance(handle, LineCollection):
> + if self.numpoints == 1:
> + self._xdata = npy.linspace(left, left +
> self.handlelen, 2)
> ydata = (y-HEIGHT/2)*npy.ones(self._xdata.shape, float)
> legline = Line2D(self._xdata, ydata)
> self._set_artist_props(legline)
> @@ -277,6 +283,8 @@
> ret.append(legline)
>
> elif isinstance(handle, RegularPolyCollection):
> + if self.numpoints == 1:
> + self._xdata = npy.array([left])
> p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT),
> width = self.handlelen, height=HEIGHT/2,
> )
>
>
>
> Michael Droettboom wrote:
>> 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: 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
|
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
|
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 |