SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S


1
(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)


Showing 13 results of 13

From: Sebastian B. <seb...@si...> - 2011年03月12日 21:57:27
Hey,
I have a family of curves to plot. They all look somewhat similar and
hardly cross, but a parameter is changed, so adding labels to them in a
contour plot fashion would be cool. I will just do this by hand now
likely, but as clabels works nice I was wondering if this can be used or
abused for usual lines too?
Regards,
Sebastian
From: Jouni K. S. <jk...@ik...> - 2011年03月12日 21:25:09
Jouni K. Seppänen <jk...@ik...> writes:
> 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.
Got it, thanks. Unfortunately I have no idea what's going on. The debug
information indicates that the PsfontsMap._register function (which only
gets called from within the loop in PsfontsMap._parse) is called with
pdftex.map lines out of order, and lacking some of the lines.
The pdftex.map file you sent me starts with some comments followed by
these entries:
 ASCII ASCII <ASCII.pfb
 Acorn AcornInitials <Acorn.pfb
 AlphaDia ChessAlphaDiagram <AlphaDia.pfb
 AmiciLogo AmiciLogo <AmiciLogo.pfb
The log messages, on the other hand, start like this:
 PsfontsMap: register ['Acorn', 'AcornInitials', '<Acorn.pfb']
 PsfontsMap: register ['aealbattar', 'ae_AlBattar', 'ArabeyesArabicEncoding ReEncodeFont', '<ararabeyes.enc', '<ae_albattar.pfb']
 PsfontsMap: register ['aealmateen', 'ae_AlMateen', 'ArabeyesArabicEncoding ReEncodeFont', '<ararabeyes.enc', '<ae_almateen.pfb']
Here's a small table. The first column is just line numbers within that
part of the debug log, the second is the number of the entry in
pdftex.map referenced, the third is the first word of that entry:
 1 2 Acorn
 2 279 aealbattar
 3 280 aealmateen
 4 281 aealmohanadb
 5 282 aealmohanadbolditalic
 6 278 ae_almohanad_xxbold
 7 283 aealmothnna
 8 284 aealyermook
 9 285 aearab
So it first gets entry #2 (Acorn) from the file, then jumps to entry
#279 (aealbattar) and starts going forward from there, except #278 gets
between #282 and #283. It goes on like this for a while, then:
 32 308 aetarablus
 33 309 aetholoth
 34 3 AlphaDia
 35 4 AmiciLogo
 36 5 AmiciLogoBold
 37 6 AmiciLogoBoldRslant
 38 7 AmiciLogoBoldSlant
 39 8 AmiciLogoRslant
 40 9 AmiciLogoSlant
 41 310 andlso
 42 10 AnnSton
 43 311 aram10
So after #309 it jumps back to #3 for a while, etc., and the critical
font cmr12 is skipped altogether.
Hmm. The ordering is almost consistent with sorting the font names
case-insensitively, but that wouldn't explain the missing fonts.
Could you double-check that you sent me the correct pdftex.map file?
Run on the system where you have this problem e.g. the following
commands:
 kpsewhich pdftex.map
 head `kpsewhich pdftex.map`
and check that ASCII, Acorn, and AlphaDia are the first three
non-comment entries.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
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

Showing 13 results of 13

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /