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






Showing 12 results of 12

From: John H. <jd...@gm...> - 2007年09月21日 17:54:53
On 9/20/07, Ryan Krauss <rya...@gm...> wrote:
> which also gets rid of my bottom x axis and leaves tick marks along
> the top (see attached). How do I get rid of the top tick marks, keep
> the bottom ones, and get the bottom x-axis back?
I think this is what you are looking for:
from pylab import figure, show
fig = figure()
ax = fig.add_subplot(111)
ax.axesFrame.set_data((0,0,1), (1,0,0))
ax.axesPatch.set_edgecolor('white')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.plot(range(10))
show()
From: Christopher B. <Chr...@no...> - 2007年09月21日 17:04:33
John Hunter wrote:
>> fig = figure()
>> fig.canvas.manager.window.move(100,400)
> Well, the example I posted was for a *gtk* window, not a tk window.
And, for what it's worth, wx spells it "Move()", with a capital "M".
-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: John H. <jd...@gm...> - 2007年09月21日 16:45:36
On 9/21/07, Yo mismo Hotmail <miq...@gm...> wrote:
> Dear John,
>
> First of all, thanks for your response. When I try this
>
> fig = figure()
> fig.canvas.manager.window.move(100,400)
>
> python tells me that window has no attribute move. It's strange because I
> can choose many differents attributes like
Well, the example I posted was for a *gtk* window, not a tk window.
You will need to look at the API for the tk window to make the correct
call. We do not provide an abstract API across the GUI windows we
utilize internally. We give you access to the widget, and if you
want to make GUI specific calls on it, good luck, but this is not
encouraged or supported.
JDH
JDH
From: Yo m. H. <miq...@gm...> - 2007年09月21日 16:30:49
Dear John,
First of all, thanks for your response. When I try this
fig = figure()
fig.canvas.manager.window.move(100,400)
python tells me that window has no attribute move. It's strange because I
can choose many differents attributes like
>>> fig.canvas.manager.window
<Tkinter.Tk instance at 0x019100F8>
>>> fig.canvas.manager.window.attributes
<bound method Tk.wm_attributes of <Tkinter.Tk instance at 0x019100F8>>
>>> fig.canvas.manager.window.frame
<bound method Tk.wm_frame of <Tkinter.Tk instance at 0x019100F8>>
Then I've got a window class from Tk, but not the attriburte move. I need to
install Tkinter apart? Pylab suports differents GUIs. When you install
matplotlib/pylab package wich backends are installed? All?
I know embedding it's a good option, but for the moment it's too much work
for me. I've got not enought time. My programe has got differents modules
that call pylab plots, and a simple GUI which call this modules. I hope I
can move canvas frames. In the future I'll embedding matplotlib with some
package like wxmpl, but in the future.
Thanks again,
Miquel
On 9/20/07, John Hunter <jd...@gm...> wrote:
>
> On 9/19/07, Yo mismo Hotmail <miq...@gm...> wrote:
> > Hi all!
> >
> > I'm actually working with Matplotlib/Pylab Interface for making 2D plot.
> I
> > need to specify screen location where the frame will appear and I don't
> know
> > how. Supose a simple example like:
> >
> > from pylab import *
> >
> > t = arange(0.0,10,0.01)
> > s = 20*sin(2*pi*t)
> > c = 20*cos(2*pi*t)
> >
> > figure(1)
> > plot(s)
> > figure(2)
> > plot(c)
> > show()
> >
> > If I do it in this way, one frame is hidded behind the other one. How
> can I
> > modify frames attributes in order to change their position on the
> screen?
>
> pylab doesn't explicitly support this -- I have encouraged backend
> maintainers to attach the window instance to the figure manager
> instance, but I am not sure of all backends support this (GTK* and Tk
> do...). The window instance will be a GUI specific widget. Eg in the
> GTK* backends, a gtk.Window
>
> fig = figure()
> fig.canvas.manager.window.move(100,400)
>
> and other methods at
>
>
> http://www.pygtk.org/pygtk2reference/class-gtkwindow.html#method-gtkwindow--set-position
>
> If you need a lot of control, you are advised to embed mpl into a GUI
> app, eg see examples/embedding*.py in the mpl examples dir
>
>
> http://matplotlib.sourceforge.net/examples/http://matplotlib.sourceforge.net/examples/
>
>
> JDH
>
From: Michael D. <md...@st...> - 2007年09月21日 14:09:35
Jordan Atlas wrote:
> Ok, so am I to understand that usetex=True is not supported for PDF/EPS 
> output?
In 0.90.1, it is not supported in PDF.
> Can you explain what the "Tex-like mathtext format parsed by 
> matplotlib" is?
matplotlib also has a built-in math formatting engine that does not use 
TeX itself. You can use it by leaving "usetex=False" (the default) and 
putting a '$' at the beginning and end of your TeX strings.
 Plotting.xlabel(r'$\alpha^2$')
Unfortunately, the built-in engine only supports a subset of what TeX 
can do. That subset is much smaller in 0.90.1 than in the current SVN, 
where much progress has recently been made.
See here for information pertaining to version 0.90.1:
 http://matplotlib.sourceforge.net/matplotlib.mathtext.html
Cheers,
Mike
-- 
Michael Droettboom
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Jordan A. <jc...@co...> - 2007年09月21日 13:51:20
>Do you have ghostscript installed? If you set verbose.level to debug or
>debug-annoying, what do you get?
>
> 
>
I realized that the ghostscript path wasn't set up properly, so that was 
what was causing part of the problem with EPS files. It works sometimes 
now (sometimes the EPS is just a blank file, even though the plot shows 
up properly when I do pylab.show(). I'm still trying to narrow down 
what ameks the difference here).
>>I guess I mean TeX-like mathtext format parsed by matplotlib. For 
>>example, I'm using things like this:
>>
>>rc('text', usetex=True) 
>>Plotting.xlabel(r'\textbf{Time (s)}', fontsize=16)
>> 
>>
>
>usetex=True means that you are trying to use an external TeX program.
>
> 
>
Ok, so am I to understand that usetex=True is not supported for PDF/EPS 
output? Can you explain what the "Tex-like mathtext format parsed by 
matplotlib" is?
Thank you for your assistance,
--Jordan
From: Matthias M. <Mat...@gm...> - 2007年09月21日 09:43:19
Hello list,
with the latest version of svn the pylab.hist command doesn't work if I use 
align='center'. The error is due to a problem in the ax.bar - function as you 
can see in the example below. 
Probably width should be an array and not a list if one want to build 
width/2.. 
I'm not sure what is the right solution, but I have two proposals:
- change line 3187 to left = left - npy.asarray(width)/2.0
- uncomment lines 3123-3126 in axes.py, but I don't know what will be 
destroyed by that
thanks in advance for any help, best regards
Matthias
example - code :
In [1]: from numpy import ones, arange
In [2]: from pylab import axes
In [3]: ax = axes()
In [4]: ax.bar(arange(10), ones(10), width=0.8, bottom=None, align='center')
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most recent 
call last)
/home/michler/<ipython console>
/scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/axes.py in 
bar(self, left, height, width, bottom, color, edgecolor, linewidth, yerr, 
xerr, ecolor, capsize, align, orientation, log, **kwargs)
 3185 elif align == 'center':
 3186 if orientation == 'vertical':
-> 3187 left = left - width/2.
 3188 elif orientation == 'horizontal':
 3189 bottom = bottom-height/2.
TypeError: unsupported operand type(s) for /: 'list' and 'float'
> /scratch/michler/SOFT/lib/python2.4/site-packages/matplotlib/axes.py(3187)bar()
 3186 if orientation == 'vertical':
-> 3187 left = left - width/2.
 3188 elif orientation == 'horizontal':
ipdb> type(width)
<type 'list'>
ipdb> width/2.
*** TypeError: unsupported operand type(s) for /: 'list' and 'float'
2007年9月21日 09:53:52 +0200, "Mark Bakker" <ma...@gm...>:
> I think LABELPAD is the padding between the label and the tick.
I did not think about it. Probably you are correct. Yet it still helps
if you have big/multiline axis label.
> What I would like to control is the distance between the label and the
> y-axis itself.
> This is desired when you do multiple subplots and you want all ylabels to
> align nicely; they may differ
> depending on the numbers along the yticks.
Well, I see the problem.
One solution is to use custom Formatter for yticks/xticks (e.g.
FixedFormatter or FormatStrFormatter) to ensure that tick labels have
the same width/height (printed with the same precision or padded with
spaces). User's Guide explains how to use formatters.
From: jetxee <je...@gm...> - 2007年09月21日 09:04:51
2007年9月20日 16:47:14 -0400, Alan G Isaac <ai...@am...>:
> On 2007年9月20日, jetxee apparently wrote:
> > gca().yaxis.LABELPAD=20 # or the value you like 
> 
> This appears to be undocumented? E.g.,
> http://matplotlib.sourceforge.net/matplotlib.axis.html
I thought it was undocumented, but it appears it is.
It is in `Data and other attributes' of Axis section.
--
jx
I think LABELPAD is the padding between the label and the tick.
What I would like to control is the distance between the label and the
y-axis itself.
This is desired when you do multiple subplots and you want all ylabels to
align nicely; they may differ
depending on the numbers along the yticks.
Any ways to control this?
Thanks, Mark
From: jetxee <je...@gm...>
This should help:
> gca().yaxis.LABELPAD=20 # or the value you like
>
From: <jk...@ik...> - 2007年09月21日 03:35:57
Jordan Atlas <jc...@co...> writes:
> Now, when I try to save a PDF (with the newer version of matplotlib), I 
> get the error:
 [...]
> File "C:\Python24\Lib\site-packages\matplotlib\backend_bases.py", line 
> 383, in draw_tex
> raise NotImplementedError
> NotImplementedError
That means you are trying to call TeX, which is not supported by that
version of the pdf backend.
> I get the same error as in my original post when trying to save an EPS:
 [...]
> RuntimeError: ghostscript was not able to process your image.
> Here is the full report generated by ghostscript:
Do you have ghostscript installed? If you set verbose.level to debug or
debug-annoying, what do you get?
>>Do you mean the (TeX-like) mathtext format parsed by
>>matplotlib? 
>>
> I guess I mean TeX-like mathtext format parsed by matplotlib. For 
> example, I'm using things like this:
>
> rc('text', usetex=True) 
> Plotting.xlabel(r'\textbf{Time (s)}', fontsize=16)
usetex=True means that you are trying to use an external TeX program.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Ryan K. <rya...@gm...> - 2007年09月21日 02:31:05
Attachments: timeline.png
I think I have something I like reasonably well. Is that attached
timeline fairly intuitive? I am proposing a project for next summer
that has two main parts. Each part has three subsections that are
roughly one month long.
Thanks,
Ryan
On 9/20/07, Ryan Krauss <rya...@gm...> wrote:
> I am really just getting to mess with this now and ran into an issue.
> I want to turn off the y axis and 3 sides of the border around the
> plot area, so that I left with just the bottom x-axis and its tick
> marks. Turning off the y axis is easy enough, but the only way I
> found to get rid of the border is with
>
> ax.set_frame_on(False)
>
> which also gets rid of my bottom x axis and leaves tick marks along
> the top (see attached). How do I get rid of the top tick marks, keep
> the bottom ones, and get the bottom x-axis back?
>
> Thanks,
>
> Ryan
>
> On 9/20/07, Ryan Krauss <rya...@gm...> wrote:
> > bling-bling. I know it is eye candy and in questionable taste, but I
> > think it fits my non-technical audience in this case. I think this is
> > enough to get me going. Thanks John.
> >
> > Ryan
> >
> > On 9/20/07, John Hunter <jd...@gm...> wrote:
> > > On 9/20/07, Ryan Krauss <rya...@gm...> wrote:
> > > > I would need to create a timeline for a Latex document (eps output).
> > > > There may be other tools besides Matplotlib and I am open to
> > > > suggestions. But I were going to use mpl, what would it take to do
> > > > something along these lines:
> > > > http://www.timelinemaker.com/product-samplecharts-constructiontimeline.html
> > > >
> > > > Basically, I would need a nicely formatted dates along the x-axis and
> > > > then lightly colored rectangles with text in them. The width would
> > > > show when I anticipate some part of the project starting and ending.
> > > > The y coordinate of the rectangle would used to allow project portions
> > > > to overlap. It would be nice but not essential if the rectangles had
> > > > a little fade in and out in their back ground color instead of a solid
> > > > color, but that is not essential.
> > > >
> > > > Is there a clean way to do this with mpl?
> > >
> > > See examples/broken_barh.py (this also allows breaks in the horizontal
> > > bars, eg if an event is interrupted and then resumes). I haven't
> > > added gradient fills on bars because I don't think they convey little
> > > if any information but just add to the glitz factor (an example of
> > > "chart junk" to use Tufte's phrase) but at some point we should bow to
> > > popular pressure and add it. Actually, you can hack gradient filled
> > > bars and axes backgrounds -- be careful, viewing the figure below may
> > > induce seizures.
> > >
> > > from pylab import figure, show, nx, cm
> > >
> > > def gbar(ax, x, y, width=0.5, bottom=0):
> > > X = [[.6, .6],[.7,.7]]
> > > for left,top in zip(x, y):
> > > right = left+width
> > > ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
> > > extent=(left, right, bottom, top), alpha=1)
> > >
> > > fig = figure()
> > >
> > > xmin, xmax = xlim = 0,10
> > > ymin, ymax = ylim = 0,1
> > > ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
> > > autoscale_on=False)
> > > X = [[.6, .6],[.7,.7]]
> > >
> > > ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
> > > extent=(xmin, xmax, ymin, ymax), alpha=1)
> > >
> > > N = 10
> > > x = nx.arange(N)+0.25
> > > y = nx.mlab.rand(N)
> > > gbar(ax, x, y, width=0.7)
> > > ax.set_aspect('normal')
> > > show()
> > >
> > > -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Microsoft
> > > Defy all challenges. Microsoft(R) Visual Studio 2005.
> > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > > _______________________________________________
> > > Matplotlib-users mailing list
> > > Mat...@li...
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> > >
> >
>
>

Showing 12 results of 12

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