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





Showing 18 results of 18

From: New2Python <new...@li...> - 2010年05月18日 23:17:16
Thanks, I changed the matplotlibrc file to use the WXAgg backend and then had
to copy the file into the mpl.get_configdir() and in my local working dir
for it to work.
The file runs however a python error screen pops up and then closes without
giving me the chance to read it, anybody know how to stop the window from
closing so quickly
Thanks
Marco
Michael Droettboom-3 wrote:
> 
> It should only try to import that backend when configured to do so. You 
> may need to change your matplotlibrc to point to your desired backend.
> 
> Mike
> 
> New2Python wrote:
>> Thanks, must have skipped over that one - I added the statements and it
>> has
>> fixed it :) however now there is an issue elsewhere. I get the message
>>
>> File "matplotlib\backends\__init__.pyo", line 25, in pylab_setup
>> ImportError: No module named backend_tkagg
>>
>> and the traceback call this
>>
>> from pylab import *
>>
>> I have _tkagg as an exclude
>>
>> looks like somebody else had this problem but nobody solved it
>> http://mail.scipy.org/pipermail/scipy-user/2005-July/004777.html
>>
>> any one know how to solve this?
>>
>> I tried to include matplotlib.backends.backend_tkagg, then this popped up
>> with a tkinter import error.
>>
>> Regards
>>
>> Marco
>>
>>
>>
>>
>>
>>
>> New2Python wrote:
>> 
>>> Hi All,
>>>
>>> I hope someone can help, I have run into a few problems when trying to
>>> execute an exe file created when I use py2exe with matplotlib.
>>> I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
>>> optimisation is python -OO
>>> the files compile correctly however when I execute the exe I get an
>>> error
>>> as shown below
>>> this is an extract
>>>
>>> File "matplotlib\mlab.pyo", line 380, in <module>
>>> TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'
>>>
>>> the traceback points to this line of my code
>>>
>>> from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
>>>
>>> does anyone know how to solve this, i have seen references made to numpy
>>> but not matplotlib
>>>
>>> Regards
>>>
>>> Marco
>>>
>>>
>>>
>>>
>>> 
>>
>> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> ------------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/py2exe-and-matplotlib-errors-when-executing-exe-tp28589875p28602527.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: <PH...@Ge...> - 2010年05月18日 21:41:30
Nick,
Check out this demo on the MPL website:
http://matplotlib.sourceforge.net/examples/api/histogram_demo.html
This line in particular:
n, bins, patches = ax.hist(x, 50, normed=...)
The variables 'n' and 'bins' can be fed into ax.bar() later on. I could swear that this was clear from the docstring, but that's definitely not the case anymore. I'll submit a patch to the list tomorrow if I can remember to work on it some tonight. 
Do see the docstring for an explanation of what can be done with the 'patches' variable.
Hope this helps,
-paul
> -----Original Message-----
> From: Nick Schurch [mailto:N.S...@du...]
> Sent: Tuesday, May 18, 2010 6:56 AM
> To: mat...@li...
> Subject: [Matplotlib-users] hist question...
> 
> Hi all,
> 
> Is there anyway of re-ploting the distribution generated by hist at a
> later point? I want to call it in a subroutine and have the resulting
> distributions returned so I can plot them without having to
> recalculate them each time. I couldn't find anything int he online
> documentation but I figured it'd be something like:
> 
> import matplotlib.pyplot as plt
> hplot=plt.hist(data, bins=1000)
> 
> plt.hist(hplot)
> or
> plt.hist(hplot[0],bins=hplot[1])
> or
> plt.plot(hist)
> 
> 
> etc, but nothing works.
> 
> --
> Cheers,
> 
> Nick Schurch
> 
> Data Analysis Group (The Barton Group),
> School of Life Sciences,
> University of Dundee,
> Dow St,
> Dundee,
> DD1 5EH,
> Scotland,
> UK
> 
> Tel: +44 1382 388707
> Fax: +44 1382 345 893
> 
> -------------------------------------------------------------------------
> -----
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Alan G I. <ai...@am...> - 2010年05月18日 19:54:43
First of all, what are you trying to do?
What does "figure is created" mean.
Do you need it to be drawn on the monitor?
Why not save your figure(s) to file(s)?
Cheers,
Alan
From: Philipp K. J. <py...@be...> - 2010年05月18日 19:23:27
Thanks.
On Tuesday 18 May 2010 12:13:27 pm John Hunter wrote:
> On Tue, May 18, 2010 at 12:58 PM, Jae-Joon Lee <lee...@gm...> wrote:
> > All the artists that are drawn are kept in the figure instance, so you
> > can inspect the figure instance.
> > And you may use findobj for that if you want.
> > On the other hand, Axes.texts keeps a list of text instances in the
> > axes (e.g., gca().texts).
>
> For more detail see the artist tutorial which describes the various
> containers and how to remove objects from them
>
>
> http://matplotlib.sourceforge.net/users/artists.html#axes-container
>
> JDH
From: John H. <jd...@gm...> - 2010年05月18日 19:13:36
On Tue, May 18, 2010 at 12:58 PM, Jae-Joon Lee <lee...@gm...> wrote:
> All the artists that are drawn are kept in the figure instance, so you
> can inspect the figure instance.
> And you may use findobj for that if you want.
> On the other hand, Axes.texts keeps a list of text instances in the
> axes (e.g., gca().texts).
>
For more detail see the artist tutorial which describes the various
containers and how to remove objects from them
http://matplotlib.sourceforge.net/users/artists.html#axes-container
JDH
From: Jae-Joon L. <lee...@gm...> - 2010年05月18日 17:58:54
On Sun, May 16, 2010 at 3:19 PM, Philipp K. Janert
<py...@be...> wrote:
> Is this the best way to do this, or is there another way
> (or one that does not require an explicit draw()?). Also,
Any change in your figure is realized when you "draw()" the figure. So
there is no way that does not require an explicit draw.
An alternative is to make the artist invisible (use set_visible method).
> what if I have failed to save the text instance - do I have
> to walk the object tree using findobj()?
>
All the artists that are drawn are kept in the figure instance, so you
can inspect the figure instance.
And you may use findobj for that if you want.
On the other hand, Axes.texts keeps a list of text instances in the
axes (e.g., gca().texts).
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2010年05月18日 17:34:58
This can be done relatively easily with the current svn version of
matplotlib (r8319).
Below is the modified version of your code.
See
http://matplotlib.sourceforge.net/trunk-docs/users/annotations_guide.html#using-complex-coordinate-with-annotation
for how the annotation works.
While this is certainly possible with the released version, but it
will require you to write a few tens of lines of code. Basically, you
need create a custom Text class that update its position during the
drawing time.
Regards,
-JJ
###Code
import scipy
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(121)
plt.plot(scipy.sin(scipy.arange(1,100, 0.001)))
plt.xlabel('xlabel')
yl = plt.ylabel("ylabel")
plt.annotate("A", (0,1.), xycoords=(yl, "axes fraction"),
 xytext=(0, 14), textcoords="offset points",
 fontsize=14)
ax = fig.add_subplot(122)
plt.plot(scipy.cos(scipy.arange(1,100, 0.001)))
plt.xlabel('xlabel')
my_ticklabel = ax.get_yticklabels()[-2]
# Note that there is no guarantee that all ticklabels are drawn.
plt.annotate("B", (0,1.), xycoords=(my_ticklabel, "axes fraction"),
 xytext=(0, 14), textcoords="offset points",
 fontsize=14)
###End Code
On Mon, May 17, 2010 at 11:08 AM, hettling <het...@fe...> wrote:
> Dear all,
>
> I'm struggling with the following problem plotting my data:
>
> I have a figure with two panels next to each other, which I want to
> label 'A' and 'B'. I want to left-justify my panel labels, but not to
> the box that contains the plot, but to the y-axis label. I played around
> with 'text()' and 'title()', but did not find a good solution except for
> giving the coordinates manually to 'text()'. This would be very
> inconvenient though, because I have many different plots on different
> scales.
> Here is what I tried:
>
> ###Code
> import scipy
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(121)
> plt.plot(scipy.sin(scipy.arange(1,100, 0.001)))
> plt.xlabel('xlabel')
> plt.ylabel("ylabel")
> plt.text(0,1,"A", fontsize=14, transform=ax.transAxes)
>
> ax = fig.add_subplot(122)
> plt.plot(scipy.cos(scipy.arange(1,100, 0.001)))
> plt.text(0,1,"B", fontsize=14, transform=ax.transAxes)
> plt.xlabel('xlabel')
> ###End Code
>
> So the texts 'A' and 'B' should be a little bit higher and more to the
> left. The 'A' I want to align with the y-axis label of the left plot,
> the 'B' with the values of the y-axis of the right plot.
>
> I hope my question is clear, I will appreciate any help!
>
> Thanks in advance,
>
> Hannes
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Tomáš F. <sen...@em...> - 2010年05月18日 16:31:15
I am using "pmap -pid" on Linux and Task manager on Windows. Memory usage is comparable on both operating systems so I think the memory consumption information is accurate.
> ------------ Pôvodná správa ------------
> Od: Michael Droettboom <md...@st...>
> Predmet: Re: [Matplotlib-users] imshow memory problem
> Dátum: 18.5.2010 16:18:23
> ----------------------------------------
> What are you using to calculate memory usage? I feel the only truly 
> reliable tool is something instrumented like "valgrind --tool=massif".
> 
> ============================================================================
> BUILDING MATPLOTLIB
> matplotlib: 1.0.svn
> python: 2.5.2 (r252:60911, May 7 2008, 12:40:32) [GCC
> 3.4.6 20060404 (Red Hat 3.4.6-9)]
> platform: linux2
> 
> REQUIRED DEPENDENCIES
> numpy: 2.0.0.dev8055
> freetype2: 9.16.3
> 
> OPTIONAL BACKEND DEPENDENCIES
> libpng: 1.2.37
> Tkinter: Tkinter: 50704, Tk: 8.4, Tcl: 8.4
> wxPython: 2.8.6.1
> * WxAgg extension not required for wxPython >= 2.8
> Gtk+: gtk+: 2.10.9, glib: 2.16.1, pygtk: 2.10.4,
> pygobject: 2.13.1
> Mac OS X native: no
> Qt: Qt: 3.3.3, PyQt: 3.17.2
> Qt4: Qt: 4.6.2, PyQt4: 4.7.3
> Cairo: 1.4.0
> 
> OPTIONAL DATE/TIMEZONE DEPENDENCIES
> datetime: present, version unknown
> dateutil: 1.4.1
> pytz: 2008c
> 
> OPTIONAL USETEX DEPENDENCIES
> dvipng: 1.12
> ghostscript: 7.07
> latex: 3.1415926
> pdftops: 3.00
> 
> verbose-helpful:
> 
> $HOME=/home/mdroe
> CONFIGDIR=/home/mdroe/.matplotlib
> matplotlib data path 
> /home/mdroe/usr/lib/python2.5/site-packages/matplotlib/mpl-data
> loaded rc file /home/mdroe/.matplotlib/matplotlibrc
> matplotlib version 1.0.svn
> verbose.level helpful
> interactive is False
> units is False
> platform is linux2
> Using fontManager instance from /home/mdroe/.matplotlib/fontList.cache
> backend GTKAgg version 2.10.4
> findfont: Matching 
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> 
> to Bitstream Vera Sans 
> (/home/mdroe/usr/lib/python2.5/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf)
> 
> with score of 0.000000
> 
> 
> Tomáš Faragó wrote:
> > Thanks for replying Mike,
> > I tried it on Linux as well but I ran into the same problem. Perhaps 
> > it has something to do with other needed libraries (GTK+, etc.). Can 
> > you please tell me your libraries versions? I mean GTK+, pygtk, etc. 
> > Also output produced by --verbose-helpful could be useful. Thank you.
> > Tomas.
> >
> >
> >> ------------ Pôvodná správa ------------
> >> Od: Michael Droettboom <md...@st...>
> >> Predmet: Re: [Matplotlib-users] imshow memory problem
> >> Dátum: 17.5.2010 16:48:55
> >> ----------------------------------------
> >> On Linux, I only see about an extra 24kb being used when the canvas 
> >> is added to a window vs. not adding it (i.e. commenting out the 
> >> window.add(canvas) line).
> >>
> >> In general, here's the memory usage to be expected from imshow (if 
> >> it's a floating-point, not-rgb(a) array as you have here):
> >>
> >> The original data: 4-bytes-per-pixel for float32 or 8-bytes-per-pixel 
> >> for float64 (in your example the array is float64).
> >> Intermediate float data: *if* the original is not float64, then an 
> >> intermediate float64 is created (not the case here)
> >> The colorized data: 4-bytes-per-pixel at original array size
> >> The sized data: 4-bytes-per-pixel at the scaled figure size
> >>
> >> I hope I'm not forgetting anything, but the point is that to support 
> >> high-speed rendering of plots, the memory usage is much greater than 
> >> the data itself. If your data is truly large, the usual technique is 
> >> to decimate or downsample it before passing it to matplotlib, as 
> >> you're not going to see more data points than pixels on your display 
> >> anyway.
> >>
> >> Mike
> >>
> >> Tomáš Faragó wrote:
> >> > Hello,
> >> > I am writing a GUI using GTK+ library. I have a question about axes 
> >> class
> >> imshow method memory consumtion. If I pass the imshow an array, the 
> >> resulting
> >> memory consuption is approximatelly 46 times greater than the array 
> >> size. If I
> >> do not add the canvas to a window (in a code below), the memory 
> >> consuption is
> >> "only" 8 times greater. Any tips on how to reduce the memory 
> >> consuption would be
> >> very appreciated and any explanation of how much memmory imshow 
> >> allocates too.
> >> Configuration and script are below.
> >> >
> >> > os: Windowx XP
> >> > matplotlib version: 0.99.1
> >> > downloaded from: sourceforge.net
> >> >
> >> > script:
> >> > from matplotlib.figure import Figure
> >> > from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
> >> > from pylab import rand
> >> > import gtk
> >> >
> >> > window = gtk.Window()
> >> > window.connect("destroy", gtk.main_quit)
> >> >
> >> > figure = Figure(figsize=(8,6), dpi=72)
> >> > canvas = FigureCanvasGTKAgg(figure)
> >> > axes = figure.add_subplot(111)
> >> >
> >> > window.add(canvas)
> >> >
> >> > axes.imshow(rand(1024,1024))
> >> > canvas.draw()
> >> > window.show_all()
> >> >
> >> > gtk.main()
> >> >
> >> > verbose-helpful output:
> >> > $HOME=C:\Documents and Settings\Sensej
> >> > CONFIGDIR=C:\Documents and Settings\Sensej\.matplotlib
> >> > matplotlib data path C:\Python26\lib\site-packages\matplotlib\mpl-data
> >> > loaded rc file 
> >> C:\Python26\lib\site-packages\matplotlib\mpl-data\matplotlibrc
> >> > matplotlib version 0.99.1
> >> > verbose.level helpful
> >> > interactive is False
> >> > units is False
> >> > platform is win32
> >> > Using fontManager instance from C:\Documents and
> >> Settings\Sensej\.matplotlib\fontList.cache
> >> > backend GTKAgg version 2.12.1
> >> > findfont: Matching
> >>
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> 
> >>
> >> to Bitstream Vera Sans
> >> (C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf) 
> >> with
> >> score of 0.000000
> >> >
> >> > Thank you,
> >> > Tomas.
> >> >
> >> >
> >>
> ------------------------------------------------------------------------------ 
> >>
> >> >
> >> > _______________________________________________
> >> > Matplotlib-users mailing list
> >> > Mat...@li...
> >> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >> > 
> >> -- 
> >> Michael Droettboom
> >> Science Software Branch
> >> Operations and Engineering Division
> >> Space Telescope Science Institute
> >> Operated by AURA for NASA
> >>
> >>
> >>
> >>
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> 
> 
From: Ryan M. <rm...@gm...> - 2010年05月18日 15:06:38
On Mon, May 17, 2010 at 10:08 AM, hettling <het...@fe...> wrote:
> Dear all,
>
> I'm struggling with the following problem plotting my data:
>
> I have a figure with two panels next to each other, which I want to
> label 'A' and 'B'. I want to left-justify my panel labels, but not to
> the box that contains the plot, but to the y-axis label. I played around
> with 'text()' and 'title()', but did not find a good solution except for
> giving the coordinates manually to 'text()'. This would be very
> inconvenient though, because I have many different plots on different
> scales.
> Here is what I tried:
>
> ###Code
> import scipy
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(121)
> plt.plot(scipy.sin(scipy.arange(1,100, 0.001)))
> plt.xlabel('xlabel')
> plt.ylabel("ylabel")
> plt.text(0,1,"A", fontsize=14, transform=ax.transAxes)
>
> ax = fig.add_subplot(122)
> plt.plot(scipy.cos(scipy.arange(1,100, 0.001)))
> plt.text(0,1,"B", fontsize=14, transform=ax.transAxes)
> plt.xlabel('xlabel')
> ###End Code
>
> So the texts 'A' and 'B' should be a little bit higher and more to the
> left. The 'A' I want to align with the y-axis label of the left plot,
> the 'B' with the values of the y-axis of the right plot.
I haven't thought through the solution completely, but my intuition
says that this might be helpful:
http://matplotlib.sourceforge.net/examples/pylab_examples/anchored_artists.html
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#anchoredartists
These examples show ways of anchoring artists (like Text) to certain
locations. It's probably your best bet for getting what you want.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Michael D. <md...@st...> - 2010年05月18日 14:19:21
It should only try to import that backend when configured to do so. You 
may need to change your matplotlibrc to point to your desired backend.
Mike
New2Python wrote:
> Thanks, must have skipped over that one - I added the statements and it has
> fixed it :) however now there is an issue elsewhere. I get the message
>
> File "matplotlib\backends\__init__.pyo", line 25, in pylab_setup
> ImportError: No module named backend_tkagg
>
> and the traceback call this
>
> from pylab import *
>
> I have _tkagg as an exclude
>
> looks like somebody else had this problem but nobody solved it
> http://mail.scipy.org/pipermail/scipy-user/2005-July/004777.html
>
> any one know how to solve this?
>
> I tried to include matplotlib.backends.backend_tkagg, then this popped up
> with a tkinter import error.
>
> Regards
>
> Marco
>
>
>
>
>
>
> New2Python wrote:
> 
>> Hi All,
>>
>> I hope someone can help, I have run into a few problems when trying to
>> execute an exe file created when I use py2exe with matplotlib.
>> I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
>> optimisation is python -OO
>> the files compile correctly however when I execute the exe I get an error
>> as shown below
>> this is an extract
>>
>> File "matplotlib\mlab.pyo", line 380, in <module>
>> TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'
>>
>> the traceback points to this line of my code
>>
>> from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
>>
>> does anyone know how to solve this, i have seen references made to numpy
>> but not matplotlib
>>
>> Regards
>>
>> Marco
>>
>>
>>
>>
>> 
>
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Ryan M. <rm...@gm...> - 2010年05月18日 14:17:21
On Mon, May 17, 2010 at 6:07 AM, Ruben Moor <rub...@gm...> wrote:
> Hello,
> I plot views of 3D data without axis. The plotting results usually in plenty
> of surrounding white space. Is there an easy way to get rid of it (easy
> meaning without having to keep track of the spacial extension of my 3D data)
> ?
figure.subplots_adjust() can be used to control various margins within
the figure. When saving with savefig(), you can also specify
bbox_inches='tight' which tells it to figure out the actual bounding
box of you plot for saving, which eliminates a lot of whitespace.
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: Michael D. <md...@st...> - 2010年05月18日 14:09:33
We went through this a few years ago on the Cairo mailing list. 
The short answer is you need to copy the fonts from mpl-data to 
C:\Windows\Fonts to correctly use Cairo.
The long answer: Cairo uses fontconfig for font lookup, which by default 
searches the system font directory (C:\Windows\Fonts). There is an 
fontconfig API to add another font directory to search, but it is not 
exposed to Python. The cairo guys don't want to expose it in pycairo 
because that API is not technically part of cairo, but there isn't a 
proper Python wrapper to fontconfig, so until one is created we're sort 
of left with our hands tied.
This is probably worthy of a FAQ in the docs.
Mike
cop...@gm... wrote:
> Hallo,
>
> I'm try to use MathTextParser output for cairo in my wxpython gui. Works well under ubunutu linux (maybe dublicated font) but fails under windows (screenshot: http://www.ubuntu-pics.de/bild/62985/auswahl_017_RC86gk.png ).
>
> How to tell cairo to use the font file from mpl-data?
>
> Here some code:
>
> from matplotlib.mathtext import MathTextParser
> from matplotlib.font_manager import ttfFontProperty
> import wx
> import wx.lib.wxcairo
> import cairo
>
> #...
> MPC = MathTextParser("Cairo")
> dc = wx.BufferedPaintDC(self)
> ctx = wx.lib.wxcairo.ContextFromDC(dc)
> #...
> width, height, descent, glyphs, rects = self.mathtext_parser.parse(r"$a_0+a_1\xi+a_2\xi^2+a_3\xi^3$",dpi,prop)
> #...
>
> for font, fontsize, s, ox, oy in glyphs:
> #...
> fontProp = ttfFontProperty(font)
> #...
> ctx.select_font_face (fontProp.name,
> self.fontangles [fontProp.style],
> self.fontweights[fontProp.weight])
>
> #...
> ctx.show_text(s.encode("utf-8"))
> #...
> #...
>
> greetz
>
> Frank
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Nick S. <N.S...@du...> - 2010年05月18日 13:56:21
Hi all,
Is there anyway of re-ploting the distribution generated by hist at a
later point? I want to call it in a subroutine and have the resulting
distributions returned so I can plot them without having to
recalculate them each time. I couldn't find anything int he online
documentation but I figured it'd be something like:
import matplotlib.pyplot as plt
hplot=plt.hist(data, bins=1000)
plt.hist(hplot)
or
plt.hist(hplot[0],bins=hplot[1])
or
plt.plot(hist)
etc, but nothing works.
-- 
Cheers,
Nick Schurch
Data Analysis Group (The Barton Group),
School of Life Sciences,
University of Dundee,
Dow St,
Dundee,
DD1 5EH,
Scotland,
UK
Tel: +44 1382 388707
Fax: +44 1382 345 893
From: Nick S. <nic...@go...> - 2010年05月18日 13:53:44
Hi all,
Is there anyway of re-ploting the distribution generated by hist at a
later point? I want to call it in a subroutine and have the resulting
distributions returned so I can plot them without having to
recalculate them each time. I couldn't find anything int he online
documentation but I figured it'd be something like:
import matplotlib.pyplot as plt
hplot=plt.hist(data, bins=1000)
plt.hist(hplot)
or
plt.hist(hplot[0],bins=hplot[1])
or
plt.plot(hist)
etc, but nothing works.
Cheers,
Nick Schurch
From: Richard H. <ric...@io...> - 2010年05月18日 12:51:21
Hi,
I wanted to plot a coastline of Scandinavia with basemap in intermediate 
resolution without lakes.
The method i found was to draw the coastlines with the plot command 
using the coastline polygons from the projection.
(see example below, the lakes are filled with a slightly darker gray for 
illustration).
Please reply, if a more condensed version (e.g. 
proj.drawcoastlines(draw_lakes=False ?) is existing.
from pylab import *
from mpl_toolkits.basemap import Basemap
proj = Basemap(projection='lcc',
 resolution='i',
 llcrnrlon=9.0,
 llcrnrlat=53.0,
 urcrnrlon=35.0,
 urcrnrlat=65.3,
 lat_0=55.0,
 lon_0=14.0)
figure()
for i,cp in enumerate(proj.coastpolygons):
 if proj.coastpolygontypes[i]<2:
 proj.plot(cp[0],cp[1],'k-')
proj.fillcontinents([0.8,0.8,0.8],lake_color=[0.75,0.75,0.75])
proj.drawmeridians(arange(12,30,4),linewidth=0.3,labels=[0,0,0,1])
proj.drawparallels(arange(54,67,2),linewidth=0.3,labels=[1,0,0,0])
show()
Richard
(i am using basemap v0.99.5)
From: New2Python <new...@li...> - 2010年05月18日 12:39:38
Thanks, must have skipped over that one - I added the statements and it has
fixed it :) however now there is an issue elsewhere. I get the message
 File "matplotlib\backends\__init__.pyo", line 25, in pylab_setup
ImportError: No module named backend_tkagg
and the traceback call this
from pylab import *
I have _tkagg as an exclude
looks like somebody else had this problem but nobody solved it
http://mail.scipy.org/pipermail/scipy-user/2005-July/004777.html
any one know how to solve this?
I tried to include matplotlib.backends.backend_tkagg, then this popped up
with a tkinter import error.
Regards
Marco
New2Python wrote:
> 
> Hi All,
> 
> I hope someone can help, I have run into a few problems when trying to
> execute an exe file created when I use py2exe with matplotlib.
> I have python2.5, matplotlib v0.99.1 and py2exe from GUI2Exe v0.5.0
> optimisation is python -OO
> the files compile correctly however when I execute the exe I get an error
> as shown below
> this is an extract
> 
> File "matplotlib\mlab.pyo", line 380, in <module>
> TypeError: unsupported operand type(s) for %: 'NoneType' and 'dict'
> 
> the traceback points to this line of my code
> 
> from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg
> 
> does anyone know how to solve this, i have seen references made to numpy
> but not matplotlib
> 
> Regards
> 
> Marco
> 
> 
> 
> 
-- 
View this message in context: http://old.nabble.com/py2exe-and-matplotlib-errors-when-executing-exe-tp28589875p28595304.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Tomáš F. <sen...@em...> - 2010年05月18日 10:56:41
Thanks for replying Mike,
I tried it on Linux as well but I ran into the same problem. Perhaps it has something to do with other needed libraries (GTK+, etc.). Can you please tell me your libraries versions? I mean GTK+, pygtk, etc. Also output produced by --verbose-helpful could be useful. Thank you.
Tomas.
> ------------ Pôvodná správa ------------
> Od: Michael Droettboom <md...@st...>
> Predmet: Re: [Matplotlib-users] imshow memory problem
> Dátum: 17.5.2010 16:48:55
> ----------------------------------------
> On Linux, I only see about an extra 24kb being used when the canvas is 
> added to a window vs. not adding it (i.e. commenting out the 
> window.add(canvas) line).
> 
> In general, here's the memory usage to be expected from imshow (if it's 
> a floating-point, not-rgb(a) array as you have here):
> 
> The original data: 4-bytes-per-pixel for float32 or 8-bytes-per-pixel 
> for float64 (in your example the array is float64).
> Intermediate float data: *if* the original is not float64, then an 
> intermediate float64 is created (not the case here)
> The colorized data: 4-bytes-per-pixel at original array size
> The sized data: 4-bytes-per-pixel at the scaled figure size
> 
> I hope I'm not forgetting anything, but the point is that to support 
> high-speed rendering of plots, the memory usage is much greater than the 
> data itself. If your data is truly large, the usual technique is to 
> decimate or downsample it before passing it to matplotlib, as you're not 
> going to see more data points than pixels on your display anyway.
> 
> Mike
> 
> Tomáš Faragó wrote:
> > Hello,
> > I am writing a GUI using GTK+ library. I have a question about axes class
> imshow method memory consumtion. If I pass the imshow an array, the resulting
> memory consuption is approximatelly 46 times greater than the array size. If I
> do not add the canvas to a window (in a code below), the memory consuption is
> "only" 8 times greater. Any tips on how to reduce the memory consuption would be
> very appreciated and any explanation of how much memmory imshow allocates too.
> Configuration and script are below.
> >
> > os: Windowx XP
> > matplotlib version: 0.99.1
> > downloaded from: sourceforge.net
> >
> > script:
> > from matplotlib.figure import Figure
> > from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg
> > from pylab import rand
> > import gtk
> >
> > window = gtk.Window()
> > window.connect("destroy", gtk.main_quit)
> >
> > figure = Figure(figsize=(8,6), dpi=72)
> > canvas = FigureCanvasGTKAgg(figure)
> > axes = figure.add_subplot(111)
> >
> > window.add(canvas)
> >
> > axes.imshow(rand(1024,1024))
> > canvas.draw()
> > window.show_all()
> >
> > gtk.main()
> >
> > verbose-helpful output:
> > $HOME=C:\Documents and Settings\Sensej
> > CONFIGDIR=C:\Documents and Settings\Sensej\.matplotlib
> > matplotlib data path C:\Python26\lib\site-packages\matplotlib\mpl-data
> > loaded rc file C:\Python26\lib\site-packages\matplotlib\mpl-data\matplotlibrc
> > matplotlib version 0.99.1
> > verbose.level helpful
> > interactive is False
> > units is False
> > platform is win32
> > Using fontManager instance from C:\Documents and
> Settings\Sensej\.matplotlib\fontList.cache
> > backend GTKAgg version 2.12.1
> > findfont: Matching
> :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium
> to Bitstream Vera Sans
> (C:\Python26\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf) with
> score of 0.000000
> >
> > Thank you,
> > Tomas.
> >
> >
> ------------------------------------------------------------------------------
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Operations and Engineering Division
> Space Telescope Science Institute
> Operated by AURA for NASA
> 
> 
> 
> 

Showing 18 results of 18

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 によって変換されたページ (->オリジナル) /