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
(9) |
2
(8) |
3
|
4
(6) |
5
|
6
|
7
(41) |
8
(18) |
9
(25) |
10
(18) |
11
(10) |
12
(13) |
13
(7) |
14
(4) |
15
(12) |
16
(6) |
17
(9) |
18
(7) |
19
(2) |
20
(5) |
21
(7) |
22
(2) |
23
(11) |
24
(11) |
25
(14) |
26
(3) |
27
(3) |
28
(17) |
29
(7) |
30
(16) |
31
(8) |
|
|
From: Jouni K. S. <jk...@ik...> - 2011-03-12 18:48:56
|
Pål Gunnar Ellingsen <pa...@gm...> writes: > I only have a svn version of the repo, but I would like to move to git, but > I get an error when running the code from > http://matplotlib.sourceforge.net/devel/coding_guide.html#using-git > >> git clone --origin svn gi...@gi...:astraw/matplotlib.git That's not the right address, and we should fix the instructions. Clone from the address git://github.com/matplotlib/matplotlib.git Also, my instructions earlier were wrong: all of the gi...@gi... addresses require an ssh key, but you can use git remote add jkseppan git://github.com/jkseppan/matplotlib.git to add my repository as a remote. -- Jouni K. Seppänen http://www.iki.fi/jks |
From: Benjamin R. <ben...@ou...> - 2011-03-12 18:27:13
|
On Saturday, March 12, 2011, Pål Gunnar Ellingsen <pa...@gm...> wrote: > Hi > > I only have a svn version of the repo, but I would like to move to git, but I get an error when running the code from http://matplotlib.sourceforge.net/devel/coding_guide.html#using-git > >> git clone --origin svn gi...@gi...:astraw/matplotlib.git > Cloning into matplotlib... > Permission denied (publickey). > fatal: The remote end hung up unexpectedly > > I tried this on two different computers, but I guess this means that the git repo needs a ssh-key in order to access it? > > Regards > Pål > We need to change that page. The new docs are at matplotlib.github.com. These are still unofficial, but they contain updated info with regards to Git. Ben Root |
From: Pål G. E. <pa...@gm...> - 2011-03-12 17:55:59
|
Hi I only have a svn version of the repo, but I would like to move to git, but I get an error when running the code from http://matplotlib.sourceforge.net/devel/coding_guide.html#using-git > git clone --origin svn gi...@gi...:astraw/matplotlib.git Cloning into matplotlib... Permission denied (publickey). fatal: The remote end hung up unexpectedly I tried this on two different computers, but I guess this means that the git repo needs a ssh-key in order to access it? Regards Pål On 12 March 2011 14:56, Jouni K. Seppänen <jk...@ik...> wrote: > Jouni K. Seppänen <jk...@ik...> writes: > > > Pål Gunnar Ellingsen <pa...@gm...> writes: > > > >> I know there was a post on the mail liste a couple of days ago ( Bug > >> in `dviread.py'), but I'm not sure if this is the same error, which it > >> shouldn't be as I'm using the latest svn revision. > > > > Not the same error - it is showing a warning message generated by the > > workaround to that problem. It looks like your pdftex.map file is > > lacking an entry for cmr12, which doesn't make any sense. > > Indeed your file does have the entry, and using your file on my computer > I cannot reproduce the problem. I pushed a branch on github that adds > some debugging information. Can you try the version of matplotlib that > you can get via the following commands (assuming you already have a > clone of the matplotlib main repository)? > > git remote add jkseppan gi...@gi...:jkseppan/matplotlib.git > git fetch jkseppan > git checkout jkseppan/dviread-bug > > Alternatively, download the file > > > https://github.com/jkseppan/matplotlib/raw/dviread-bug/lib/matplotlib/dviread.py > > and just copy it over your installed dviread.py file (make a backup > first). > > Set verbose to debug-annoying and catch the output in a file; there will > be lots of it, so please email it to me off-list. > > -- > Jouni K. Seppänen > http://www.iki.fi/jks > > > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Thomas R. <tho...@gm...> - 2011-03-12 16:45:44
|
Hi Jae-Joon, Ok, that makes sense - I tried upgrading to 9.0.1 and it looks like there is still an issue: 6204 test_1.eps 34104 test_2.eps Cheers, Tom On Mar 12, 2011, at 11:38 AM, Jae-Joon Lee wrote: > Note that, even with usetex=False, you have a large ps file when > distiller is used . > When usetex=True, the distiller is always used (if distiller=None, > ghostscript is used). > Therefore, my guess is that the large file size is results of > distilling using the ghostscript. > I wonder if this is an issue of gs 9.0 version. > In my installation (gs 8.xx), the original ps file is about 6 M (both > usetex=True and False), and when they are distilled, their size is > reduced down to 4 M. > > I'll try to test gs 9.0 when I get a chance. > Meanwhile, can you try to upgrade to gs 9.01 and see if it changes anything? > > Regards, > > -JJ > > > > On Sat, Mar 12, 2011 at 2:46 AM, Thomas Robitaille > <tho...@gm...> wrote: >> Hi Jae-Joon, >> >> I tried inserting: >> >> mpl.rc('ps', usedistiller=None) >> >> after importing matplotlib, and I get: >> >> $ du -sk *.eps >> 6204 test_1.eps >> 34104 test_2.eps >> >> using 'ghostscript' I get: >> >> $ du -sk *.eps >> 34096 test_1.eps >> 34104 test_2.eps >> >> and using 'xpdf' raises an exception: >> >> File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py", line 1091, in _print_figure >> xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) >> File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py", line 1421, in xpdf_distill >> image.\nHere is the full report generated by pdftops: \n\n' + fh.read()) >> RuntimeError: pdftops was not able to process your image. >> Here is the full report generated by pdftops: >> >> I don't have a matplotlibrc file, and I am using: >> >> Ghostscript: GPL Ghostscript 9.00 (2010-09-14) >> LaTeX: Version 3.1415926-1.40.10 (TeX Live 2009) >> >> and I'm using the latest head from github for matplotlib. >> >> Cheers, >> Tom >> >> On Mar 8, 2011, at 7:31 AM, Jae-Joon Lee wrote: >> >>> With current master at git repo, I cannot reproduce this. >>> Both test_1.eps and test_2.eps are ~4M in size. >>> >>> Can you check if the file size varies significantly with rc parameters >>> ps.usedistiller? >>> I'm not sure how text setting can affect the images. >>> >>> Regards, >>> >>> -JJ >>> >>> >>> >>> On Tue, Mar 1, 2011 at 7:23 AM, Thomas Robitaille >>> <tho...@gm...> wrote: >>>> Hi, >>>> >>>> In the following example: >>>> >>>> --- >>>> >>>> import numpy as np >>>> >>>> import matplotlib as mpl >>>> mpl.use('Agg') >>>> import matplotlib.pyplot as plt >>>> >>>> fig = plt.figure() >>>> ax = fig.add_subplot(1, 1, 1) >>>> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest') >>>> fig.savefig('test_1.eps') >>>> >>>> mpl.rc('text', usetex=True) >>>> >>>> fig = plt.figure() >>>> ax = fig.add_subplot(1, 1, 1) >>>> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest') >>>> fig.savefig('test_2.eps') >>>> >>>> --- >>>> >>>> the file test_2.eps is almost 6 times larger than test_1.eps, and takes much longer to draw. It looks like in the first case, the image is rendered as a bitmap (the way it should be), whereas in the second case each pixel is drawn individually as a polygon. Is this a bug? >>>> >>>> I am using r8988 of matplotlib. >>>> >>>> Thanks for any help! >>>> >>>> Thomas >>>> ------------------------------------------------------------------------------ >>>> Free Software Download: Index, Search & Analyze Logs and other IT data in >>>> Real-Time with Splunk. Collect, index and harness all the fast moving IT data >>>> generated by your applications, servers and devices whether physical, virtual >>>> or in the cloud. Deliver compliance at lower cost and gain new business >>>> insights. http://p.sf.net/sfu/splunk-dev2dev >>>> _______________________________________________ >>>> Matplotlib-users mailing list >>>> Mat...@li... >>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>>> >> >> |
From: Jae-Joon L. <lee...@gm...> - 2011-03-12 16:38:43
|
Note that, even with usetex=False, you have a large ps file when distiller is used . When usetex=True, the distiller is always used (if distiller=None, ghostscript is used). Therefore, my guess is that the large file size is results of distilling using the ghostscript. I wonder if this is an issue of gs 9.0 version. In my installation (gs 8.xx), the original ps file is about 6 M (both usetex=True and False), and when they are distilled, their size is reduced down to 4 M. I'll try to test gs 9.0 when I get a chance. Meanwhile, can you try to upgrade to gs 9.01 and see if it changes anything? Regards, -JJ On Sat, Mar 12, 2011 at 2:46 AM, Thomas Robitaille <tho...@gm...> wrote: > Hi Jae-Joon, > > I tried inserting: > > mpl.rc('ps', usedistiller=None) > > after importing matplotlib, and I get: > > $ du -sk *.eps > 6204 test_1.eps > 34104 test_2.eps > > using 'ghostscript' I get: > > $ du -sk *.eps > 34096 test_1.eps > 34104 test_2.eps > > and using 'xpdf' raises an exception: > > File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py", line 1091, in _print_figure > xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) > File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py", line 1421, in xpdf_distill > image.\nHere is the full report generated by pdftops: \n\n' + fh.read()) > RuntimeError: pdftops was not able to process your image. > Here is the full report generated by pdftops: > > I don't have a matplotlibrc file, and I am using: > > Ghostscript: GPL Ghostscript 9.00 (2010-09-14) > LaTeX: Version 3.1415926-1.40.10 (TeX Live 2009) > > and I'm using the latest head from github for matplotlib. > > Cheers, > Tom > > On Mar 8, 2011, at 7:31 AM, Jae-Joon Lee wrote: > >> With current master at git repo, I cannot reproduce this. >> Both test_1.eps and test_2.eps are ~4M in size. >> >> Can you check if the file size varies significantly with rc parameters >> ps.usedistiller? >> I'm not sure how text setting can affect the images. >> >> Regards, >> >> -JJ >> >> >> >> On Tue, Mar 1, 2011 at 7:23 AM, Thomas Robitaille >> <tho...@gm...> wrote: >>> Hi, >>> >>> In the following example: >>> >>> --- >>> >>> import numpy as np >>> >>> import matplotlib as mpl >>> mpl.use('Agg') >>> import matplotlib.pyplot as plt >>> >>> fig = plt.figure() >>> ax = fig.add_subplot(1, 1, 1) >>> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest') >>> fig.savefig('test_1.eps') >>> >>> mpl.rc('text', usetex=True) >>> >>> fig = plt.figure() >>> ax = fig.add_subplot(1, 1, 1) >>> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest') >>> fig.savefig('test_2.eps') >>> >>> --- >>> >>> the file test_2.eps is almost 6 times larger than test_1.eps, and takes much longer to draw. It looks like in the first case, the image is rendered as a bitmap (the way it should be), whereas in the second case each pixel is drawn individually as a polygon. Is this a bug? >>> >>> I am using r8988 of matplotlib. >>> >>> Thanks for any help! >>> >>> Thomas >>> ------------------------------------------------------------------------------ >>> Free Software Download: Index, Search & Analyze Logs and other IT data in >>> Real-Time with Splunk. Collect, index and harness all the fast moving IT data >>> generated by your applications, servers and devices whether physical, virtual >>> or in the cloud. Deliver compliance at lower cost and gain new business >>> insights. http://p.sf.net/sfu/splunk-dev2dev >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> > > |
From: Jouni K. S. <jk...@ik...> - 2011-03-12 13:56:39
|
Jouni K. Seppänen <jk...@ik...> writes: > Pål Gunnar Ellingsen <pa...@gm...> writes: > >> I know there was a post on the mail liste a couple of days ago ( Bug >> in `dviread.py'), but I'm not sure if this is the same error, which it >> shouldn't be as I'm using the latest svn revision. > > Not the same error - it is showing a warning message generated by the > workaround to that problem. It looks like your pdftex.map file is > lacking an entry for cmr12, which doesn't make any sense. Indeed your file does have the entry, and using your file on my computer I cannot reproduce the problem. I pushed a branch on github that adds some debugging information. Can you try the version of matplotlib that you can get via the following commands (assuming you already have a clone of the matplotlib main repository)? git remote add jkseppan gi...@gi...:jkseppan/matplotlib.git git fetch jkseppan git checkout jkseppan/dviread-bug Alternatively, download the file https://github.com/jkseppan/matplotlib/raw/dviread-bug/lib/matplotlib/dviread.py and just copy it over your installed dviread.py file (make a backup first). Set verbose to debug-annoying and catch the output in a file; there will be lots of it, so please email it to me off-list. -- Jouni K. Seppänen http://www.iki.fi/jks |
From: Søren N. <sor...@gm...> - 2011-03-12 04:24:38
|
Thanks for info Goyo and Ben! 2011/3/11 Benjamin Root <ben...@ou...> > > > 2011/3/10 Søren Nielsen <sor...@gm...> > >> Hi, >> >> >> When I do an errorbar plot (a.errorbar(), a = axis) with negative values >> and then try to change the yscale to log (a.set_yscale('log')) matplotlib >> crashes with: >> >> Traceback (most recent call last): >> File >> "/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line >> 14636, in <lambda> >> lambda event: event.callable(*event.args, **event.kw) ) >> File "/home/specuser/new_workspace/TestDriven/src/RAWPlot.py", line 371, >> in plotSASM >> line, ec, el = a.errorbar(sasm.q[q_min:q_max], sasm.i[q_min:q_max], >> sasm.err[q_min:q_max], picker = 3, label = legend_label, **kwargs) >> File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 4872, >> in errorbar >> barcols.append( self.vlines(x, lower, upper, **lines_kw) ) >> File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 3302, >> in vlines >> self.autoscale_view() >> File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 1627, >> in autoscale_view >> YL = self.yaxis.get_major_locator().view_limits(y0, y1) >> File "/usr/lib64/python2.6/site-packages/matplotlib/ticker.py", line >> 1119, in view_limits >> if not is_decade(vmin,self._base): vmin = decade_down(vmin,self._base) >> File "/usr/lib64/python2.6/site-packages/matplotlib/ticker.py", line >> 1030, in is_decade >> return lx==int(lx) >> OverflowError: cannot convert float infinity to integer >> Traceback (most recent call last): >> File >> "/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line >> 14636, in <lambda> >> lambda event: event.callable(*event.args, **event.kw) ) >> File "/home/specuser/new_workspace/TestDriven/src/RAW.py", line 1953, in >> addItem >> newItem = ManipItemPanel(self.underpanel, sasm, font_colour = >> item_colour) >> File "/home/specuser/new_workspace/TestDriven/src/RAW.py", line 2353, in >> __init__ >> color = conv.to_rgb(self.sasm.line.get_mfc()) >> AttributeError: 'NoneType' object has no attribute 'get_mfc' >> >> I don't think this should be the expected outcome.. rather it should not >> plot values that are illegal/negative (i.e. ignore them). >> >> Is there a way I can get around this without having to search through my >> data and remove points that are negative or NaN or INF when the yscale needs >> to be log? That would also show an incorrect curve since a line would be >> drawn across the points that were removed.. It should rather be gaps in the >> line. >> >> Thanks, >> Soren >> >> >> >> > Soren, > > This is a bug I encountered recently in my investigations with log scales. > While most projections are handling this properly, there are some cases > where this problem sneaks in. I have not been able to figure out how to > permanently address this issue. > > For reference, the similiar issue is when zooming in on polar plots with > the radial axis in log scale. > > Ben Root > > |
From: John H. <jha...@gm...> - 2011-03-12 03:10:01
|
I have a pygtk application which uses matplotlib for graphics. The application maintains one or more matplotlib.FigureCanvasGTKAgg objects and correspondig matplotlib.figure.Figure objects, and switches between them as needed. My problem is that after switching from one canvas/figure pair to another, the navigation toolbar sometimes loses the ability to switch out of pan/zoom mode, and pick events fail. I get tracebacks like those shown below. Can anyone tell me what "You do not own this lock" means? Or why the axes is trying to delete a property that doesn't exist? John Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py", line 216, in button_release_event FigureCanvasBase.button_release_event(self, x, y, event.button, guiEvent=event) File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1219, in button_release_event self.callbacks.process(s, event) File "/usr/lib/pymodules/python2.6/matplotlib/cbook.py", line 165, in process func(*args, **kwargs) File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 2016, in release_pan a.end_pan() File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 2458, in end_pan del self._pan_start AttributeError: _pan_start Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line 1929, in pan self.canvas.widgetlock.release(self) File "/usr/lib/pymodules/python2.6/matplotlib/widgets.py", line 37, in release raise ValueError('you do not own this lock') ValueError: you do not own this lock |
From: Eric F. <ef...@ha...> - 2011-03-12 03:09:03
|
On 03/11/2011 02:54 PM, onet wrote: > Hi, > > Using matplotlib I try to plot satellite observations, which consists of > roughly one million patches that are not gridded regularly. > I first collect the vertices (corner points of the observations) and > colors and then use PolyCollection and ax.add_collection to add these > patches to the figure. > > On my 64bit Linux machine: > # 518400 patches will use>2Gb of memory > # 1M patches will use> 4Gb of memory > On a 32bit machine the memory is roughly half compared to 64bit. > > My question: how can I plot more efficiently and use less memory? If your data are on a quadrilateral mesh, as in your example, (or can be approximately mapped onto such a mesh) then pcolormesh should be very much more efficient both in time and in memory than making a PolyCollection. Eric > > An example script with random data is below. > > System: > Debian Testing: kernel 2.6.32-5-amd64 x86_64 GNU/Linux > Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) > matplotlib.__version__ = '1.0.0' > > Best regards, > > Onet. > > > > #!/usr/bin/env python > # > # Purpose : Show large use of memory when plotting > # large numbers of patches > # > > import random > > import matplotlib > matplotlib.use('AGG') # produce AGG graphics (o.a. PNG) by default > import matplotlib.pyplot as plt > import matplotlib.colors as colors > from matplotlib.collections import PolyCollection > from mpl_toolkits.basemap import Basemap > > > def test_polycollection (NLats, NLons): > """ Test poly collections """ > > fig = plt.figure() > ax = fig.add_axes([0.1,0.1,0.8,0.8]) > figmap = Basemap (llcrnrlon=-180., llcrnrlat=-90, > urcrnrlon=180., urcrnrlat=90.,\ > resolution='c', area_thresh=10000., > projection='cyl') > > # Color map and min/max bounds > cmap = plt.cm.jet > vmin = 0 > vmax = 10 > > # Arrays for the vertices and the colors > Poly_Vertices = [] > Poly_Colors = [] > > # add pixel to array of vertices and set a random color > for LatNr in range (0, NLats): > for LonNr in range (0, NLons, 2): > > # shift lon 1 point if odd for staggered grid > if (LatNr % 2 == 0): > # even > ShiftLon = 0 > else: > # odd > ShiftLon = 1 > > # calc coordinates for vertex storage > x1,y1 = (359.*(ShiftLon + LonNr + 1)/(NLons+1) - 179.9, > 179.*(LatNr )/(NLats+1) - 89.9) > x2,y2 = (359.*(ShiftLon + LonNr + 2)/(NLons+1) - 179.9, > 179.*(LatNr + 1)/(NLats+1) - 89.9) > x3,y3 = (359.*(ShiftLon + LonNr + 1)/(NLons+1) - 179.9, > 179.*(LatNr + 2)/(NLats+1) - 89.9) > x4,y4 = (359.*(ShiftLon + LonNr )/(NLons+1) - 179.9, > 179.*(LatNr + 1)/(NLats+1) - 89.9) > > # get RGB colors, cut off alpha. > RandomValue = random.random() * vmax > colorsgen = cmap ((RandomValue - vmin) / (vmax - vmin))[:3] > > # add the polygon vertices and the color to the array > Poly_Vertices.append ([(x1,y1), (x2,y2), (x3,y3), (x4,y4)]) > Poly_Colors.append (colorsgen) > > > # Create PolyCollection and add it to the axes > print 'PolyCollection: number of elements: ', len (Poly_Colors) > Data_PatchCollection = PolyCollection (Poly_Vertices, > facecolor=Poly_Colors, > edgecolor='black', > linewidth=0) > > print 'add_collection' > ax.add_collection (Data_PatchCollection) > > print 'add_collection done' > > # finish the plot by drawing coastlines > figmap.drawcoastlines() > > plt.title ('PolyCollection on a map') > fig.savefig ('polycol.png', dpi=300) > plt.close() > > return > # > # End test_polycollection > # > > > if __name__ == "__main__": > """ Test the memory size of matplotlib using poly > collections. > > On a 64 bit linux machine the memory use is > enormous when plotting large numbers of patches > via matplotlib / PolyCollection. > > For 518400 patches matplotlib will use ~2Gb of > memory. On a 32 bit Linux machine, the memory > usage is roughly half. > > Can this be done more efficient? > > Debian Testing: Linux host 2.6.32-5-amd64 #1 SMP > Wed Jan 12 03:40:32 UTC 2011 x86_64 GNU/Linux > Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) > matplotlib.__version__ = '1.0.0' > """ > > # 129600 patches will use ~630Mb of memory (on 64bit Linux) > #NLats=360 > #NLons=720 > > # 259200 patches will use ~1Gb of memory (on 64bit Linux) > #NLats=360 > #NLons=1440 > > # 518400 patches will use ~2Gb of memory (on 64bit Linux) > NLats=720 > NLons=1440 > > # > # test the memory size of using poly collections. > test_polycollection (NLats, NLons) > > > > > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: onet <on...@dd...> - 2011-03-12 01:14:28
|
Hi, Using matplotlib I try to plot satellite observations, which consists of roughly one million patches that are not gridded regularly. I first collect the vertices (corner points of the observations) and colors and then use PolyCollection and ax.add_collection to add these patches to the figure. On my 64bit Linux machine: # 518400 patches will use >2Gb of memory # 1M patches will use > 4Gb of memory On a 32bit machine the memory is roughly half compared to 64bit. My question: how can I plot more efficiently and use less memory? An example script with random data is below. System: Debian Testing: kernel 2.6.32-5-amd64 x86_64 GNU/Linux Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) matplotlib.__version__ = '1.0.0' Best regards, Onet. #!/usr/bin/env python # # Purpose : Show large use of memory when plotting # large numbers of patches # import random import matplotlib matplotlib.use('AGG') # produce AGG graphics (o.a. PNG) by default import matplotlib.pyplot as plt import matplotlib.colors as colors from matplotlib.collections import PolyCollection from mpl_toolkits.basemap import Basemap def test_polycollection (NLats, NLons): """ Test poly collections """ fig = plt.figure() ax = fig.add_axes([0.1,0.1,0.8,0.8]) figmap = Basemap (llcrnrlon=-180., llcrnrlat=-90, urcrnrlon=180., urcrnrlat=90.,\ resolution='c', area_thresh=10000., projection='cyl') # Color map and min/max bounds cmap = plt.cm.jet vmin = 0 vmax = 10 # Arrays for the vertices and the colors Poly_Vertices = [] Poly_Colors = [] # add pixel to array of vertices and set a random color for LatNr in range (0, NLats): for LonNr in range (0, NLons, 2): # shift lon 1 point if odd for staggered grid if (LatNr % 2 == 0): # even ShiftLon = 0 else: # odd ShiftLon = 1 # calc coordinates for vertex storage x1,y1 = (359.*(ShiftLon + LonNr + 1)/(NLons+1) - 179.9, 179.*(LatNr )/(NLats+1) - 89.9) x2,y2 = (359.*(ShiftLon + LonNr + 2)/(NLons+1) - 179.9, 179.*(LatNr + 1)/(NLats+1) - 89.9) x3,y3 = (359.*(ShiftLon + LonNr + 1)/(NLons+1) - 179.9, 179.*(LatNr + 2)/(NLats+1) - 89.9) x4,y4 = (359.*(ShiftLon + LonNr )/(NLons+1) - 179.9, 179.*(LatNr + 1)/(NLats+1) - 89.9) # get RGB colors, cut off alpha. RandomValue = random.random() * vmax colorsgen = cmap ((RandomValue - vmin) / (vmax - vmin))[:3] # add the polygon vertices and the color to the array Poly_Vertices.append ([(x1,y1), (x2,y2), (x3,y3), (x4,y4)]) Poly_Colors.append (colorsgen) # Create PolyCollection and add it to the axes print 'PolyCollection: number of elements: ', len (Poly_Colors) Data_PatchCollection = PolyCollection (Poly_Vertices, facecolor=Poly_Colors, edgecolor='black', linewidth=0) print 'add_collection' ax.add_collection (Data_PatchCollection) print 'add_collection done' # finish the plot by drawing coastlines figmap.drawcoastlines() plt.title ('PolyCollection on a map') fig.savefig ('polycol.png', dpi=300) plt.close() return # # End test_polycollection # if __name__ == "__main__": """ Test the memory size of matplotlib using poly collections. On a 64 bit linux machine the memory use is enormous when plotting large numbers of patches via matplotlib / PolyCollection. For 518400 patches matplotlib will use ~2Gb of memory. On a 32 bit Linux machine, the memory usage is roughly half. Can this be done more efficient? Debian Testing: Linux host 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64 GNU/Linux Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) matplotlib.__version__ = '1.0.0' """ # 129600 patches will use ~630Mb of memory (on 64bit Linux) #NLats=360 #NLons=720 # 259200 patches will use ~1Gb of memory (on 64bit Linux) #NLats=360 #NLons=1440 # 518400 patches will use ~2Gb of memory (on 64bit Linux) NLats=720 NLons=1440 # # test the memory size of using poly collections. test_polycollection (NLats, NLons) |
From: Thomas B. <th...@ar...> - 2011-03-12 00:01:22
|
Jason Stone, on 2011-02-18 14:39, wrote: > Good afternoon all, > One last matplotlib question for the group for today. On one of my GUI > plots, I'm calling imshow on an array of data (to display it in the same way > MATLAB's imagesc command does). I'd like to add a second y-axis to the > right side of the plot that is completely dependent on the values on the > primary y-axis. Essentially, for each y-axis tick point, I'll put the > y-axis 'value' into a formula and then put the result on the second y-axis. > I did this in MATLAB by essentially overlaying a second set of axes over > the plot, but I haven't found the exact way to do it with matplotlib yet. > I've seen a few examples online, but they all use the second overlaid plot > to actually plot new data - I wouldn't be doing this. > Would I need to use the twinx (or twiny) function? > Are there examples of this on the web that I haven't found that somebody > could point me towards? Hi Jason, here's an example that does what you want, using e^x as the formula, change the paramter to fmtr to suit your needs: ax = plt.subplot(1,1,1) ax.plot(np.sin(np.linspace(0,np.pi))) ax2 = ax.twinx() ax2._sharey = ax # share both x and y fmtr = mpl.ticker.FuncFormatter(lambda x,pos: "%.2f"%np.exp(x)) ax2.yaxis.set_major_formatter(fmtr) plt.draw() best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 Paul, I am currently doing something very similar and was hoping I could ask for a little clarification. I want to have two y axes where the ticks are in the same locations and the 2nd y-axis labels are just twice the 1st y-axis labels. When I implement your example, I don't quite understand how to ensure the ticks are at the same locations. Also, when the data changes to a new image, the 1st y-axis updates but the 2nd y-axis does not. Is there a convenient way to force both to update each time, or does the figure need to be cleared and essentially built from scratch each time. for example, with the following code: import numpy as np import matplotlib import matplotlib.colorbar as cb import matplotlib.pyplot as plt y = np.reshape(np.arange(0, 1000000, 1), (20000, 50)) test = 'hot' f1 = plt.figure(1) f1.patch.set_facecolor('#c0c0c0') ax1 = f1.add_axes([0.09, 0.15, 0.82, 0.80]) axc = f1.add_axes([0.09, 0.05, 0.82, 0.05]) im1 = ax1.imshow(y, cmap=test, aspect='auto', origin='lower') cb.Colorbar(axc, im1, orientation='horizontal') ax2 = ax1.twinx() ax2._sharey = ax1 # share both x and y fmtr = matplotlib.ticker.FuncFormatter(lambda x,pos: "%.2f"%np.exp(x)) ax2.yaxis.set_major_formatter(fmtr) plt.show() The ticks on the right are obviously at different locations compared to the left ticks. Also, if imshow was to be called a new array of data, the ticks on the right would remain the same. So is there an easy way to force the locations to be the same, and is there an easy way force the right y-axis to update each time? Thank you very much for your time and help. -Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk1kEfIACgkQe+cmRQ8+KPe0vACfSMtFJ9KSRwqU34j6QevaSZqD qM0An2WHMyKisrwDIyKaCcuygrsWvZbX =OIU1 -----END PGP SIGNATURE----- ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Matplotlib-users mailing list Mat...@li... <mailto:Mat...@li...> https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Goyo <goy...@gm...> - 2011-03-11 22:18:45
|
2011/3/11 Luciano Fleischfresser <l_...@ya...>: > [...] > I have to confess that object-oriented programming seems very > counter-intuitive to me. > Hopefully it will come more naturally soon. This has nothing to do with OOP, you just need to know what command/function/method does what you want. It happens that in matplotlib plots are autoscaled by default but not tightly. You can change this behavoir using autoscale. There is a functional version pyplot.autoscale but for scripting is usually better the axes.autoscale version because it make explicit in your code which axes is affected. For interactive plotting, the functional version may be more convenient. > > Along the same lines of my original query, this one I think is more obscure, > so here it goes: > > Same script, just another .csv file with the same format. This time around, > the plot comes up > with UTC times for the labels on the x-axis. The first one came with the > dates. > > Does anybody know how to tell matplotlib to always put dates? Matplotlib automatically choose a formatter for labels, based on the interval to plot and the like. If you don't like it, use your own. Maybe this: import matplotlib.dates as mdates formatter = mdates.DateFormatter('%d-%b-%y-%H:%M:%S') axes.xaxis.set_major_formatter(formatter) Goyo |
From: Benjamin R. <ben...@ou...> - 2011-03-11 22:05:16
|
2011/3/10 Søren Nielsen <sor...@gm...> > Hi, > > When I do an errorbar plot (a.errorbar(), a = axis) with negative values > and then try to change the yscale to log (a.set_yscale('log')) matplotlib > crashes with: > > Traceback (most recent call last): > File > "/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line > 14636, in <lambda> > lambda event: event.callable(*event.args, **event.kw) ) > File "/home/specuser/new_workspace/TestDriven/src/RAWPlot.py", line 371, > in plotSASM > line, ec, el = a.errorbar(sasm.q[q_min:q_max], sasm.i[q_min:q_max], > sasm.err[q_min:q_max], picker = 3, label = legend_label, **kwargs) > File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 4872, > in errorbar > barcols.append( self.vlines(x, lower, upper, **lines_kw) ) > File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 3302, > in vlines > self.autoscale_view() > File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 1627, > in autoscale_view > YL = self.yaxis.get_major_locator().view_limits(y0, y1) > File "/usr/lib64/python2.6/site-packages/matplotlib/ticker.py", line > 1119, in view_limits > if not is_decade(vmin,self._base): vmin = decade_down(vmin,self._base) > File "/usr/lib64/python2.6/site-packages/matplotlib/ticker.py", line > 1030, in is_decade > return lx==int(lx) > OverflowError: cannot convert float infinity to integer > Traceback (most recent call last): > File > "/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line > 14636, in <lambda> > lambda event: event.callable(*event.args, **event.kw) ) > File "/home/specuser/new_workspace/TestDriven/src/RAW.py", line 1953, in > addItem > newItem = ManipItemPanel(self.underpanel, sasm, font_colour = > item_colour) > File "/home/specuser/new_workspace/TestDriven/src/RAW.py", line 2353, in > __init__ > color = conv.to_rgb(self.sasm.line.get_mfc()) > AttributeError: 'NoneType' object has no attribute 'get_mfc' > > I don't think this should be the expected outcome.. rather it should not > plot values that are illegal/negative (i.e. ignore them). > > Is there a way I can get around this without having to search through my > data and remove points that are negative or NaN or INF when the yscale needs > to be log? That would also show an incorrect curve since a line would be > drawn across the points that were removed.. It should rather be gaps in the > line. > > Thanks, > Soren > > > > Soren, This is a bug I encountered recently in my investigations with log scales. While most projections are handling this properly, there are some cases where this problem sneaks in. I have not been able to figure out how to permanently address this issue. For reference, the similiar issue is when zooming in on polar plots with the radial axis in log scale. Ben Root |
From: Goyo <goy...@gm...> - 2011-03-11 21:18:26
|
2011/3/10 Søren Nielsen <sor...@gm...>: > Is there a way I can get around this without having to search through my > data and remove points that are negative or NaN or INF when the yscale needs > to be log? That would also show an incorrect curve since a line would be > drawn across the points that were removed.. It should rather be gaps in the > line. You can use masked arrays. Masked values don't get plotted. Sample code (not tested): import numpy.ma as ma # masked arrays module ... mdata = ma.masked_array(data) mdata[mdata <= 0] = ma.masked plot(mdata) Goyo |
From: Daniel M. <dan...@go...> - 2011-03-11 18:59:14
|
Hi Eric, thank you so much for pointing this out! Didn't know about the function before, it really helps me a lot! However, for the current problem it doesn't help. The scaling of the second axis broken without any margin or padding changes. As a workaround, I could of course plot the data two times, first in the first axis, and then in the second axis, and make sure the margins are equal. However, this would considerable increase the file size for vector based formats as I plot *a lot* of data points :) Either way, thanks a lot for this hint! 2011/3/11 Eric Firing <ef...@ha...>: > On 03/10/2011 01:13 AM, Daniel Mader wrote: >> Maybe I should mention that there are actually two reasons why I don't >> like this behavior: >> >> 1) it's sometimes very hard to read what's going on, >> 2) there also seems to be a bug when the limits are changed later, see >> attached results: the upper subplot is default, the lower subplot uses >> the padding. >> >> ##-------------------------- >> def update_ax2(ax1): >> ''' >> Automatically update ylim of ax2 when ylim of ax1 changes. >> ''' >> y1, y2 = ax1.get_ylim() >> ## modify the limits >> ax2.set_ylim((Tc(y1), Tc(y2))) >> ax2.figure.canvas.draw() >> >> Both plots are actually identical but use a different x-axis. In >> ordert to create a nicely padded plot, I use the following function, >> which breaks the scaling information AND the calculation of the second >> axis limits: >> >> ##-------------------------- >> def axispaddingAX(ax): >> ''' >> Saubere bzw. schoene Achsenskalierung für MPL-Skripten. >> ''' >> lines = ax.get_lines() >> xtemp = [] >> ytemp = [] >> for line in lines: >> xtemp.append(min(line.get_xdata())) >> xtemp.append(max(line.get_xdata())) >> ytemp.append(min(line.get_ydata())) >> ytemp.append(max(line.get_ydata())) >> xmin,xmax = min(xtemp),max(xtemp) >> ymin,ymax = min(ytemp),max(ytemp) >> span = 0.05 >> rangex = (xmin-span*(xmax-xmin), xmax+span*(xmax-xmin)) >> rangey = (ymin-span*(ymax-ymin), ymax+span*(ymax-ymin)) >> ax.set_xlim(rangex) >> ax.set_ylim(rangey) > > I don't know if it would help overall, but in place of your padding > function, have you considered the pylab or pyplot margins() function? > > Eric > >> >> >> Thanks a lot in advance for any hint or comment on this, >> Daniel >> >> 2011/3/10 Daniel Mader<dan...@go...>: >>> Hi, >>> >>> is it possible to change the default y-axis scaling so that the >>> ticks/label are not with respect to the large offset? >>> >>> For example: >>> >>> import scipy >>> import pylab >>> >>> x = scipy.arange(100) >>> y = scipy.rand(100) + 1000006 >>> >>> pylab.figure() >>> pylab.plot(x,y) >>> pylab.grid() >>> >>> pylab.show() >>> >>> This gives the y-limits as (0,1) with respect to 1000006. This makes >>> it very hard to read. I'd like to be able to configure this manually. >>> >>> Thanks in advance, >>> Daniel |
From: Eric F. <ef...@ha...> - 2011-03-11 18:38:11
|
On 03/10/2011 01:13 AM, Daniel Mader wrote: > Maybe I should mention that there are actually two reasons why I don't > like this behavior: > > 1) it's sometimes very hard to read what's going on, > 2) there also seems to be a bug when the limits are changed later, see > attached results: the upper subplot is default, the lower subplot uses > the padding. > > ##-------------------------- > def update_ax2(ax1): > ''' > Automatically update ylim of ax2 when ylim of ax1 changes. > ''' > y1, y2 = ax1.get_ylim() > ## modify the limits > ax2.set_ylim((Tc(y1), Tc(y2))) > ax2.figure.canvas.draw() > > Both plots are actually identical but use a different x-axis. In > ordert to create a nicely padded plot, I use the following function, > which breaks the scaling information AND the calculation of the second > axis limits: > > ##-------------------------- > def axispaddingAX(ax): > ''' > Saubere bzw. schoene Achsenskalierung für MPL-Skripten. > ''' > lines = ax.get_lines() > xtemp = [] > ytemp = [] > for line in lines: > xtemp.append(min(line.get_xdata())) > xtemp.append(max(line.get_xdata())) > ytemp.append(min(line.get_ydata())) > ytemp.append(max(line.get_ydata())) > xmin,xmax = min(xtemp),max(xtemp) > ymin,ymax = min(ytemp),max(ytemp) > span = 0.05 > rangex = (xmin-span*(xmax-xmin), xmax+span*(xmax-xmin)) > rangey = (ymin-span*(ymax-ymin), ymax+span*(ymax-ymin)) > ax.set_xlim(rangex) > ax.set_ylim(rangey) I don't know if it would help overall, but in place of your padding function, have you considered the pylab or pyplot margins() function? Eric > > > Thanks a lot in advance for any hint or comment on this, > Daniel > > 2011/3/10 Daniel Mader<dan...@go...>: >> Hi, >> >> is it possible to change the default y-axis scaling so that the >> ticks/label are not with respect to the large offset? >> >> For example: >> >> import scipy >> import pylab >> >> x = scipy.arange(100) >> y = scipy.rand(100) + 1000006 >> >> pylab.figure() >> pylab.plot(x,y) >> pylab.grid() >> >> pylab.show() >> >> This gives the y-limits as (0,1) with respect to 1000006. This makes >> it very hard to read. I'd like to be able to configure this manually. >> >> Thanks in advance, >> Daniel >> >> >> >> ------------------------------------------------------------------------------ >> Colocation vs. Managed Hosting >> A question and answer guide to determining the best fit >> for your organization - today and in the future. >> http://p.sf.net/sfu/internap-sfd2d >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Thomas R. <tho...@gm...> - 2011-03-11 17:47:09
|
Hi Jae-Joon, I tried inserting: mpl.rc('ps', usedistiller=None) after importing matplotlib, and I get: $ du -sk *.eps 6204 test_1.eps 34104 test_2.eps using 'ghostscript' I get: $ du -sk *.eps 34096 test_1.eps 34104 test_2.eps and using 'xpdf' raises an exception: File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py", line 1091, in _print_figure xpdf_distill(tmpfile, isEPSF, ptype=papertype, bbox=bbox) File "/Users/tom/Library/Python/2.6/site-packages/matplotlib/backends/backend_ps.py", line 1421, in xpdf_distill image.\nHere is the full report generated by pdftops: \n\n' + fh.read()) RuntimeError: pdftops was not able to process your image. Here is the full report generated by pdftops: I don't have a matplotlibrc file, and I am using: Ghostscript: GPL Ghostscript 9.00 (2010-09-14) LaTeX: Version 3.1415926-1.40.10 (TeX Live 2009) and I'm using the latest head from github for matplotlib. Cheers, Tom On Mar 8, 2011, at 7:31 AM, Jae-Joon Lee wrote: > With current master at git repo, I cannot reproduce this. > Both test_1.eps and test_2.eps are ~4M in size. > > Can you check if the file size varies significantly with rc parameters > ps.usedistiller? > I'm not sure how text setting can affect the images. > > Regards, > > -JJ > > > > On Tue, Mar 1, 2011 at 7:23 AM, Thomas Robitaille > <tho...@gm...> wrote: >> Hi, >> >> In the following example: >> >> --- >> >> import numpy as np >> >> import matplotlib as mpl >> mpl.use('Agg') >> import matplotlib.pyplot as plt >> >> fig = plt.figure() >> ax = fig.add_subplot(1, 1, 1) >> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest') >> fig.savefig('test_1.eps') >> >> mpl.rc('text', usetex=True) >> >> fig = plt.figure() >> ax = fig.add_subplot(1, 1, 1) >> ax.imshow(np.random.random((1024, 1024)), interpolation='nearest') >> fig.savefig('test_2.eps') >> >> --- >> >> the file test_2.eps is almost 6 times larger than test_1.eps, and takes much longer to draw. It looks like in the first case, the image is rendered as a bitmap (the way it should be), whereas in the second case each pixel is drawn individually as a polygon. Is this a bug? >> >> I am using r8988 of matplotlib. >> >> Thanks for any help! >> >> Thomas >> ------------------------------------------------------------------------------ >> Free Software Download: Index, Search & Analyze Logs and other IT data in >> Real-Time with Splunk. Collect, index and harness all the fast moving IT data >> generated by your applications, servers and devices whether physical, virtual >> or in the cloud. Deliver compliance at lower cost and gain new business >> insights. http://p.sf.net/sfu/splunk-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> |
From: Daniel M. <dan...@go...> - 2011-03-11 09:59:52
|
Hi again, unfortunately, the proposed solution breaks a second y-axis. Attached is a script which demonstrates the problem in the third figure. The second axis should be half of the first one. import pylab import scipy pylab.close('all') ##------------------------------------------------------------------------------ ## matplotlib.pyplot / pylab x = scipy.arange(100) y = scipy.rand(100) + 1000006 pylab.figure() pylab.plot(x,y) pylab.grid() #pylab.ticklabel_format(useOffset=1000000, axis='y') pylab.ticklabel_format(useOffset=False, axis='y') ##------------------------------------------------------------------------------ ## matplotlib fig = pylab.figure(figsize=(8,6)) ax = fig.add_subplot(111) ax.plot(x,y) ax.grid() ax.ticklabel_format(useOffset=1000000, axis='y') #ax.ticklabel_format(useOffset=False, axis='y') ##------------------------------------------------------------------------------ ## matplotlib twinx() fig = pylab.figure(figsize=(8,6)) ax1 = fig.add_subplot(111) ax2 = ax1.twinx() ax1.plot(x,y) ax1.grid() ## automatically update ylim of ax2 when ylim of ax1 changes: def update_ax2(ax1): y1, y2 = ax1.get_ylim() ## modify the limits ax2.set_ylim((y1/2., y2/2.)) ax2.figure.canvas.draw() ax1.callbacks.connect("ylim_changed", update_ax2) ax1.ticklabel_format(useOffset=False, axis='y') ##------------------------------------------------------------------------------ pylab.show() 2011/3/10 Daniel Mader <dan...@go...>: > Hi Ben, > > thanks a lot, this really helpes in the simple example, I'll try to > find out how to use it in the complex script. It seems 1.0.0 is recent > enough for this! > > Thanks again, > Daniel > > 2011/3/10 Benjamin Root <ben...@ou...>: >> >> >> On Thu, Mar 10, 2011 at 4:54 AM, Daniel Mader >> <dan...@go...> wrote: >>> >>> Hi, >>> >>> is it possible to change the default y-axis scaling so that the >>> ticks/label are not with respect to the large offset? >>> >>> For example: >>> >>> import scipy >>> import pylab >>> >>> x = scipy.arange(100) >>> y = scipy.rand(100) + 1000006 >>> >>> pylab.figure() >>> pylab.plot(x,y) >>> pylab.grid() >>> >>> pylab.show() >>> >>> This gives the y-limits as (0,1) with respect to 1000006. This makes >>> it very hard to read. I'd like to be able to configure this manually. >>> >>> Thanks in advance, >>> Daniel >>> >> >> I tried to fix matplotlib to be smarter about choosing the offset value a >> while back, but I couldn't come up with something that worked well in the >> general case. You can manually turn it off completely, and have the full >> value displayed (or even manually set the offset value). If you have a very >> recent matplotlib: >> >> import matplotlib.pyplot as plt >> import numpy as np >> >> x = np.arange(100) >> y = np.random.rand(100) + 1000006 >> >> plt.figure() >> plt.plot(x, y) >> plt.grid() >> plt.ticklabel_format(useOffset=1000000, axis='y') >> >> plt.show() >> >> Or you can turn it off by setting useOffset to False. >> >> If you don't have a recent enough matplotlib, you can turn it off completely >> by doing something like this: >> >> import matplotlib.pyplot as plt >> import numpy as np >> from matplotlib.ticker import ScalarFormatter >> >> x = np.arange(100) >> y = np.random.rand(100) + 1000006 >> >> fig = plt.figure() >> ax = fig.gca() >> ax.plot(x, y) >> ax.grid() >> ax.yaxis.set_major_formatter(ScalarFormatter(useOffset=False)) >> >> plt.show() >> >> >> I hope this helps! >> Ben Root >> >> > -- Zugallistr. 11/14 5020 Salzburg M_at +43 699 10 54 54 53 T_at +43 662 841635 M_de +49 179 2300317 E dan...@go... |
From: Jochen D. <joc...@nt...> - 2011-03-11 07:44:28
|
Hi! Changing the alpha-channel of a plotted image doesn't work for me in an ipython (pylab) shell. The example below illustrates the problem (i hope so at least ...) Running it with %run - everything is fine and the two images look the same. Runing it line by line without the show, the figure shows up, the images are plotted, but the alpha-value of im1 is not set correctly so it's fully opaque in the left plot. Is it just me or is it a bug, and if it's a bug is it a bug in pylab or in matplotlib? Thanks in advance! Jochen Code: import numpy as np from matplotlib.pyplot import * aimg = np.array([[0, 1, 1, 0], [0, 1, 2, 0], [0, 1, 3, 0], [0, 1, 4, 0]]) figure() ax = subplot(121) im1 = imshow(aimg, alpha = 1, interpolation='nearest') im1.set_alpha(0.5) ax = subplot(122) im2 = imshow(aimg, alpha = 0.5, interpolation='nearest') show() |
From: Daniel H. <dh...@gm...> - 2011-03-11 02:17:52
|
If the color of a polygon is set to 'none' (meaning no fill), the alpha set for that polygon doesn't seem to apply to the boundary of that polygon. To see this, change the following line in integral_demo.py (in the matplotlib gallery): poly = Polygon(verts, facecolor='0.8', edgecolor='k') to poly = Polygon(verts, facecolor='k', edgecolor='k',alpha=0.1) in this case, the alpha is applied to both the fill and the edge. Now change that same line to poly = Polygon(verts, facecolor='none', edgecolor='k',alpha=0.1) And then there is no fill as expected, but the edge is now dark black again instead of being light due to the alpha of 0.1. -- Daniel Hyams dh...@gm... |
From: Luciano F. <l_...@ya...> - 2011-03-11 01:43:01
|
Hi Goyo, Thanks a lot. tight='True' worked fine in my autoscale_view(). It's doing just what I needed. I have to confess that object-oriented programming seems very counter-intuitive to me. Hopefully it will come more naturally soon. Along the same lines of my original query, this one I think is more obscure, so here it goes: Same script, just another .csv file with the same format. This time around, the plot comes up with UTC times for the labels on the x-axis. The first one came with the dates. Does anybody know how to tell matplotlib to always put dates? Here is the code again: from matplotlib.dates import strpdate2num from matplotlib.ticker import MultipleLocator, FormatStrFormatter import numpy as np from pylab import * datafile = ('t2vst2.csv') print 'loading', datafile times, temp1, temp2 = np.loadtxt( datafile, delimiter=',', converters={0:strpdate2num('%d-%b-%y-%H:%M:%S') }, skiprows=1, usecols=(0,1,2), unpack=True) fig = figure() ax = fig.add_subplot(111) ax.plot_date(times, temp1, 'r-',linewidth=2.0) ax.plot_date(times, temp2, 'g-',linewidth=2.0) ax.autoscale_view(tight='True', scalex=True, scaley=False) fig.autofmt_xdate() show() Thanks again. ________________________________ From: Goyo <goy...@gm...> To: Luciano Fleischfresser <lf...@ut...> Cc: Luciano Fleischfresser <l_...@ya...>; mat...@li... Sent: Wed, March 9, 2011 5:59:19 PM Subject: Re: [Matplotlib-users] Axes formatting 2011/3/9 Luciano Fleischfresser <l_...@ya...>: > [...] > Does anybody know how to make the plot area start right at the > beginning of data and finish right at the end, so it spans the whole x axis? I think this should do the trick: axes.autoscale(axis='x', tight='True') Goyo |
From: Auré G. <aur...@ya...> - 2011-03-10 22:01:55
|
Thanks, I read some of your previous posts dealing with the pcolor and tried this route but didn't succeed yet... I really agree with you on the interest of having an option to pass an array rather than value for the alpha keyword ! ________________________________ De : Benjamin Root <ben...@ou...> À : Auré Gourrier <aur...@ya...> Cc : mat...@li... Envoyé le : Jeu 10 mars 2011, 18h 43min 31s Objet : Re: [Matplotlib-users] alternative to imshow with polar axes ? On Thu, Mar 10, 2011 at 8:40 AM, Auré Gourrier <aur...@ya...> wrote: Dear all, > >Once again, I turn for help. >I'm trying to plot a polar image using colormap values for the theta values and >increasing alpha values along the radius. >I do this using imshow passing the rgba tuple at each pixel position which works >very nicely with rectangular axes, but fails to display using polar axes (see >code below). > >As usual, I've done a fair bit of digging to find where the problem is and >whether I could make out an alternate solution but haven't managed to come >through. I've tried using pcolormesh but I don't see how to pass the rgba tuple >Can anyone point me in the right direction. >I'm using matplotlib 1.0.1 and Python 2.4 > >Cheers, > >Auré > > It appears that imshow() (and matshow()) do not support non-rectilinear axes. I don't know if this is a bug or if there is no way to make it support polar projections. Hopefully, someone else more knowledgable could chime in on this. I am also not exactly sure how to accomplish what you want using pcolor. A really slow, painful way would be to pcolor each row with the rest masked out, setting the alpha value for that row. I have long wondered if the alpha kwarg in various functions could be improved by allowing array values and take advantage of numpy broadcasting. Ben Root |
From: Søren N. <sor...@gm...> - 2011-03-10 21:12:09
|
Hi, When I do an errorbar plot (a.errorbar(), a = axis) with negative values and then try to change the yscale to log (a.set_yscale('log')) matplotlib crashes with: Traceback (most recent call last): File "/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14636, in <lambda> lambda event: event.callable(*event.args, **event.kw) ) File "/home/specuser/new_workspace/TestDriven/src/RAWPlot.py", line 371, in plotSASM line, ec, el = a.errorbar(sasm.q[q_min:q_max], sasm.i[q_min:q_max], sasm.err[q_min:q_max], picker = 3, label = legend_label, **kwargs) File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 4872, in errorbar barcols.append( self.vlines(x, lower, upper, **lines_kw) ) File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 3302, in vlines self.autoscale_view() File "/usr/lib64/python2.6/site-packages/matplotlib/axes.py", line 1627, in autoscale_view YL = self.yaxis.get_major_locator().view_limits(y0, y1) File "/usr/lib64/python2.6/site-packages/matplotlib/ticker.py", line 1119, in view_limits if not is_decade(vmin,self._base): vmin = decade_down(vmin,self._base) File "/usr/lib64/python2.6/site-packages/matplotlib/ticker.py", line 1030, in is_decade return lx==int(lx) OverflowError: cannot convert float infinity to integer Traceback (most recent call last): File "/usr/lib64/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14636, in <lambda> lambda event: event.callable(*event.args, **event.kw) ) File "/home/specuser/new_workspace/TestDriven/src/RAW.py", line 1953, in addItem newItem = ManipItemPanel(self.underpanel, sasm, font_colour = item_colour) File "/home/specuser/new_workspace/TestDriven/src/RAW.py", line 2353, in __init__ color = conv.to_rgb(self.sasm.line.get_mfc()) AttributeError: 'NoneType' object has no attribute 'get_mfc' I don't think this should be the expected outcome.. rather it should not plot values that are illegal/negative (i.e. ignore them). Is there a way I can get around this without having to search through my data and remove points that are negative or NaN or INF when the yscale needs to be log? That would also show an incorrect curve since a line would be drawn across the points that were removed.. It should rather be gaps in the line. Thanks, Soren |
From: Gökhan S. <gok...@gm...> - 2011-03-10 20:46:26
|
Yung-Yu, We are advertised on this blog http://pycon.blogspot.com/2011/03/pycon-2011-outside-talks-poster-session.html I will be in the conference venue by tomorrow morning. There are many interesting talks and posters that I look forward seeing plus meeting those presenters. See you in Atlanta. On 3/9/11, Yung-Yu Chen <yy...@so...> wrote: > I will be there tomorrow, and giving a talk about solving PDEs on Saturday > morning (plus a poster). Looking forward to meet you guys and to learn more > about contribution to the community. > > with regards, > Yung-Yu Chen > > -- > Yung-Yu Chen > PhD candidate of Mechanical Engineering > The Ohio State University, Columbus, Ohio > +1 (614) 859 2436 > http://solvcon.net/yyc/ > -- Gökhan |
From: Steve S. <ssk...@li...> - 2011-03-10 19:33:06
|
I'm a frequent user of matplotlib on my Windows XP machine. I recently attempted to install a program that modified my Tcl installation, and I now get an error message when I attempt to plot anything in matplotlib. Here is the error message: --- Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python25\lib\lib-tk\Tkinter.py", line 3758, in _test root = Tk() File "C:\Python25\lib\lib-tk\Tkinter.py", line 1647, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, want objects, useTk, sync, use) _tkinter.TclError: Can't find a usable init.tcl in the following directories: {C:\Program Files\Tcl\lib\tcl8.3} {C:\Program Files\Tcl\lib \tcl8.3} {C:/Prog ram Files/Tcl/lib/tcl8.4} C:/Python25/lib/tcl8.4 C:/lib/tcl8.4 C:/ library This probably means that Tcl wasn't installed properly. --- I attempted a complete reinstall of python (hoping it would reinstall Tcl with correct file paths), but I get the same error. Any suggestions would be appreciated. Thanks! Steve Skripnik, P.E. Project Engineer LimnoTech 1705 DeSales St NW Suite 600 Washington, DC 20036 ssk...@li...<mailto:ssk...@li...> http://www.limno.com<http://www.limno.com/> Phone: (202) 833-9140 Fax: (202) 833-9094 Water | Environment | Scientists | Engineers |