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





Showing results of 346

<< < 1 .. 6 7 8 9 10 .. 14 > >> (Page 8 of 14)
From: Andres L. <and...@ut...> - 2009年11月16日 15:07:33
Attachments: contourf_probl_subm.py
Hello,
I want to plot two sets of masked data on a single plot and I can not 
get exactly the kind of image I want to. I have tried pcolormesh and 
contourf and both have problems. With contourf the inner data does not 
look smooth and sometimes has a row of missing data around it, with 
pcolormesh, on the other hand, I can not control the levels in the way I 
want to.
So, as is in the documentation, contourf may have problems with masked 
data, so I can skip that solution. But how do I achieve controlled color 
levels as I can do with contourf, but using pcolormesh? Attached code 
illustrates the images I get with two methods.
Best regards,
Andres
From: <mar...@if...> - 2009年11月16日 15:02:37
John Hunter <jd...@gm...> schrieb am 16.11.2009 15:14:31:
> On Mon, Nov 16, 2009 at 6:16 AM, <mar...@if...> wrote:
> >
> > Hello everyone,
> >
> > I use the following C-Code in visual studio 2005 (I start the program 
with
> > "Release" configuration):
> >
> > #include <Python.h>
> > #include <iostream>
> > using namespace std;
> >
> > void main()
> > {
> > Py_Initialize();
> >
> > while (1)
> > {
> > char test[100] = {};
> > cout<<">>> ";
> > cin.getline(test, 100);
> > PyRun_SimpleString(test);
> >
> > }
> >
> > Py_Finalize();
> > }
> >
> > for my first tries to embed python in C.
> > However if I try to import pylab (from pylab import *) I get the 
following
> > error:
> >
> >>>> from pylab import *
> > Traceback (most recent call last):
> > File "<string>", line 1, in <module>
> > File "C:\Python26\lib\site-packages\pylab.py", line 1, in <module>
> > from matplotlib.pylab import *
> > File "C:\Python26\lib\site-packages\matplotlib\pylab.py", line 206, 
in
> > <module>
> > from matplotlib import mpl # pulls in most modules
> > File "C:\Python26\lib\site-packages\matplotlib\mpl.py", line 1, in
> > <module>
> > from matplotlib import artist
> > File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 5, 
in
> > <module>
> > from transforms import Bbox, IdentityTransform, TransformedBbox,
> > TransformedPath
> > File "C:\Python26\lib\site-packages\matplotlib\transforms.py", line 
34, in
> > <module>
> > from matplotlib._path import affine_transform
> > ImportError: DLL load failed: Eine DLL-Initialisierungsroutine ist
> > fehlgeschlagen.
> 
> What version of matplotlib are you using? There were some linker
> problems with 0.98.x similar to the ones you are showing with
> python2.6, but these should be solved with 0.99.x. Also, I wouldn't
> recommend importing pylab or pyplot if you are going to try embedding
> mpl in C. You should use the API -- what you are trying is difficult
> enough w/o dealing with some of the pylab magic like runtime backend
> detection.
I have version 0.99.1 of matplotlib.
With Windows XP and Python 2.6.2
My first thought was also that there might be a linker problem.
From: John H. <jd...@gm...> - 2009年11月16日 14:24:11
On Mon, Nov 16, 2009 at 4:12 AM, XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX wrote:
> Hi,
>
> I'd like to know if it's possible to do something like this in matplotlib:
>
> I want to create a 2D plot with legend, output as PNG. I also want to
> embed a logo in it, in the top right corner of the plotting area. If
> the original logo image is a 40px by 40px PNG, I want it to appear at
> that size exactly as it is in the original logo.
>
> Even if I can't do this directly, I might be able to fudge it if
> matplotlib tells me the exact (pixel) dimensions of the plot area —
> then I could scale and offset the secondary axes, convert the logo PNG
> to RGB values and plot that (or use Python to invoke an imagemagick
> subprocess and pass it those numbers... anything, really).
>
> Is it possible to get this info from matplotlib, or is there a better
> way to do this?
See
 http://matplotlib.sourceforge.net/examples/api/watermark_image.html
for an example of embedding a watermark image in mpl.
To compute figure size, multiply the DPI setting by the figure
dimensions in inches:
dpi = 100 # dpi, whatever value you want
width, height = 6,4 # in inches, whatever values you want
fig = plt.figure(figsize=(width, height), dpi=dpi)
pixelw = dpi * width # pixel width of figure
pixelh = dpi * height # pixel height of figure
# now watermark you figure as in the example linked above, passing the
pixel coords of the lower left corner of the image to figimage
# this last piece is important: pass dpi to savefig too since mpl
supports different dpi for display and hardcopy
fig.savefig(myfile, dpi=dpi)
JDH
From: John H. <jd...@gm...> - 2009年11月16日 14:18:04
On Fri, Nov 13, 2009 at 2:24 PM, Christopher Barker
<Chr...@no...> wrote:
> qu...@gm... wrote:
>> I would like to be able to dock some figures into one window
>> and be able to look at them by tabs or something similar.
>>
>> Is something like that already implemented or does someone know
>> of a widget that can do that?
>
> This should be support on with any of the GUI toolkits -- I"d pick which
> one you want depending on other reasons:
> - which one you are familiar with
> - which one you're using for other projects
> - etc, etc,
>
> With wx, for instance, you'd put each MPL plot on a wxNoteBook page.
For wx, this is illustrated in this example:
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx5.html
JDH
From: John H. <jd...@gm...> - 2009年11月16日 14:14:47
On Mon, Nov 16, 2009 at 6:16 AM, <mar...@if...> wrote:
>
> Hello everyone,
>
> I use the following C-Code in visual studio 2005 (I start the program with
> "Release" configuration):
>
> #include <Python.h>
> #include <iostream>
> using namespace std;
>
> void main()
> {
>     Py_Initialize();
>
>     while (1)
>     {
>         char test[100] = {};
>         cout<<">>> ";
>         cin.getline(test, 100);
>         PyRun_SimpleString(test);
>
>     }
>
>     Py_Finalize();
> }
>
> for my first tries to embed python in C.
> However if I try to import pylab (from pylab import *) I get the following
> error:
>
>>>> from pylab import *
> Traceback (most recent call last):
>  File "<string>", line 1, in <module>
>  File "C:\Python26\lib\site-packages\pylab.py", line 1, in <module>
>   from matplotlib.pylab import *
>  File "C:\Python26\lib\site-packages\matplotlib\pylab.py", line 206, in
> <module>
>   from matplotlib import mpl # pulls in most modules
>  File "C:\Python26\lib\site-packages\matplotlib\mpl.py", line 1, in
> <module>
>   from matplotlib import artist
>  File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 5, in
> <module>
>   from transforms import Bbox, IdentityTransform, TransformedBbox,
> TransformedPath
>  File "C:\Python26\lib\site-packages\matplotlib\transforms.py", line 34, in
> <module>
>   from matplotlib._path import affine_transform
> ImportError: DLL load failed: Eine DLL-Initialisierungsroutine ist
> fehlgeschlagen.
What version of matplotlib are you using? There were some linker
problems with 0.98.x similar to the ones you are showing with
python2.6, but these should be solved with 0.99.x. Also, I wouldn't
recommend importing pylab or pyplot if you are going to try embedding
mpl in C. You should use the API -- what you are trying is difficult
enough w/o dealing with some of the pylab magic like runtime backend
detection.
See
http://matplotlib.sourceforge.net/faq/howto_faq.html#matplotlib-in-a-web-application-server
http://matplotlib.sourceforge.net/faq/installing_faq.html#what-is-a-backend
http://matplotlib.sourceforge.net/faq/usage_faq.html#matplotlib-pylab-and-pyplot-how-are-they-related
http://matplotlib.sourceforge.net/users/artists.html
From: John H. <jd...@gm...> - 2009年11月16日 14:10:04
On Mon, Nov 16, 2009 at 7:32 AM, Tsviki Hirsh <tsv...@gm...> wrote:
> Dear list,
> How can I use hist without plotting?
> e.g.
> h=hist(Z)
> and then to only use the output of "h" without wasting time on plotting?
Use numpy.histogram -- that's what mpl uses.
JDH
From: Tsviki H. <tsv...@gm...> - 2009年11月16日 13:53:41
Dear list,
How can I use hist without plotting?
e.g.
h=hist(Z)
and then to only use the output of "h" without wasting time on plotting?
Thanks,
Tsviki Hirsh
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2009年11月16日 10:12:31
Hi,
I'd like to know if it's possible to do something like this in matplotlib:
I want to create a 2D plot with legend, output as PNG. I also want to
embed a logo in it, in the top right corner of the plotting area. If
the original logo image is a 40px by 40px PNG, I want it to appear at
that size exactly as it is in the original logo.
Even if I can't do this directly, I might be able to fudge it if
matplotlib tells me the exact (pixel) dimensions of the plot area —
then I could scale and offset the secondary axes, convert the logo PNG
to RGB values and plot that (or use Python to invoke an imagemagick
subprocess and pass it those numbers... anything, really).
Is it possible to get this info from matplotlib, or is there a better
way to do this?
Cheers,
Jason
From: John H. <jd...@gm...> - 2009年11月15日 12:35:09
On Fri, Nov 13, 2009 at 10:39 AM, Gregor Thalhammer
<Gre...@i-...> wrote:
> 1) I would like to stay independent of the backend, therefore I would
> prefer a approach like in idle_and_timeout
> http://matplotlib.sourceforge.net/examples/event_handling/idle_and_timeout.html
> However, with my default backend WXAgg I do not continuously idle
> events, but only once e.g. after each mouse movement. Can someone give
> me more information about the intended behaviour, current status and
> support of idle events?
I worked on this for a while and thought I had wx working but maybe I
missed something or maybe there is a wx version issue. The real
stumbling block was tk since it did not have a native idle and I was
stuck trying to make it work with threading. In and of itself, this
was OK, but it broke CTRL-C in ipython due to problems with cross
thread signal handling. So I put the project on the back burner.
Perhaps we can borrow some knowledge from the ipython developers who
have recently made good progress here in various GUIs backends.
>
> 2) I want to limit the lifetime of my connection object, that takes care
> of the communication with the microscope stage, so that the connection
> is closed if I close the matplotlib figure. I could not find a
> 'close_event'. To achieve this I could embed a matplotlib figure into a
> wx frame, but this is somewhat tediuos. For the wxagg backend, does
> somebody know a more simple solution? Do others also feel the need to
> add a close_event? In case, I could try to take care of the wx backend.
Adding a close event at the mpl level should be fairly
straight-forward, and shouldn't require much if any additional GUI
programming since we already handle the window destroy event across
backends for pylab figure management.
JDH
From: Taro S. <ub...@gm...> - 2009年11月15日 05:36:09
Taro Sato-4 wrote:
> 
> Hello. I'm trying to embed mpl in an wxpython app which is intended
> to run repeatedly within a single script. (It's a workaround for not
> being able to use pyplot.show() more than once in a script.)
> 
> All seems to work as intended when I don't attach any key press events
> (here to just destroy the app) to canvas, but when I do, as in the
> script below, for some reason I keep getting errors that appear to
> indicate that some remnant of the zombie of the previous app instance
> may be sticking around when they shouldn't exist. Both the script in
> question and the (typical) error message are shown below in this
> message.
> 
> 
I think I figured out what causes wx._core.PyDeadObjectError above.
In backend_bases.py, LocationEvent class has the attribute lastevent
(initially set to None) which keeps the Event instance of a previous event. 
LocationEvent._update_enter_leave() method processes axes_leave_event for
lastevent if not None, and then processes axes_enter_event for the current
event.
When an application window first gets created, lastevent is set to None. 
When the application is destroyed and a new instance of the application is
created, lastevent needs to be reset to None, which apparently is not
happening. The reference to the previous event which occurred within the
destroyed application is being accessed via lastevent, hence the
PyDeadObjectError.
I'm not sure what the best timing is to rest lastevent (I'm not thoroughly
familiar with mpl source codes). But modifying
LocationEvent._update_enter_leave() such that the PyDeadObjectError
exception raised by accessing lastevent solves the specific issue in the
original post. 
Should I file a bug report on this?
Cheers,
Taro
-- 
View this message in context: http://old.nabble.com/Strange-event-errors-with-WXAgg-%2B-wx-tp26312977p26355887.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Brian B. <bb...@br...> - 2009年11月15日 00:10:05
On Nov 14, 2009, at 17:40 , Jae-Joon Lee wrote:
What backend are you using?
ah! it seems to work with the tkagg backend, but not the wxagg backend.
I am using ipython with the -pylab flag.
I remember having some problem with the tk backend (perhaps when I 
was doing some wx embedding), but I can't recall what it was. is 
there a reason the wx backend doesn't work as I expect?
on a related note, is there a way in ipython to specify the backend 
for the -pylab flag, overriding the one specified in matplotlibrc?
		thanks,
			bb
There was a similar report that the "draw" method of the qt4agg
backend does not update the screen immediately but wait until it gets
idle.
See if using other backends makes any change.
import numpy
import matplotlib.pyplot as plt
h,=plt.plot([1,2,3])
plt.ylabel('some numbers')
plt.show()
for i in range(100):
 h.set_ydata(numpy.random.rand(3)*2+1)
 plt.draw()
-- 
Brian Blais
bb...@br...
http://web.bryant.edu/~bblais
From: Jae-Joon L. <lee...@gm...> - 2009年11月14日 22:41:28
What backend are you using?
There was a similar report that the "draw" method of the qt4agg
backend does not update the screen immediately but wait until it gets
idle.
See if using other backends makes any change.
-JJ
On Sat, Nov 14, 2009 at 3:21 PM, Brian Blais <bb...@br...> wrote:
> Hello,
> I was wondering why the following animation doesn't work. I thought it did
> work before, but perhaps I am misremembering. I am on OS X 10.4, matplotlib
> version 0.99.0 from the enthought distribution.  I must be thinking about
> this wrong someone, but I thought that if you did a plot, then updated the
> data on the plot object, and called draw that it would actually draw it
> (like it does in matlab). right now it just gives me a blank figure, with a
> busy mouse icon, and then shows the last plot done.
> thanks,
> Brian Blais
>
>
> import numpy
> import matplotlib.pyplot as plt
> h,=plt.plot([1,2,3])
> plt.ylabel('some numbers')
> plt.show()
> for i in range(100):
>   h.set_ydata(numpy.random.rand(3)*2+1)
>   plt.draw()
>
>
>
>
> --
> Brian Blais
> bb...@br...
> http://web.bryant.edu/~bblais
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Jae-Joon L. <lee...@gm...> - 2009年11月14日 22:32:01
What version of matplotlib are you using?
With the current svn, your code works okay.
-JJ
On Fri, Nov 13, 2009 at 10:37 AM, per freem <per...@gm...> wrote:
> hi all,
>
> i am trying to adjust the space (padding) between the tickmarks on an
> axes and the labels. usually, i can do this by setting
> 'xtick.major.pad' and 'xtick.minor.pad' (and same for y-axis) in
> rcParams. however, when i try to do this with a figure made using the
> "SubplotZero" function, it seems to only work for the y-axis and not
> the x-axis for some reason -- here is an example:
>
> import matplotlib
> matplotlib.use('PDF')
> import matplotlib.pyplot as plt
> from matplotlib import rc
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['ps.useafm'] = True
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['pdf.fonttype'] = 42
> plt.rcParams['font.size'] = 10
> from mpl_toolkits.axes_grid.axislines import SubplotZero
>
> def setup_axes(fig, labelpad=1, invisible=["bottom", "top", "right"]):
>  plt.rcParams['ytick.major.pad'] = 2
>  plt.rcParams['ytick.minor.pad'] = 2
>  # Y ticks work, but X tick do not...
>  plt.rcParams['xtick.major.pad'] = 0.01
>  plt.rcParams['xtick.minor.pad'] = 0.01
>  ax = SubplotZero(fig, 1, 1, 1)
>  fig.add_subplot(ax)
>  # make xzero axis (horizontal axis line through y=0) visible.
>  ax.axis["xzero"].set_visible(True)
>  # make other axis (bottom, top, right) invisible.
>  for n in invisible:
>    ax.axis[n].set_visible(False)
>  return ax
>
> fig = plt.figure(figsize=(5, 5), dpi=300)
> setup_axes(fig, labelpad=2)
> x = range(1, 11)
> y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
> plt.plot(x, y)
> ax = plt.gca()
> plt.savefig('test.pdf')
>
> i am seeing the ylabels get closer to the y-axis, but the x-axis seems
> to have no effect. it seems to be related to SubplotZero since
> otherwise in ordinary plots this works fine. any idea how this could
> be fixed?
>
> thanks very much for your help.
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Brian B. <bb...@br...> - 2009年11月14日 21:21:56
Hello,
I was wondering why the following animation doesn't work. I thought 
it did work before, but perhaps I am misremembering. I am on OS X 
10.4, matplotlib version 0.99.0 from the enthought distribution. I 
must be thinking about this wrong someone, but I thought that if you 
did a plot, then updated the data on the plot object, and called draw 
that it would actually draw it (like it does in matlab). right now 
it just gives me a blank figure, with a busy mouse icon, and then 
shows the last plot done.
thanks,
			Brian Blais
import numpy
import matplotlib.pyplot as plt
h,=plt.plot([1,2,3])
plt.ylabel('some numbers')
plt.show()
for i in range(100):
 h.set_ydata(numpy.random.rand(3)*2+1)
 plt.draw()
-- 
Brian Blais
bb...@br...
http://web.bryant.edu/~bblais
From: Darren D. <dsd...@gm...> - 2009年11月13日 22:10:26
On Thu, Nov 12, 2009 at 12:13 PM, Taro Sato <ub...@gm...> wrote:
>
>
> TheLonelyStar wrote:
>>
>>
>> /net/gorgonzola/storage/nhuesken/svn/ActiveLearning/SVM/ModelSelection/Ergebnisse/plot.pyc
>> in plot(filename, line_list, name_list, reference)
>>    6     for i in xrange(len(line_list)):
>>    7
>> plt.plot(m[:,reference],m[:,line_list[i]],label=name_list[i])
>>    8     plt.legend(loc='best')
>> ----> 9     plt.show()
>>   10
>>
>>
>
> Are you calling plt.show() more than once within a script? If so, I was
> having a similar issue, but after reading this FAQ entry:
>
> http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show
>
> I realized that the specific usage of show() is not supported (yet);
> plt.show() can only be used once within a script. Out of luck!
>
> I hope there is a resolution one way or the other, since it will make
> matplotlib so much more useful than it already is.
The problem with the Qt4 backend was already reported on this (or the
developers) list. It is a regression in PyQt4 or sip and will be fixed
in the next release.
Darren
From: TheLonelyStar <na...@lo...> - 2009年11月13日 21:35:17
Hi,
I have installed matplotlib with the "WX" and the "Qt4Agg" backend. Both
have problems:
with WX backend, I can plot something. But when I close the window and try
to plot again, nothing happens (no window opens).
with Qt4Agg I can plot something. But when I close the window and try to
plot again, I get the error I posted below.
Can something be done about one if these problems?
Thanks!
Nathan
The Error:
RuntimeError Traceback (most recent call last)
/net/gorgonzola/storage/nhuesken/svn/ActiveLearning/SVM/ModelSelection/Ergebnisse/<ipython
console> in <module>()
/net/gorgonzola/storage/nhuesken/svn/ActiveLearning/SVM/ModelSelection/Ergebnisse/plot.pyc
in plot(filename, line_list, name_list, reference)
 6 for i in xrange(len(line_list)):
 7 
plt.plot(m[:,reference],m[:,line_list[i]],label=name_list[i])
 8 plt.legend(loc='best')
----> 9 plt.show()
 10 
/export/home/nhuesken/usr/lib/python2.6/site-packages/matplotlib/backends/backend_qt4.pyc
in show()
 61 """
 62 for manager in Gcf.get_all_fig_managers():
---> 63 manager.window.show()
 64 
 65 if DEBUG: print 'Inside show'
RuntimeError: underlying C/C++ object has been deleted
-- 
View this message in context: http://old.nabble.com/matplotlib-WX-and-Qt4Agg-backends-tp26315069p26315069.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Christopher B. <Chr...@no...> - 2009年11月13日 20:22:28
qu...@gm... wrote:
> I would like to be able to dock some figures into one window
> and be able to look at them by tabs or something similar.
> 
> Is something like that already implemented or does someone know
> of a widget that can do that?
This should be support on with any of the GUI toolkits -- I"d pick which 
one you want depending on other reasons:
 - which one you are familiar with
 - which one you're using for other projects
 - etc, etc,
With wx, for instance, you'd put each MPL plot on a wxNoteBook page. 
Also, if you use wx, I'd check out wxMPL -- it's a nice wrapper for MPL 
on wx that will save you a bit of work.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Jae-Joon L. <lee...@gm...> - 2009年11月13日 19:58:01
I think I have said this a few times, but if you're using axes_grid
toolkit, it is likely that most of the ticks, ticklabels and
axis-related command of the original matplotlib may NOT work. And that
is why I recommend you to use the spines instead.
Anyhow, adjusting the pad between axis and the axis label in the
axes_grid toolkit way is
ax.axis["xzero"].LABELPAD=10
Things like "labelpad" parameters in xlabel (or ylabel) command are
currently ignored.
I don't think set_position command will work also. I f you need to
place your labels at some specific point, simply use "text" or
"annotate" command instead.
-JJ
On Fri, Nov 13, 2009 at 2:02 PM, per freem <per...@gm...> wrote:
> thanks for the suggestion, though this does not work for me in the
> following example:
>
> import matplotlib
> matplotlib.use('PDF')
> import matplotlib.pyplot as plt
> from matplotlib import rc
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['ps.useafm'] = True
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['pdf.fonttype'] = 42
> plt.rcParams['font.size'] = 10
>
> from mpl_toolkits.axes_grid.axislines import SubplotZero
>
> def setup_axes(fig, labelpad=1, invisible=["bottom", "top", "right"]):
>  plt.rcParams['ytick.major.pad'] = 2
>  plt.rcParams['ytick.minor.pad'] = 2
>  # Y ticks work, but X tick do not...
>  plt.rcParams['xtick.major.pad'] = 0.01
>  plt.rcParams['xtick.minor.pad'] = 0.01
>  ax = SubplotZero(fig, 1, 1, 1)
>  fig.add_subplot(ax)
>  # make xzero axis (horizontal axis line through y=0) visible.
>  ax.axis["xzero"].set_visible(True)
>  # make other axis (bottom, top, right) invisible.
>  for n in invisible:
>    ax.axis[n].set_visible(False)
>  return ax
>
> fig = plt.figure(figsize=(5, 5), dpi=300)
> setup_axes(fig, labelpad=2)
> x = range(1, 11)
> y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
> plt.plot(x, y, linewidth=1.5, c='k')
> plt.ylabel('hello', labelpad=10)
> xlab = plt.xlabel('hello x axis')
> xlab.set_position((0.2, 0.1))
> plt.savefig('test_logscale.pdf')
>
> the xaxis doesn't seem to be moved. any idea what might be wrong here? thanks.
>
> On Fri, Nov 13, 2009 at 1:43 PM, Gökhan Sever <gok...@gm...> wrote:
>>
>>
>> On Fri, Nov 13, 2009 at 12:36 PM, per freem <per...@gm...> wrote:
>>>
>>> hi all,
>>>
>>> how can the space between the label (e.g. thing created by
>>> plt.xlabel('mylabel')) and the axes be adjusted? i am not talking
>>> about the space between the ticklabels of the axes and the axes
>>> themselves (which is set by 'xtick.major.pad' or 'ytick.major.pad')
>>> but between the overall axes label and the axes.
>>>
>>> how can this be done? thanks.
>>>
>>
>> Using the set_position method, e.g. :
>>
>> xlab = plt.xlabel("my x-axes label")
>> xlab.set_position((0.2, 0.1))
>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day
>>> trial. Simplify your report design, integration and deployment - and focus
>>> on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>>
>> --
>> Gökhan
>>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jouni K. S. <jk...@ik...> - 2009年11月13日 19:30:46
Jouni K. Seppänen <jk...@ik...> writes:
> Marius Jan Klein <mj...@ny...> writes:
>
>> I want to edit the metadata of pdf- or png-files when creating one of
>> these files. I do not want to use for example Pypdf because then
>> Python must read the file first before it can be edited.
>
> Concerning pdf files, there is no current support for that, 
Now there is (in the trunk, revision 7964), via the PdfPages mechanism:
from matplotlib.backends.backend_pdf import PdfPages
from pylab import *
pdf = PdfPages('testing.pdf')
plot([3,1,4])
pdf.savefig()
d = pdf.infodict()
d['Title'] = 'Testing'
d['Author'] = u'Jouni K. Sepp\xe4nen'
pdf.close()
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Gökhan S. <gok...@gm...> - 2009年11月13日 19:22:33
On Fri, Nov 13, 2009 at 1:02 PM, per freem <per...@gm...> wrote:
> thanks for the suggestion, though this does not work for me in the
> following example:
>
> import matplotlib
> matplotlib.use('PDF')
> import matplotlib.pyplot as plt
> from matplotlib import rc
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['ps.useafm'] = True
> rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
> plt.rcParams['pdf.fonttype'] = 42
> plt.rcParams['font.size'] = 10
>
> from mpl_toolkits.axes_grid.axislines import SubplotZero
>
> def setup_axes(fig, labelpad=1, invisible=["bottom", "top", "right"]):
> plt.rcParams['ytick.major.pad'] = 2
> plt.rcParams['ytick.minor.pad'] = 2
> # Y ticks work, but X tick do not...
> plt.rcParams['xtick.major.pad'] = 0.01
> plt.rcParams['xtick.minor.pad'] = 0.01
> ax = SubplotZero(fig, 1, 1, 1)
> fig.add_subplot(ax)
> # make xzero axis (horizontal axis line through y=0) visible.
> ax.axis["xzero"].set_visible(True)
> # make other axis (bottom, top, right) invisible.
> for n in invisible:
> ax.axis[n].set_visible(False)
> return ax
>
You are hiding the bottom x-axis. Therefore no label is appearing on the
resulting figure. You may try not hiding it instead just the ticks. Using
ax.xaxis.set_major_locator(pylab.NullLocator())
But this causes the vertical grid lines to disappear. Alternatively you can
manually add the xlabel if you are not in batch-producing mode --using your
favorite pdf editor.
I am sure Jae-Jeon has a better explanation for this.
>
> fig = plt.figure(figsize=(5, 5), dpi=300)
> setup_axes(fig, labelpad=2)
> x = range(1, 11)
> y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
> plt.plot(x, y, linewidth=1.5, c='k')
> plt.ylabel('hello', labelpad=10)
> xlab = plt.xlabel('hello x axis')
> xlab.set_position((0.2, 0.1))
> plt.savefig('test_logscale.pdf')
>
> the xaxis doesn't seem to be moved. any idea what might be wrong here?
> thanks.
>
> On Fri, Nov 13, 2009 at 1:43 PM, Gökhan Sever <gok...@gm...>
> wrote:
> >
> >
> > On Fri, Nov 13, 2009 at 12:36 PM, per freem <per...@gm...> wrote:
> >>
> >> hi all,
> >>
> >> how can the space between the label (e.g. thing created by
> >> plt.xlabel('mylabel')) and the axes be adjusted? i am not talking
> >> about the space between the ticklabels of the axes and the axes
> >> themselves (which is set by 'xtick.major.pad' or 'ytick.major.pad')
> >> but between the overall axes label and the axes.
> >>
> >> how can this be done? thanks.
> >>
> >
> > Using the set_position method, e.g. :
> >
> > xlab = plt.xlabel("my x-axes label")
> > xlab.set_position((0.2, 0.1))
> >
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> >> 30-Day
> >> trial. Simplify your report design, integration and deployment - and
> focus
> >> on
> >> what you do best, core application coding. Discover what's new with
> >> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> >> _______________________________________________
> >> Matplotlib-users mailing list
> >> Mat...@li...
> >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> >
> >
> > --
> > Gökhan
> >
>
-- 
Gökhan
From: per f. <per...@gm...> - 2009年11月13日 19:02:18
thanks for the suggestion, though this does not work for me in the
following example:
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['pdf.fonttype'] = 42
plt.rcParams['font.size'] = 10
from mpl_toolkits.axes_grid.axislines import SubplotZero
def setup_axes(fig, labelpad=1, invisible=["bottom", "top", "right"]):
 plt.rcParams['ytick.major.pad'] = 2
 plt.rcParams['ytick.minor.pad'] = 2
 # Y ticks work, but X tick do not...
 plt.rcParams['xtick.major.pad'] = 0.01
 plt.rcParams['xtick.minor.pad'] = 0.01
 ax = SubplotZero(fig, 1, 1, 1)
 fig.add_subplot(ax)
 # make xzero axis (horizontal axis line through y=0) visible.
 ax.axis["xzero"].set_visible(True)
 # make other axis (bottom, top, right) invisible.
 for n in invisible:
 ax.axis[n].set_visible(False)
 return ax
fig = plt.figure(figsize=(5, 5), dpi=300)
setup_axes(fig, labelpad=2)
x = range(1, 11)
y = [5000, 900, 600, 500, 200, 110, 50, 20, 10, 5]
plt.plot(x, y, linewidth=1.5, c='k')
plt.ylabel('hello', labelpad=10)
xlab = plt.xlabel('hello x axis')
xlab.set_position((0.2, 0.1))
plt.savefig('test_logscale.pdf')
the xaxis doesn't seem to be moved. any idea what might be wrong here? thanks.
On Fri, Nov 13, 2009 at 1:43 PM, Gökhan Sever <gok...@gm...> wrote:
>
>
> On Fri, Nov 13, 2009 at 12:36 PM, per freem <per...@gm...> wrote:
>>
>> hi all,
>>
>> how can the space between the label (e.g. thing created by
>> plt.xlabel('mylabel')) and the axes be adjusted? i am not talking
>> about the space between the ticklabels of the axes and the axes
>> themselves (which is set by 'xtick.major.pad' or 'ytick.major.pad')
>> but between the overall axes label and the axes.
>>
>> how can this be done? thanks.
>>
>
> Using the set_position method, e.g. :
>
> xlab = plt.xlabel("my x-axes label")
> xlab.set_position((0.2, 0.1))
>
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now. http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
> --
> Gökhan
>
From: Gökhan S. <gok...@gm...> - 2009年11月13日 18:43:25
On Fri, Nov 13, 2009 at 12:36 PM, per freem <per...@gm...> wrote:
> hi all,
>
> how can the space between the label (e.g. thing created by
> plt.xlabel('mylabel')) and the axes be adjusted? i am not talking
> about the space between the ticklabels of the axes and the axes
> themselves (which is set by 'xtick.major.pad' or 'ytick.major.pad')
> but between the overall axes label and the axes.
>
> how can this be done? thanks.
>
>
Using the set_position method, e.g. :
xlab = plt.xlabel("my x-axes label")
xlab.set_position((0.2, 0.1))
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
Gökhan
From: per f. <per...@gm...> - 2009年11月13日 18:36:15
hi all,
how can the space between the label (e.g. thing created by
plt.xlabel('mylabel')) and the axes be adjusted? i am not talking
about the space between the ticklabels of the axes and the axes
themselves (which is set by 'xtick.major.pad' or 'ytick.major.pad')
but between the overall axes label and the axes.
how can this be done? thanks.
From: Gregor T. <Gre...@i-...> - 2009年11月13日 16:56:16
Hi all,
I want to use matplotlib to plot in realtime the position of a 
microscope stage, read out over a serial connection. Essentially I 
reached my goal, starting from the example simple_idle_wx.py 
http://matplotlib.sourceforge.net/examples/animation/simple_idle_wx.html
Now I have two questions
1) I would like to stay independent of the backend, therefore I would 
prefer a approach like in idle_and_timeout 
http://matplotlib.sourceforge.net/examples/event_handling/idle_and_timeout.html
However, with my default backend WXAgg I do not continuously idle 
events, but only once e.g. after each mouse movement. Can someone give 
me more information about the intended behaviour, current status and 
support of idle events?
2) I want to limit the lifetime of my connection object, that takes care 
of the communication with the microscope stage, so that the connection 
is closed if I close the matplotlib figure. I could not find a 
'close_event'. To achieve this I could embed a matplotlib figure into a 
wx frame, but this is somewhat tediuos. For the wxagg backend, does 
somebody know a more simple solution? Do others also feel the need to 
add a close_event? In case, I could try to take care of the wx backend.
Gregor
From: Marius J. K. <mj...@ny...> - 2009年11月13日 16:43:43
I have to do a lot of plots. 
I would like to put an identifier into each plot that identifies the way the plot was made.
This identifier then could point to a database that contains the script and extra information.
Here is an example: http://depth-first.com/articles/2007/08/08/never-draw-the-same-molecule-twice-viewing-image-metadata
The interface would be:
fig.savefig("example.pdf",{"creator": "2009-11-13"})
11 messages has been excluded from this view by a project administrator.

Showing results of 346

<< < 1 .. 6 7 8 9 10 .. 14 > >> (Page 8 of 14)
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 によって変換されたページ (->オリジナル) /