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
(2) |
2
(1) |
|
3
(17) |
4
(9) |
5
(2) |
6
(5) |
7
(8) |
8
(11) |
9
(6) |
|
10
(6) |
11
(21) |
12
(21) |
13
(17) |
14
(25) |
15
(15) |
16
(2) |
|
17
|
18
(9) |
19
(22) |
20
(25) |
21
(31) |
22
(19) |
23
(2) |
|
24
(5) |
25
(19) |
26
(10) |
27
(13) |
28
(14) |
29
(20) |
30
(5) |
|
31
(9) |
|
|
|
|
|
|
|
From: Jeff W. <js...@fa...> - 2010-01-11 16:12:35
|
Gökhan Sever wrote:
>
>
> On Mon, Jan 11, 2010 at 6:51 AM, Jeff Whitaker <js...@fa...
> <mailto:js...@fa...>> wrote:
>
> Gökhan Sever wrote:
>
> Hello,
>
> Is there a way to color words differently in a label or title,
> for example:
>
> ylabel("measurement 1 (in red color)" , "measurement 2 (in
> blue color)") to match with the plotted line colors?
>
> Thanks.
>
> --
> Gökhan
>
> Gökhan:
>
> ylabel('measurement 1',color='r')
> ylabel('measurement 2',color='b')
>
>
> -Jeff
>
>
> In this fashion the second call replaces the first text. What I want
> is two words next to each other and in different colors.
>
> --
> Gökhan
Gökhan: Then I think you'll have to go with the TeX solution (i..e
\color{red}{Red text goes here} \color{blue}{Blue text goes here}). -
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-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
|
|
From: Chris S. <chr...@gm...> - 2010-01-11 14:54:17
|
I wanted to display my figure legend below my figure in the second row, so I used subplot(211) to create two rows. However, this creates two rows of equal height, so my graph is crammed into half the figure height in the first row, while my tiny legend barely fills up any of the second row. How do you specify relative heights of each row? For example, I'd like to specify the first row takes 80% of the figure height, while the second takes 20%. I've searched the docs, but I can't find anything. Is this possible? Regards, Chris |
|
From: John R. <j....@ma...> - 2010-01-11 13:51:57
|
Hi,
I'm using matplotlib 0.98.5.2 on Ubuntu with Ghostscript 8.70. The
following code produces the following error. Can anyone verify whether
this a problem with my installation or with matplotlib?
import pylab as P
P.figure()
width=.4
x1 = [-0.4, 0.6, 1.6, 2.6, 3.6, 4.6, 5.6]
y1 = [1.0, 0.96875, 0.77584381616639686, 0.54678532728659146,
0.4043846450263317, 0.28361561411668612, 1.0]
x2 = [0, 1, 2, 3, 4, 5, 6]
y2 = [1.0, 0.97032301818547173, 0.77110383361936519,
0.54221305796207875, 0.40019201884735922, 0.28326596333427007, 1.0]
P.bar(x1, y1, color='blue' , width=width, label='nodes')
P.bar(x2, y2, color='green', width=width, label='occurrences')
P.savefig('fraction-evaluated.eps')
P.close()
/home/john/Dev/MyProjects/Bio/MotifSearch/python/stem.py in <module>()
246 P.bar(x1, y1, color='blue' , width=width, label='nodes')
247 P.bar(x2, y2, color='green', width=width, label='occurrences')
--> 248 P.savefig('fraction-evaluated.eps')
249 P.close()
250 raise
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/pyplot.pyc
in savefig(*args, **kwargs)
343 def savefig(*args, **kwargs):
344 fig = gcf()
--> 345 return fig.savefig(*args, **kwargs)
346 if Figure.savefig.__doc__ is not None:
347 savefig.__doc__ = dedent(Figure.savefig.__doc__)
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/figure.pyc
in savefig(self, *args, **kwargs)
988 patch.set_alpha(0.0)
989
--> 990 self.canvas.print_figure(*args, **kwargs)
991
992 if transparent:
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_wxagg.pyc
in print_figure(self, filename, *args, **kwargs)
99 def print_figure(self, filename, *args, **kwargs):
100 # Use pure Agg renderer to draw
--> 101 FigureCanvasAgg.print_figure(self, filename, *args,
**kwargs)
102 # Restore the current view; this is needed because the
103 # artist contains methods rely on particular attributes
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
format, **kwargs)
1417 edgecolor=edgecolor,
1418 orientation=orientation,
-> 1419 **kwargs)
1420 finally:
1421 self.figure.dpi = origDPI
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backend_bases.pyc
in print_eps(self, *args, **kwargs)
1306 from backends.backend_ps import FigureCanvasPS # lazy
import
1307 ps = self.switch_backends(FigureCanvasPS)
-> 1308 return ps.print_eps(*args, **kwargs)
1309
1310 def print_pdf(self, *args, **kwargs):
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in print_eps(self, outfile, *args, **kwargs)
867
868 def print_eps(self, outfile, *args, **kwargs):
--> 869 return self._print_ps(outfile, 'eps', *args, **kwargs)
870
871 def _print_ps(self, outfile, format, *args, **kwargs):
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in _print_ps(self, outfile, format, *args, **kwargs)
893 else:
894 self._print_figure(outfile, format, imagedpi,
facecolor, edgecolor,
--> 895 orientation, isLandscape, papertype)
896
897 def _print_figure(self, outfile, format, dpi=72,
facecolor='w', edgecolor='w',
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in _print_figure(self, outfile, format, dpi, facecolor, edgecolor,
orientation, isLandscape, papertype)
1036 gs_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox)
1037 elif rcParams['ps.usedistiller'] == 'xpdf':
-> 1038 xpdf_distill(tmpfile, isEPSF, ptype=papertype,
bbox=bbox)
1039
1040 if passed_in_file_object:
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in xpdf_distill(tmpfile, eps, ptype, bbox)
1311 shutil.move(psfile, tmpfile)
1312 if eps:
-> 1313 pstoeps(tmpfile, bbox)
1314 for fname in glob.glob(tmpfile+'.*'):
1315 os.remove(fname)
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in pstoeps(tmpfile, bbox)
1362 Convert the postscript to encapsulated postscript.
1363 """
-> 1364 bbox_info = get_bbox(tmpfile, bbox)
1365
1366 epsfile = tmpfile + '.eps'
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.pyc
in get_bbox(tmpfile, bbox)
1336 else:
1337 raise RuntimeError('Ghostscript was not able to extract
a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]
1340
RuntimeError: Ghostscript was not able to extract a bounding box.Here is
the Ghostscript output:
GPL Ghostscript 8.70: Unrecoverable error, exit code 1
>
/usr/lib/python2.5/site-packages/matplotlib-0.98.5.2-py2.5-linux-x86_64.egg/matplotlib/backends/backend_ps.py(1338)get_bbox()
1337 raise RuntimeError('Ghostscript was not able to extract
a bounding box.\
-> 1338 Here is the Ghostscript output:\n\n%s'% bbox_info)
1339 l, b, r, t = [float(i) for i in bbox_info.split()[-4:]]
|
|
From: Jeff W. <js...@fa...> - 2010-01-11 12:51:36
|
Gökhan Sever wrote:
> Hello,
>
> Is there a way to color words differently in a label or title, for
> example:
>
> ylabel("measurement 1 (in red color)" , "measurement 2 (in blue
> color)") to match with the plotted line colors?
>
> Thanks.
>
> --
> Gökhan
Gökhan:
ylabel('measurement 1',color='r')
ylabel('measurement 2',color='b')
-Jeff
|
|
From: Damon M. <D.M...@wa...> - 2010-01-11 10:37:07
|
Hi Gökhan,
Do you have usetex=True set? If so, have you tried the LaTeX command sequence \color{red}{Red text goes here} ?
Regards,
-- Damon
--------------------------
Damon McDougall
Mathematics Institute
University of Warwick
Coventry
CV4 7AL
d.m...@wa...
On 11 Jan 2010, at 05:48, Gökhan Sever wrote:
> Hello,
>
> Is there a way to color words differently in a label or title, for example:
>
> ylabel("measurement 1 (in red color)" , "measurement 2 (in blue color)") to match with the plotted line colors?
>
> Thanks.
>
> --
> Gökhan
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Gökhan S. <gok...@gm...> - 2010-01-11 05:48:43
|
Hello,
Is there a way to color words differently in a label or title, for example:
ylabel("measurement 1 (in red color)" , "measurement 2 (in blue color)") to
match with the plotted line colors?
Thanks.
--
Gökhan
|
|
From: Burly C. <bu...@mt...> - 2010-01-10 23:13:48
|
Hi, 0.99 I've just re-tested with 0.99.1 and found it works fine.. b. On 8 Jan 2010, at 18:34, Jae-Joon Lee wrote: > What version of matplotlib are you using? > This may be the bug that already have been fixed. > Neither with the maintenance branch nor the current svn reproduce this problem, > as can be easily seen from the gallery > > http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html > > -JJ > > > On Thu, Jan 7, 2010 at 5:16 AM, Burly Cumberland <bu...@mt...> wrote: >> Hi, >> >> I've been playing around with the parasite_axes toolkit. It's very nice but >> I discovered from the example that I always get an extra set of x and y axis >> labels. See attached png. I've got around this by simply turning the first >> axis off. Is this a bug in the code or the example? Also there appears to be >> an additional set of axis label commands in the example. >> >> From demo_parasite_axes2.py >> ---------------------------------------------------------------------- >> >> from mpl_toolkits.axes_grid.parasite_axes import SubplotHost >> import matplotlib.pyplot as plt >> >> if 1: >> fig = plt.figure(1) >> plt.axis('off') # Extra line to remove unwanted axis labels >> host = SubplotHost(fig, 111) >> >> host.set_ylabel("Density") >> host.set_xlabel("Distance") >> >> par1 = host.twinx() >> par2 = host.twinx() >> >> par1.set_ylabel("Temperature") >> >> par2.axis["right"].set_visible(False) >> >> offset = 60, 0 >> new_axisline = par2.get_grid_helper().new_fixed_axis >> par2.axis["right2"] = new_axisline(loc="right", >> axes=par2, >> offset=offset) >> >> par2.axis["right2"].label.set_visible(True) >> par2.axis["right2"].set_label("Velocity") >> >> fig.add_axes(host) >> plt.subplots_adjust(right=0.75) >> >> host.set_xlim(0, 2) >> host.set_ylim(0, 2) >> >> host.set_xlabel("Distance") # Why reset these three labels.. >> host.set_ylabel("Density") >> par1.set_ylabel("Temperature") >> >> p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density") >> p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature") >> p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity") >> >> par1.set_ylim(0, 4) >> par2.set_ylim(1, 65) >> >> host.legend() >> >> host.axis["left"].label.set_color(p1.get_color()) >> par1.axis["right"].label.set_color(p2.get_color()) >> par2.axis["right2"].label.set_color(p3.get_color()) >> >> plt.draw() >> plt.show() >> >> ------------------------------------------------------------------------------ >> This SF.Net email is sponsored by the Verizon Developer Community >> Take advantage of Verizon's best-in-class app development support >> A streamlined, 14 day to market process makes app distribution fast and easy >> Join now and get one step closer to millions of Verizon customers >> http://p.sf.net/sfu/verizon-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> |
|
From: Gael V. <gae...@no...> - 2010-01-10 15:57:13
|
On Sun, Jan 10, 2010 at 07:54:18AM -0800, Andrew Straw wrote: > > Any interest in merging this in as an mpl_toolkit? > It already is. :) Me dig hole and hide. > Any interest in writing docs and advertising it? Well, first I'll use it :). I can advertise if I and up using it a lot. Gaël |
|
From: Andrew S. <str...@as...> - 2010-01-10 15:54:25
|
Gael Varoquaux wrote: > On Sun, Jan 10, 2010 at 07:32:27AM -0800, Andrew Straw wrote: > >> This first is mplsizer, based on the wx layout model, and works "live" >> (with a figure open in a GUI) as well as for saving to disk. See the >> demo directory for, well, some demos. I haven't been using this too much >> lately, but it still works as well as it ever did AFAIK. There is a >> trivial bit of documentation and a copy of the source at >> http://github.com/astraw/mplsizer >> > > Any interest in merging this in as an mpl_toolkit? > > It already is. :) Any interest in writing docs and advertising it? |
|
From: Gael V. <gae...@no...> - 2010-01-10 15:46:04
|
On Sun, Jan 10, 2010 at 07:32:27AM -0800, Andrew Straw wrote: > This first is mplsizer, based on the wx layout model, and works "live" > (with a figure open in a GUI) as well as for saving to disk. See the > demo directory for, well, some demos. I haven't been using this too much > lately, but it still works as well as it ever did AFAIK. There is a > trivial bit of documentation and a copy of the source at > http://github.com/astraw/mplsizer Any interest in merging this in as an mpl_toolkit? Gaël |
|
From: Andrew S. <str...@as...> - 2010-01-10 15:32:36
|
per freem wrote: > hi all, > > i am a *huge fan* of matplotlib and use it for all plotting. one > feature that i would find extremely useful that i believe is missing > (but am very open to being corrected in case i overlooked something) > is a way to define the layout of complex subplots. by this i mean > something like R's "layout" command, which allows you to nearly > arbitrarily arrange the subplots of a figure. this command is much > more general than "subplot" since it does not restrict you to square > arrangements of figure subplots. > > for examples, check out these figures/examples: > > 1. source code of complex layout: > http://rgraphics.limnology.wisc.edu/rmargins_layout.php > (the associated graph it produces is here: > http://rgraphics.limnology.wisc.edu/images/layouts/rmargins_layout_thumb.png) > > 2. a tutorial on complex layouts with this command: > http://www.statmethods.net/advgraphs/layout.html > in particular, see: > http://www.statmethods.net/advgraphs/images/layout3a.png where a > complex layout which is currently not possible with "subplot" is made. > > a command like R's layout would be a tremendously helpful addition to > matplotlib, in my opinion. it will prevent the need for annoying > manual "postprocessing" of figures into these layouts using tools like > Illustrator, since these figures could be generated programmatically > instead, which much more precision. > > as far as i know, this cannot be done in matplotlib right now, without > plotting your own axes (using some combination of axes grid toolkit > and raw axes plotting.) > > if anyone out there has written some kind of wrappers that do > something like the "layout" command, i would love to know about it. if > it's still in testing and not part of the current matplotlib, i'd be > more than happy to beta test this for anyone and try it on many > examples. > Hi Per, I wrote two things that may be of interest to you. This first is mplsizer, based on the wx layout model, and works "live" (with a figure open in a GUI) as well as for saving to disk. See the demo directory for, well, some demos. I haven't been using this too much lately, but it still works as well as it ever did AFAIK. There is a trivial bit of documentation and a copy of the source at http://github.com/astraw/mplsizer The second is svg_stack. This is used as a post-processing step that requires saving my figures as svg files and then composing them with this tool. There is some minimal documentation and the source at http://github.com/astraw/svg_stack . The nice thing with svg_stack is that you can use svg files from other sources (i.e. not just matplotlib). Also, everything can be manually adjusted in Inkscape, which itself has nice command-line export to .png and .pdf capabilities. -Andrew |
|
From: per f. <per...@gm...> - 2010-01-10 00:05:20
|
hi all, i am a *huge fan* of matplotlib and use it for all plotting. one feature that i would find extremely useful that i believe is missing (but am very open to being corrected in case i overlooked something) is a way to define the layout of complex subplots. by this i mean something like R's "layout" command, which allows you to nearly arbitrarily arrange the subplots of a figure. this command is much more general than "subplot" since it does not restrict you to square arrangements of figure subplots. for examples, check out these figures/examples: 1. source code of complex layout: http://rgraphics.limnology.wisc.edu/rmargins_layout.php (the associated graph it produces is here: http://rgraphics.limnology.wisc.edu/images/layouts/rmargins_layout_thumb.png) 2. a tutorial on complex layouts with this command: http://www.statmethods.net/advgraphs/layout.html in particular, see: http://www.statmethods.net/advgraphs/images/layout3a.png where a complex layout which is currently not possible with "subplot" is made. a command like R's layout would be a tremendously helpful addition to matplotlib, in my opinion. it will prevent the need for annoying manual "postprocessing" of figures into these layouts using tools like Illustrator, since these figures could be generated programmatically instead, which much more precision. as far as i know, this cannot be done in matplotlib right now, without plotting your own axes (using some combination of axes grid toolkit and raw axes plotting.) if anyone out there has written some kind of wrappers that do something like the "layout" command, i would love to know about it. if it's still in testing and not part of the current matplotlib, i'd be more than happy to beta test this for anyone and try it on many examples. thanks very much for your help. |
|
From: Dominik S. <do...@it...> - 2010-01-09 21:28:04
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 When using white over back color scheme the legend() is unreadable, with apparently hard-coded white legend background - or is there a way to set it in the rc file? Dominik -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAktI9NEACgkQ/EBMh9bUuzKvHgCg7HZbBpA+vMdLcCzfVvZcyARq JlsAnRGSuYMa0GXVnIG6M3RHrXGSOtQL =FlrY -----END PGP SIGNATURE----- |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-09 14:26:57
|
On Sat, Jan 9, 2010 at 8:20 AM, Eric Emsellem <eem...@es...> wrote: > Hi > thanks A LOT for taking the time to test this and for the suggestions. > > Yes, pcolormesh is needed (or at least I think) because in the "real" > example (the figures I am trying to make) the pixels are rotated meaning > that these are polygons which are not aligned with the axes. Imshow > cannot do that as far as I can tell because it shows a rectangular grid > (masked or not) aligned with the axis. > imshow in the current release does not support rotation. However, imshow in the svn DOES support rotation (or any affine transform), but for ps backend only. Here is a relevant thread. So take a look if you're interested. http://old.nabble.com/imshow-without-resampling-in-the-ps-backend.-tt26805182.html#a26805182 > > Never used rasterization before... > (and thanks for pointing out the mistake on map3, this came after > adapting the script for this post). I guess this means you transform it > into a resolution dependent figure. I can try it but I am afraid this > will look quite bad. > Yes, but only images. Other artists (lines, texts, etc.) will be in the vector format. As a matter of fact, images in matplotlib are always rasterized internally (only exception is the ps backend in the svn). So, the result will not be much different. Also, you can increase the dpi of the output if you think output quality is poor. Regards, -JJ |
|
From: Eric E. <eem...@es...> - 2010-01-09 13:23:07
|
Thinking about it: when matplotlib transfer the plot to ghostscript, is there a parameter in the call for "gs" which limits the memory usage??? It seems that this is discussed in some posts about gs Eric On 09/01/10 04:25, Jae-Joon Lee wrote: > I can reproduce this error with the current svn. > > I doubt if this is a matplotlib issue, because it works fine if the > number of axes is small. > To me, it seems as some memory error in the ghostscript, but my quick > googling did not show any relevant information. > So, I hope some postscript expert take a look at the issue |
|
From: Eric E. <eem...@es...> - 2010-01-09 13:19:04
|
Hi
thanks A LOT for taking the time to test this and for the suggestions.
Yes, pcolormesh is needed (or at least I think) because in the "real"
example (the figures I am trying to make) the pixels are rotated meaning
that these are polygons which are not aligned with the axes. Imshow
cannot do that as far as I can tell because it shows a rectangular grid
(masked or not) aligned with the axis.
It seems indeed linked with the number of plots/memory. I have tested
this now and looked for when it crashes, Limiting the number of rows to
1, 2 , 3 etc. With 3 rows (9 plots) it works. But it crashes when I
include 4 rows. Looking at a "top" and memory usage, it is clearly a pb
with ghostscript when it takes over to transform it into the eps. Here
is the line from the "top" when it crashes:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5980 emsellem 20 0 167m 88m 4352 R 100 2.3 0:54.45 gs
When gs go over ~170m, it crashes. Not clue why. I have ample memory
left (2Gb RAM, 2Gb Swap) and no pb of disk space.
As for the workarounds: yes I did a pdf2ps already for one urgent figure
I had to get. I just hoped that I wouldn't have to do that for all my
figures.
Never used rasterization before...
(and thanks for pointing out the mistake on map3, this came after
adapting the script for this post). I guess this means you transform it
into a resolution dependent figure. I can try it but I am afraid this
will look quite bad.
cheers
Eric
On 09/01/10 04:25, Jae-Joon Lee wrote:
> I can reproduce this error with the current svn.
>
> I doubt if this is a matplotlib issue, because it works fine if the
> number of axes is small.
> To me, it seems as some memory error in the ghostscript, but my quick
> googling did not show any relevant information.
> So, I hope some postscript expert take a look at the issue.
>
> However, note that pcolormesh in backends other than agg is extremely
> inefficient, and I strongly discourage its use in other backends.
> Your current example could be much efficient if you simply can use
> imshow. Do you have to use pcolormesh? Your current example seems to
> be easily convertible to imshow, but you original example may not.
>
> In case the use of pcolormesh is not avoidable, I can think of two workarounds.
>
> 1) save as pdf first then convert to eps. Saving as pdf will take as
> much time as saving as ps.
>
> 2) Save as eps but rasterize the pcolormesh plots. This is my choice
> and saving time is also not very long. As a matter of fact, whenever
> pcolormesh is used, I strongly recommend to consider rasterizing it.
>
> For your current script, you may add something like below at the end
> of your for-loop.
>
> map1.set_zorder(0.5)
> map2.set_zorder(0.5)
> map3.set_zorder(0.5)
> ax1.set_rasterization_zorder(0.6)
> ax2.set_rasterization_zorder(0.6)
> ax3.set_rasterization_zorder(0.6)
>
> This code needs to be inside the for-loop so that all the pcolormesh
> plots get rasterized.
> Also, note that, in your current script, the third pcolormesh plot is
> assigned to "map2", instead of "map3", so you need to fix this first.
--
=================================================================
Eric Emsellem European Southern Observatory
Karl-Schwarzschild Str. 2
e-mail: eem...@es... 85748 Garching bei Muenchen
tel: +49 (0)89 3200 6914 Germany
fax: +49 (0)89 3200 6480
=================================================================
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-09 03:26:11
|
I can reproduce this error with the current svn.
I doubt if this is a matplotlib issue, because it works fine if the
number of axes is small.
To me, it seems as some memory error in the ghostscript, but my quick
googling did not show any relevant information.
So, I hope some postscript expert take a look at the issue.
However, note that pcolormesh in backends other than agg is extremely
inefficient, and I strongly discourage its use in other backends.
Your current example could be much efficient if you simply can use
imshow. Do you have to use pcolormesh? Your current example seems to
be easily convertible to imshow, but you original example may not.
In case the use of pcolormesh is not avoidable, I can think of two workarounds.
1) save as pdf first then convert to eps. Saving as pdf will take as
much time as saving as ps.
2) Save as eps but rasterize the pcolormesh plots. This is my choice
and saving time is also not very long. As a matter of fact, whenever
pcolormesh is used, I strongly recommend to consider rasterizing it.
For your current script, you may add something like below at the end
of your for-loop.
map1.set_zorder(0.5)
map2.set_zorder(0.5)
map3.set_zorder(0.5)
ax1.set_rasterization_zorder(0.6)
ax2.set_rasterization_zorder(0.6)
ax3.set_rasterization_zorder(0.6)
This code needs to be inside the for-loop so that all the pcolormesh
plots get rasterized.
Also, note that, in your current script, the third pcolormesh plot is
assigned to "map2", instead of "map3", so you need to fix this first.
Regards,
-JJ
On Thu, Jan 7, 2010 at 11:17 AM, Eric Emsellem <eem...@es...> wrote:
> Hi
>
> I finally managed to write a simplified version of my python script
> which crashes when trying to save the figure as a postscript file. (this
> is related to a previous post). See below. The script is provided, as
> well as the full error message.
>
> Sorry for the long script, but basically I am plotting 3x7 arrays via
> pcolormesh. The script looks pretty dum because it was adapted from a
> more complicated one where the bins/pixels are not exactly squared and
> are rotated. In the version below I have tried to remove the unncessary
> complication. And I get a failure from ghostscript when I try to save it
> as eps. It works when I save it as a png.
>
> Can anyone tell me what's wrong there? Again I am using:
>
> ### On an OpenSuse 11.2, 64b
> xpdf distiller (but I tried others).
> matplotlib 0.99.1.1
> backend WXAgg version 2.8.10.1
> Python 2.6.2 (r262:71600, Oct 24 2009, 03:15:21)
> IPython 0.10 -- An enhanced Interactive Python.
>
>
> THANKS
> Eric
> ====================================================================
>
> ######################################################################
> # Script to run which crashes when saving the figure as an eps file
> ######################################################################
> #!/usr/bin/python
> import numpy as num
> import pylab as pl
>
> def pos(i,j, w, h) :
> return [0.05+ j*(w+0.02), 0.99 - (i+1)*(h+0.023)+0.025, w, h]
>
>
> ## Opening the figure
> ## Figure
> pl.figure(1, figsize=(5*1.2, 7*1.5))
> fig = pl.gcf()
> pl.clf()
>
> ## Size of figure
> figH = fig.get_figheight()
> figW = fig.get_figwidth()
> w = 0.99 / 3. -0.03
> h = 0.99 / 7 - 0.022
>
> ## List of data to plot (I take 7 times the same stuff)
> listgal = ["1","2","3","4","5","6",",7"]
>
> ## Initialisation of start, end and step
> ngal = len(listgal)
> start = [-30.,-30.]
> end = [30.,30.]
> npix = [80,80]
> x = num.linspace(start[0],end[0], npix[0])
> y = num.linspace(start[1],end[1], npix[1])
> step = [x[1]-x[0], y[1]-y[0]]
> X,Y = num.meshgrid(x,y)
>
> ## Initialisation of data
> data = num.random.random((npix[0], npix[1]))
>
> pl.ioff()
> for k in range(ngal) :
> gal = listgal[k]
>
> ## Coordinates
>
> ## Grid for rotation
> Xp,Yp = X - step[0]/2., Y - step[1]/2.
> X1,Y1 = X+step[0]/2.,Y+step[1]/2.
> X2,Y2 = X-step[0]/2.,Y+step[1]/2.
> X3,Y3 = X-step[0]/2.,Y-step[1]/2.
> X4,Y4 = X+step[0]/2.,Y-step[1]/2.
> minXc = num.min(num.concatenate((X1,X2,X3,X4)))
> maxXc = num.max(num.concatenate((X1,X2,X3,X4)))
> minYc = num.min(num.concatenate((Y1,Y2,Y3,Y4)))
> maxYc = num.max(num.concatenate((Y1,Y2,Y3,Y4)))
> dX = maxXc - minXc
> dY = maxYc - minYc
>
> ## Deriving the right aspect ratio etc
> aspectIma = dX / dY
> aspectFig = figW / figH
> aspectWin = w / h
> if (aspectIma < aspectWin*aspectFig) :
> maxXc = maxXc * aspectFig * aspectWin / aspectIma
> minXc = minXc * aspectFig * aspectWin / aspectIma
> else :
> maxYc = maxYc * aspectIma / (aspectFig * aspectWin)
> minYc = minYc * aspectIma / (aspectFig * aspectWin)
> extentR = minXc, maxXc, minYc, maxYc
>
> cmap = pl.cm.jet
> minI, maxI = 0., 1.
> cmap.set_bad('w',1.0)
> j = 0
> ax1 = fig.add_axes(pos(k,j, w, h))
> map1 = ax1.pcolormesh(Xp,Yp,data,shading='flat',vmin=minI,vmax=maxI,
> cmap=cmap)
> pl.plot([0.],[0.],'k+', markersize=10, lw=3)
> xticklabels = pl.getp(pl.gca(), 'xticklabels')
> pl.setp(xticklabels, fontsize=8)
> yticklabels = pl.getp(pl.gca(), 'yticklabels')
> pl.setp(yticklabels, fontsize=8)
> pl.axis(extentR)
> j += 1
>
> ax2 = fig.add_axes(pos(k,j, w, h))
> map2 = ax2.pcolormesh(Xp,Yp,data,shading='flat',vmin=minI,vmax=maxI,
> cmap=cmap)
> pl.plot([0.],[0.],'k+', markersize=10, lw=3)
> pl.axis(extentR)
> ax2.set_yticks([])
> xticklabels = pl.getp(pl.gca(), 'xticklabels')
> pl.setp(xticklabels, fontsize=8)
> pl.text(0.02,0.96, "%4.0f/%4.0f"%(minI,maxI),
> verticalalignment='top',rotation='vertical',transform = ax2.transAxes,
> fontsize=8)
> j += 1
>
> ax3 = fig.add_axes(pos(k,j, w, h))
> map2 = ax3.pcolormesh(Xp,Yp,data,shading='flat',vmin=0.,vmax=1.,
> cmap=cmap)
> pl.plot([0.],[0.],'k+', markersize=10, lw=3)
> pl.axis(extentR)
> ax3.set_yticks([])
> xticklabels = pl.getp(pl.gca(), 'xticklabels')
> pl.setp(xticklabels, fontsize=8)
> pl.text(0.02,0.96, "%4.0f/%4.0f"%(minI,maxI),
> verticalalignment='top',rotation='vertical',transform = ax3.transAxes,
> fontsize=8)
> j += 1
> pl.text(0.92,0.5, gal,
> rotation='vertical',verticalalignment='center',transform = ax3.transAxes)
>
> k += 1
>
> pl.ion()
> pl.show()
>
> #######################################################################
> ## ERROR MESSAGE WHEN DOING:
> ## savefig("tmp.eps")
> ########################################################################
> savefig("toto.eps")
> Error: /limitcheck in --def--
> Operand stack:
> pa_c2c --nostringval--
> Execution stack:
> %interp_exit .runexec2 --nostringval-- --nostringval--
> --nostringval-- 2 %stopped_push --nostringval-- --nostringval--
> --nostringval-- false 1 %stopped_push 1878 1 3
> %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop
> 1755 1 3 %oparray_pop --nostringval-- %errorexec_pop
> .runexec2 --nostringval-- --nostringval-- --nostringval-- 2
> %stopped_push --nostringval--
>
> Dictionary stack:
>
> --dict:1171/3371(ro)(G)-- --dict:1/20(G)-- --dict:74/200(L)--
> --dict:5/6(ro)(L)-- --dict:179/300(L)-- --dict:44/200(L)--
> --dict:65534/65534(L)--
>
> Current allocation mode is local
>
> Last OS error: 2
>
> Current file position is 14229051
>
> GPL Ghostscript 8.64: Unrecoverable error, exit code 1
>
> ---------------------------------------------------------------------------
>
> RuntimeError Traceback (most recent call
> last)
>
> /science/ATLAS3D/python/Analysis/Try.py in <module>()
> ----> 1
> 2
> 3
> 4
> 5
>
> /usr/lib64/python2.6/site-packages/matplotlib/pyplot.pyc in
> savefig(*args, **kwargs)
> 354 def savefig(*args, **kwargs):
>
> 355 fig = gcf()
>
> --> 356 return fig.savefig(*args, **kwargs)
>
> 357 if Figure.savefig.__doc__ is not None:
>
> 358 savefig.__doc__ = dedent(Figure.savefig.__doc__)
>
>
> /usr/lib64/python2.6/site-packages/matplotlib/figure.pyc in
> savefig(self, *args, **kwargs)
> 1030 patch.set_alpha(0.0)
>
> 1031
>
> -> 1032 self.canvas.print_figure(*args, **kwargs)
>
> 1033
>
> 1034 if transparent:
>
>
> /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_wxagg.pyc
> in print_figure(self, filename, *args, **kwargs)
> 98 def print_figure(self, filename, *args, **kwargs):
>
> 99 # Use pure Agg renderer to draw
>
>
> --> 100 FigureCanvasAgg.print_figure(self, filename, *args,
> **kwargs)
> 101 # Restore the current view; this is needed because the
>
>
> 102 # artist contains methods rely on particular attributes
>
>
> /usr/lib64/python2.6/site-packages/matplotlib/backend_bases.pyc in
> print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
> format, **kwargs)
>
> 1474 orientation=orientation,
>
> 1475 bbox_inches_restore=_bbox_inches_restore,
>
> -> 1476 **kwargs)
>
> 1477 finally:
>
> 1478 if bbox_inches and restore_bbox:
>
>
> /usr/lib64/python2.6/site-packages/matplotlib/backend_bases.pyc in
> print_eps(self, *args, **kwargs)
> 1327 from backends.backend_ps import FigureCanvasPS # lazy
> import
> 1328 ps = self.switch_backends(FigureCanvasPS)
>
> -> 1329 return ps.print_eps(*args, **kwargs)
>
> 1330
>
> 1331 def print_pdf(self, *args, **kwargs):
>
>
> /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in
> print_eps(self, outfile, *args, **kwargs)
> 853
>
> 854 def print_eps(self, outfile, *args, **kwargs):
>
> --> 855 return self._print_ps(outfile, 'eps', *args, **kwargs)
>
> 856
>
> 857
>
>
> /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in
> _print_ps(self, outfile, format, *args, **kwargs)
> 882 self._print_figure_tex(outfile, format, imagedpi,
> facecolor, edgecolor,
> 883 orientation, isLandscape,
> papertype,
> --> 884 **kwargs)
>
> 885 else:
>
> 886 self._print_figure(outfile, format, imagedpi,
> facecolor, edgecolor,
>
> /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in
> _print_figure_tex(self, outfile, format, dpi, facecolor, edgecolor,
> orientation, isLandscape, papertype, **kwargs)
>
> 1188 gs_distill(tmpfile, isEPSF, ptype=papertype,
> bbox=bbox)
> 1189 elif rcParams['ps.usedistiller'] == 'xpdf':
>
> -> 1190 xpdf_distill(tmpfile, isEPSF, ptype=papertype,
> bbox=bbox)
> 1191 elif rcParams['text.usetex']:
>
> 1192 if False: pass # for debugging
>
>
> /usr/lib64/python2.6/site-packages/matplotlib/backends/backend_ps.pyc in
> xpdf_distill(tmpfile, eps, ptype, bbox)
> 1345 fh = file(outfile)
> 1346 if exit_status: raise RuntimeError('ps2pdf was not able to
> process your \
> -> 1347 image.\n\Here is the report generated by ghostscript:\n\n' +
> fh.read())
> 1348 else: verbose.report(fh.read(), 'debug')
> 1349 fh.close()
>
> RuntimeError: ps2pdf was not able to process your image.
> \Here is the report generated by ghostscript:
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-09 02:34:50
|
On Sun, Jan 3, 2010 at 4:30 PM, per freem <per...@gm...> wrote: > is there a way to do this in matplotlib? With subplots, I believe the answer is no. You may try to fiddle with anchor positions of individual subplots, but this will only work for some limited cases. With axes_grid toolkit, yes. -JJ |
|
From: Alan G I. <ala...@gm...> - 2010-01-08 21:21:25
|
On 1/8/2010 3:08 PM, David Arnold wrote: > Does anyone have some Tkinter scripts using matplotlib they can share? You may find the TSPlot and Histogram classes here http://code.google.com/p/econpy/source/browse/trunk/abm/gridworld/gridworld.py to be helpful. fwiw, Alan Isaac |
|
From: David A. <dwa...@su...> - 2010-01-08 20:08:29
|
All, Does anyone have some Tkinter scripts using matplotlib they can share? I am just starting to learn Tkinter and I could use some examples. David Arnold College of the Redwoods Department of Mathematics |
|
From: Charles R. <cha...@gm...> - 2010-01-08 19:53:55
|
Simply beautiful ! Thank's a lot, it's exactly what I wanted. Le vendredi 08 janvier 2010 à 13:08 -0500, Jae-Joon Lee a écrit : > this_annotation.xytext = (event.x, event.y) |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-08 18:40:46
|
This is because "legend" creates a legend only in the current axes. Note that "twinx" creates a separate axes. You need to manually specify which plot items to show in the legend. http://matplotlib.sourceforge.net/users/legend_guide.html Or, you may use axes_grid.parasite_axes which does this job for you (but do not use this toolkit blindly but read the documentation) http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html -JJ On Thu, Jan 7, 2010 at 9:19 AM, Manuel Wittchen <man...@gm...> wrote: > Hi, > > I'm plotting two y-axis with the twinx() command. But when I'm > creating my legend there is only one entry in the legend-box instead > of two. > Here is my code: > > grafik1 = plt.figure() > > ax1 = grafik1.add_subplot(111) > ax1.plot(TIME, BTM, color='red', label='Biomass') > ax1.set_ylabel('Biomass') > > ax2 = ax1.twinx() > ax2.plot(TIME, FLUOR, label='Productivity') > ax2.set_ylabel('Produktivity') > ax2.set_xlabel('Time') > > grafik1_legend = legend(loc=10) > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-08 18:34:58
|
What version of matplotlib are you using? This may be the bug that already have been fixed. Neither with the maintenance branch nor the current svn reproduce this problem, as can be easily seen from the gallery http://matplotlib.sourceforge.net/examples/axes_grid/demo_parasite_axes2.html -JJ On Thu, Jan 7, 2010 at 5:16 AM, Burly Cumberland <bu...@mt...> wrote: > Hi, > > I've been playing around with the parasite_axes toolkit. It's very nice but > I discovered from the example that I always get an extra set of x and y axis > labels. See attached png. I've got around this by simply turning the first > axis off. Is this a bug in the code or the example? Also there appears to be > an additional set of axis label commands in the example. > > From demo_parasite_axes2.py > ---------------------------------------------------------------------- > > from mpl_toolkits.axes_grid.parasite_axes import SubplotHost > import matplotlib.pyplot as plt > > if 1: > fig = plt.figure(1) > plt.axis('off') # Extra line to remove unwanted axis labels > host = SubplotHost(fig, 111) > > host.set_ylabel("Density") > host.set_xlabel("Distance") > > par1 = host.twinx() > par2 = host.twinx() > > par1.set_ylabel("Temperature") > > par2.axis["right"].set_visible(False) > > offset = 60, 0 > new_axisline = par2.get_grid_helper().new_fixed_axis > par2.axis["right2"] = new_axisline(loc="right", > axes=par2, > offset=offset) > > par2.axis["right2"].label.set_visible(True) > par2.axis["right2"].set_label("Velocity") > > fig.add_axes(host) > plt.subplots_adjust(right=0.75) > > host.set_xlim(0, 2) > host.set_ylim(0, 2) > > host.set_xlabel("Distance") # Why reset these three labels.. > host.set_ylabel("Density") > par1.set_ylabel("Temperature") > > p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density") > p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature") > p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity") > > par1.set_ylim(0, 4) > par2.set_ylim(1, 65) > > host.legend() > > host.axis["left"].label.set_color(p1.get_color()) > par1.axis["right"].label.set_color(p2.get_color()) > par2.axis["right2"].label.set_color(p3.get_color()) > > plt.draw() > plt.show() > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-08 18:23:12
|
On Wed, Jan 6, 2010 at 5:50 AM, Gergely Ungvary
<ger...@co...> wrote:
> I guess I'm not
> the only one plotting statistical data with manually specified bins.
Yes, and mpl works fine with manually specified bins.
On the other hand, I don't see why you want to change the widths of
the bar. As far as I can see, that is not the correct representation
of the data.
Anyhow, here is a little example that makes your bars in equal width.
I never used "fixed width" bar so I'm not sure if this is what you
want.
-JJ
aa = np.random.rand(100)
bins = np.array([0., 0.2, 0.3, 0.8, 1.])
p = hist(aa, bins)
rects = p[2]
for r in rects:
r.set_width(0.1)
|
|
From: Jae-Joon L. <lee...@gm...> - 2010-01-08 18:09:14
|
I think the current method names of Annotation class (originally from
the Text class) is a bit confusing.
And this needs to be fixed.
Anyhow, instead of calling set_position method, you need to set the
"xytext" attribute directly.
this_annotation.xytext = (event.x, event.y)
Regards,
-JJ
On Wed, Jan 6, 2010 at 9:49 AM, <cha...@gm...> wrote:
> Dear all,
>
> I have a little problem on understanding how to move an annotation on a
> plot.
>
> My idea is to make a plot where some informations follow the cursor when
> moving on the data, like you can see in plots from piwik (
> http://piwik.org/demo )
>
> In the script in attachment, I can follow the cursor coordinate, change the
> text of the annotation, but I cannot move it.
>
> I tried several things, but none worked.
>
> If you have any advices, I would be very happy.
>
> =============================
> Script : try_move_annotate.py
> =============================
> import numpy
> import matplotlib
> import matplotlib.pyplot as plt
>
> def on_motion(event):
> if event.inaxes:
> print "before setting position : "
> print this_annotation.get_position()
> this_annotation.set_text('coordinate : ' + str(event.x) + ' ' +
> str(event.y))
> this_annotation.set_position((event.x, event.y))
> print "after setting position : "
> print this_annotation.get_position()
> ax.draw_artist(this_annotation)
> plt.draw()
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
>
> ax.plot(range(10), range(10))
> this_annotation = ax.annotate("coordinate : ",
> xy = (100,100),
> xycoords = 'figure pixels',
> horizontalalignment = 'left',
> verticalalignment = 'top',
> fontsize = 20,
> fontweight = 'bold',# animated=True,
> bbox = dict(boxstyle="round", fc='black', ec="0.5", alpha=0.5)
> )
>
> fig.canvas.mpl_connect('motion_notify_event', on_motion)
> plt.show()
> ==========
> END Script
> ==========
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
|