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 18 results of 18

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"})
From: per f. <per...@gm...> - 2009年11月13日 15:38:00
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.
From: Jouni K. S. <jk...@ik...> - 2009年11月13日 15:23:24
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, but at least
the simplest form of metadata could be supported pretty easily (the
document information dictionary - title, author, subject, keywords,
creator, producer, creation date, modification date). What sort of API
do you have in mind?
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Fabrice S. <si...@lm...> - 2009年11月13日 10:52:42
r7591 introduced an extra argument in the call of
fig.canvas.stop_event_loop in the mouse_event_stop method of the
BlockingMouseInput class (in blocking_input.py line 199).
But, in the GTK backend, fig.canvas.stop_event_loop only takes the
instance object as input.
I can't figure out whether the change in r7591 is linked to a change in
a particular backend other than GTK*...
-- 
Fabrice Silva
Laboratory of Mechanics and Acoustics - CNRS
31 chemin Joseph Aiguier, 13402 Marseille, France.
From: Celil R. <cel...@gm...> - 2009年11月13日 08:28:42
Thanks!
I can confirm the patches fixes the issue on my computer.
Celil
On Thu, Nov 12, 2009 at 9:33 AM, Jouni K. Seppänen <jk...@ik...> wrote:
> Celil Rufat <cel...@gm...> writes:
>
> > However, when I try one of the Qt4 examles:
> [...]
> > File
> >
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/font_manager.py",
> > line 303, in get_fontconfig_fonts
> > status, output = commands.getstatusoutput("fc-list file")
> > File
> >
> "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/commands.py",
> > line 56, in getstatusoutput
> > text = pipe.read()
> > IOError: [Errno 4] Interrupted system call
>
> I believe the attached patch (already committed to the trunk) should fix
> this on Python 2.6, but I don't have a Qt installation to try it out
> with. Can you try this on your system?
>
> --
> Jouni K. Seppänen
> http://www.iki.fi/jks
>
>
>
> ------------------------------------------------------------------------------
> 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: Geoffrey E. <ge...@us...> - 2009年11月13日 02:12:13
On Nov 12, 2009, at 4:32 PM, Jae-Joon Lee wrote:
> shape = fig.canvas.get_width_height()[::-1] + (4,)
>
> im = np.frombuffer(fig.canvas.buffer_rgba(0,0),
> dtype=np.uint8).reshape(shape)
>
> Using buffer_rgba is more efficient than using tostring_rgb as no
> memory is allocated. But, I believe that "im" is a read-only "view" of
> the canvas. So, you must make a copy if you want to show it with
> imshow as in your original code.
>
> If you're using PIL,
>
> import PIL.Image
>
> im2=PIL.Image.frombuffer("RGBA", fig.canvas.get_width_height(),
> fig.canvas.buffer_rgba(0,0), "raw", "RGBA", 
> 0, 1)
Work perfectly. Thanks, JJ!
-Geoff
From: Eric F. <ef...@ha...> - 2009年11月13日 01:15:42
Ryan Neve wrote:
> Eric,
> 
> Here's a pcolor plot of the same data:
> contour_plot = pyplot.pcolor(x_grid,y_grid,z_grid_masked)
> http://imgur.com/iL4k7.png
It looks to me like this is more suitable for showing your data than 
contourf would be.
> 
> For contourf I'm using:
> contour_plot = 
> pyplot.contourf(x_grid,y_grid,z_grid_masked,contour_levels,origin='upper',\
> extent=extent,cmap=pyplot.cm.jet)
> 
> ... where there are 256 evenly spaced contour_levels.
And again, I think contourf makes sense with 10-20 levels, but not with 256.
> Note that we have many more points on the Y (depth) axis than the X 
> (time). Each Y axis column originally had about 50 irregularly spaced 
> data points, but I used scipy.interpolate.interp1d to make my grid even. 
> I then increased the density substantially to smooth the data.
> I don't know if this matters.
Do you really want to smooth it, or do you want to simply show the data? 
 You have big jumps from one sample time to the next. I don't see that 
it makes sense to to smooth heavily in the vertical; but I don't know 
what kind of measurement you are plotting or for what purpose.
> 
> I'm not familiar with pcolorfast & pcolormesh, but I'll look in to that 
> tomorrow.
They are less general than pcolor, but much faster.
Eric
> 
> Many Thanks,
> 
> -Ryan
> 
> On Thu, Nov 12, 2009 at 1:11 PM, Eric Firing <ef...@ha... 
> <mailto:ef...@ha...>> wrote:
> 
> Ryan Neve wrote:
> 
> Thank you for the suggestion, but I couldn't see a difference
> with "antialiased" either True or False. The lines between
> contour levels remain.
> I tried a different colormap (spectral) but it had the same
> effect. I tried more color levels (256) but the effect got worse.
> 
> I can't find any example pictures online of matplotlib's
> contourf() producing a "smooth" plot, I know matlab's does it:
> http://www.mbari.org/bog/Projects/CentralCal/summary/images/m1_nuts_ts_contour.jpg
> 
> 
> That looks to me like a pcolor plot, not a contourf plot, regardless
> of what the file name says. And, maybe it is my eyes, but it looks
> to me like there are artifacts in the colorbar. In any case, if you
> are plotting a very densely sampled data set, you may want to use
> the Axes.pcolorfast method or the pcolormesh function or method
> instead of contourf. Contouring, filled or not, is suitable for
> data in which you want to bring out a moderate number of regions,
> not for data with highly complex structure and texture, or if you
> want essentially a smooth color progression.
> 
> Eric
> 
> 
> 
> -Ryan
> 
> 
> On Wed, Nov 11, 2009 at 5:08 PM, Eric Firing <ef...@ha...
> <mailto:ef...@ha...> <mailto:ef...@ha...
> <mailto:ef...@ha...>>> wrote:
> 
> Ryan Neve wrote:
> 
> Hello,
> In my filled contour plot: http://imgur.com/vXoCL.png
> There are faint lines between the contour levels. I think
> they
> are yellow since they disappear in the yellow parts of
> the graph
> and are most obvious in the red areas. Is there any way
> to get
> rid of these lines? The number of contour levels is
> arbitrary,
> and I don't need them emphasized with a moire pattern.
> 
From: Jae-Joon L. <lee...@gm...> - 2009年11月13日 00:32:50
On Thu, Nov 12, 2009 at 6:32 PM, Geoffrey Ely <ge...@us...> wrote:
> Thanks for the help. With that I get:
>
> AttributeError: 'function' object has no attribute '__buffer__'
>
>
shape = fig.canvas.get_width_height()[::-1] + (4,)
im = np.frombuffer(fig.canvas.buffer_rgba(0,0),
 dtype=np.uint8).reshape(shape)
Using buffer_rgba is more efficient than using tostring_rgb as no
memory is allocated. But, I believe that "im" is a read-only "view" of
the canvas. So, you must make a copy if you want to show it with
imshow as in your original code.
If you're using PIL,
import PIL.Image
im2=PIL.Image.frombuffer("RGBA", fig.canvas.get_width_height(),
 fig.canvas.buffer_rgba(0,0), "raw", "RGBA", 0, 1)
Regards,
-JJ

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