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





Showing results of 446

<< < 1 .. 5 6 7 8 9 .. 18 > >> (Page 7 of 18)
From: SRH <shu...@tr...> - 2008年06月22日 03:06:59
Daniel Ashbrook wrote:
> 
> The issue is that the 
> show() command takes over the main thread of execution, so I can't have 
> my listening process running. Essentially I need to:
> 
> 1) Pop up a figure()
> 2) Start the drawing loop
> 3) Start the socket listener
> 4) When the listener gets commands, execute them (plot, etc)
> 
> Is this something that I can do?
> Thanks,
> dan
> 
I've been running into _exactly_ this issue for the past few weeks trying to
get matplotlib windows to behave a bit more like Matlab plots (or other
tools). I'm pretty new to Python and threaded GUIs (trying to come up to
speed)... maybe it's obvious to others more experienced about how to do
these things, but hard for us to explain the problem. I'll try to explain
the desired/expected behavior from a Matlab user point of view: 
When using Matlab, one often creates plots in interactive (command line)
operations, or when calling scripts (m-files). But multiple plot windows
can be left open/running, and all other operations can proceed as normally -
that is, there is no blocking, and the windows behave as independent
entities - always active and not affecting behavior of other windows at all. 
For example, one can run a script that creates a few plots, edit the script,
run it again, and have both the original plot windows and the new ones up at
the same time for comparision. It's the blocking behavior of show() that is
most perplexing. (While GTK may be threaded, matplotlib's show() doesn't
behave that way...)
There's a post on osdir.com from 2004 where John posted example code of how
to use the underlying GTK functions for a show() that's unique to each
window's thread, rather than the the matplotlib show() which appears to take
over (block) the entire Python process until the window is closed:
http://osdir.com/ml/python.matplotlib.general/2004-07/msg00070.html
I've seen this question come up in several posts without adequate answers,
until I came across that one. It would be great if we (or someone) can
write up a summary of this and get it into the Matplotlib docs. (Point me
in the right direction and I'll make an attempt.) 
(Nice plotting tool, by the way, John et al. Good work.)
Thanks,
Scott
-- 
View this message in context: http://www.nabble.com/threading-problems-tp18015447p18050529.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Bryan F. <bry...@gm...> - 2008年06月21日 20:45:10
Is there a way to get the colorbar to work with an axes instance.
ax2 = axes([0.2, 0.1, 0.6, 0.8], axisbg='w')
ax2.fill([x1,x2,x2,x1], [y1,y1,y2,y2], fc='None', ec='r')
ax2.pcolormesh(X, Y, newa, shading='flat', cmap=cm.YlOrRd)#gray_r)
ax2.axvline(x=0, color='gray', linestyle='--')
ax2.axhline(y=0, color='gray', linestyle='--')
ax2.plot([offaxisX], [offaxisY], 'r+', mew=1)
ax2.colorbar()
AttributeError: 'Axes' object has no attribute 'colorbar'
colorbar()
, line 499, in <module>
 colorbar()
 File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 1129, in
colorbar
 ret = gcf().colorbar(mappable, cax = cax, ax=ax, **kw)
 File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 956, in
colorbar
 cb = cbar.Colorbar(cax, mappable, **kw)
 File "C:\Python25\Lib\site-packages\matplotlib\colorbar.py", line 558, in
__init__
 mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: 'NoneType' object has no attribute 'autoscale_None'
I am not sure how the mappable, ax, and cax options work.
-- 
"The game of science can accurately be described as a never-ending insult to
human intelligence." - João Magueijo
"Any intelligent fool can make things bigger, more complex, and more
violent. It takes a touch of genius - and a lot of courage - to move in the
opposite direction. " -Albert Einstein
From: John H. <jd...@gm...> - 2008年06月21日 19:26:56
On Fri, Jun 20, 2008 at 6:14 PM, sordnay <so...@gm...> wrote:
>
> Hi all,
> I'm trying to plot in 2D, 3 variables from time series, instead of volume I
> want color for the third variable.
> I have partial success with a scatter plot, but I'm unable to manage the
> colorbar so it represents z values,
> I needed to sort the variables and it's getting a bit ugly, so I though I
> might be missing some other function ?
> this is what I used:
> pylab.figure()
> x=self.stData.[items[0]]
> y=self.stData.[items[1]]
> z=self.stData.[items[2]]
> points=zip(x,y)
> points3=sorted(zip(z,points))
> for i,p in enumerate(points3):
> z[i]=p[0]
> x[i]=p[1][0]
> y[i]=p[1][1]
> #colors=pylab.linspace(z.min(),z.max(),len(z)) did not work
> colors=pylab.linspace(0,1,len(z))
> pylab.scatter(x,y,c=colors,faceted=False)
Just pass c=z to scatter if z are the values you want to colormap.
JDH
From: David Warde-F. <dw...@cs...> - 2008年06月21日 13:11:05
On 19-Jun-08, at 11:30 AM, John Hunter wrote:
> On Wed, Jun 18, 2008 at 2:42 PM, David Warde-Farley <dw...@cs... 
> > wrote:
>
>> One more related thing: is there any way to retrieve the size of a 
>> textbox
>> in figure coordinates, something like
>> ax.get_ymajorticklabels[0].get_width()?
>
> This is not very easy since the renderer is not known until the figure
> is drawn. After the window is drawn and the text instance knows its
> renderer, you can call t.get_window_extent(). So you would likely
> want to connect to the "on_draw" method and get the window extent
> there, and then do something with it, eg move the left of the canvas
> over. Here is a recursive, iterative solution that will gradually
> move the left of the subplot over until the label fits w/o going
> outside the figure border (requires 0.98)::
>
> * snip *
Hi John, (apologies for sending twice, forgot to CC the list)
Thanks again for the help. I was wondering about the code you posted 
-- what's the problem with say, using bbox.xmin to adjust left only 
once? Or else perhaps get_text_width_height from the renderer? 
Wouldn't that yield the desired effect without the iterative 
procedure, since you'd immediately know (roughly) how much to push the 
subplot over?
Thanks,
David
From: Michael D. <md...@st...> - 2008年06月21日 12:51:19
In theory, yes, but it's a completely untested theory. Each transform 
class has an input_dims and output_dims member that defines the input 
and output dimensions. So theoretically, you could create a perspective 
or orthogonal projection that maps from 3D to 2D.
Cheers,
Mike
Andrew Straw wrote:
> Mike, just a question about the new transforms backend -- can the input
> dimensionality be greater than 2? (I realize functions to do so probably
> don't currently exist, but the question is about the transforms
> machinery itself.)
>
> -Andrew
>
> Michael Droettboom wrote:
> 
>> I'm not very familiar with how axes3d works, but just by looking at the 
>> number of transform calls and objects, it appears that it will take 
>> significant effort to update it. It was never one of the goals of the 
>> transformation refactoring to have that working. Personally, I'm +1 on 
>> removing axes3d.py to avoid confusion. 
>>
>> However, a motivated user could follow the information in API_CHANGES to 
>> update axes3d.py. I'd be happy to help if you got stuck, but I don't 
>> really have the motivation/mandate to do the whole thing myself.
>>
>> Cheers,
>> Mike
>>
>> Matthias Michler wrote:
>> 
>> 
>>> Hello list,
>>>
>>> I know it is not recommended to use matplotlib for 3d plotting, but for a 
>>> while simple plots worked fine for me. This is not the case with actual svn 
>>> version and therefore my question is: Would it break at lost or cost much 
>>> effort to make the 3d-plot-examples of the Cookbook work?
>>>
>>> if I try:
>>> [1] import matplotlib.axes3d as p3
>>> I get the error attached below.
>>>
>>> Thanks for any advise in advance.
>>>
>>> best regards Matthias
>>>
>>> ---------------------------------------------------------------------------
>>> <type 'exceptions.ImportError'> Traceback (most recent call last)
>>>
>>> /home/michler/CompPhys_2008/Uebungsaufgaben/050_Antidot/3D_matplotlib/<ipython 
>>> console> in <module>()
>>>
>>> /scratch/michler/SOFT/lib/python2.5/site-packages/matplotlib/axes3d.py in 
>>> <module>()
>>> 14 from axes import Axes
>>> 15 import cbook
>>> ---> 16 from transforms import unit_bbox
>>> 17 
>>> 18 import numpy as np
>>>
>>> <type 'exceptions.ImportError'>: cannot import name unit_bbox
>>> 
>>> 
>>> 
>>>> /scratch/michler/SOFT/lib/python2.5/site-packages/matplotlib/axes3d.py(16)<module>()
>>>> 
>>>> 
>>>> 
>>> 15 import cbook
>>> ---> 16 from transforms import unit_bbox
>>> 17 
>>>
>>> -------------------------------------------------------------------------
>>> Check out the new SourceForge.net Marketplace.
>>> It's the best place to buy or sell services for
>>> just about anything Open Source.
>>> http://sourceforge.net/services/buy/index.php
>>> _______________________________________________
>>> 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: Lubos V. <li...@vr...> - 2008年06月21日 06:59:20
hi guys,
my problem is probably simple, but i wasn't able to solve it. i use
matplotlib with scipy/numpy (i.e., via pylab). in my program, i'd like
to display interactively the convergence of a mathematical procedure. in
my case this means that i have to display graphs of cca 12 functions
(some thousands samples each).
everything works, but one thing annoys me. i have 4 subplots, each
containing 3 of the functions. at the moment, i have something like
ion()
plotlist = []
pylab.subplot(2,2,1)
for a in range(4):
 subplot(2,2,a)
 for x in range(3):
 plotlist.append(pylab.plot(function[x])[0])
 plotlist[-1].set_label("text_x")
 pylab.xlim((p_xmin, p_xmax))
 pylab.ylim((-1,10))
 pylab.legend()
this leads to stepwise display of all 12 functions which is VERY slow.
maybe it also is caused by the fact that the whole function is plotted
in the beginning and only after that it's 'zoomed' to the xmin-xmax
interval.
later in the program, i just do
plotlist[index].set_ydata(new_function)
for all graphs and
draw()
which goes faster, as it seems...
is it possible to change the initial part in order to make it faster,
e.g., by means of switching between noninteractive and interactive part?
i tried switching to ioff() and using draw() there, but nothing gets
displayed then.
and one more small thing - if i do
pylab.title('some string')
pylab.draw()
at the very beginning, it doesn't get displayed. if i do it after some
of the subplot definitions, it gets displayed together with this subplot
- but that's not what i want. why is the first definition ignored?
i'd be really grateful for any hints. am i doing anything wrong?
best,
lubos
-- 
Lubos _@_"
http://www.lubos.vrbka.net
From: KURT P. <pet...@ms...> - 2008年06月21日 00:02:50
I see the example "plot_tissot.py" for basemaps which seems like it might do 
what I would like, but unfortunately, it uses shapefiles to create a 
polygon.
 Can someone give me advice or an example of just drawing a simple circle 
poly with units of "actual" meters, that I can then display/project on a map 
of my choice?
So, to say another way, I want to draw a circle of radius "X meters" around 
a point and then display that circle properly on a US Map.
Regards,
Kurt
From: sordnay <so...@gm...> - 2008年06月20日 23:58:50
Hi all,
I'm trying to plot in 2D, 3 variables from time series, instead of volume I
want color for the third variable.
I have partial success with a scatter plot, but I'm unable to manage the
colorbar so it represents z values,
I needed to sort the variables and it's getting a bit ugly, so I though I
might be missing some other function ?
this is what I used:
 pylab.figure()
 x=self.stData[items[0]]
 y=self.stData[items[1]]
 z=self.stData[items[2]]
 points=zip(x,y)
 points3=sorted(zip(z,points))
 for i,p in enumerate(points3):
 z[i]=p[0]
 x[i]=p[1][0]
 y[i]=p[1][1]
 #colors=pylab.linspace(z.min(),z.max(),len(z)) did not work
 colors=pylab.linspace(0,1,len(z))
 pylab.scatter(x,y,c=colors,faceted=False)
 pylab.colorbar()
 pylab.show()
but even if I could get the colorbar ticks to represent z values, in fact
this is not correct as this gives every point "one" color, and this is not
correct...
-- 
View this message in context: http://www.nabble.com/color-xy-plot-tp18038983p18038983.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Michael D. <md...@st...> - 2008年06月20日 15:31:07
I'm not very familiar with how axes3d works, but just by looking at the 
number of transform calls and objects, it appears that it will take 
significant effort to update it. It was never one of the goals of the 
transformation refactoring to have that working. Personally, I'm +1 on 
removing axes3d.py to avoid confusion. 
However, a motivated user could follow the information in API_CHANGES to 
update axes3d.py. I'd be happy to help if you got stuck, but I don't 
really have the motivation/mandate to do the whole thing myself.
Cheers,
Mike
Matthias Michler wrote:
> Hello list,
>
> I know it is not recommended to use matplotlib for 3d plotting, but for a 
> while simple plots worked fine for me. This is not the case with actual svn 
> version and therefore my question is: Would it break at lost or cost much 
> effort to make the 3d-plot-examples of the Cookbook work?
>
> if I try:
> [1] import matplotlib.axes3d as p3
> I get the error attached below.
>
> Thanks for any advise in advance.
>
> best regards Matthias
>
> ---------------------------------------------------------------------------
> <type 'exceptions.ImportError'> Traceback (most recent call last)
>
> /home/michler/CompPhys_2008/Uebungsaufgaben/050_Antidot/3D_matplotlib/<ipython 
> console> in <module>()
>
> /scratch/michler/SOFT/lib/python2.5/site-packages/matplotlib/axes3d.py in 
> <module>()
> 14 from axes import Axes
> 15 import cbook
> ---> 16 from transforms import unit_bbox
> 17 
> 18 import numpy as np
>
> <type 'exceptions.ImportError'>: cannot import name unit_bbox
> 
>> /scratch/michler/SOFT/lib/python2.5/site-packages/matplotlib/axes3d.py(16)<module>()
>> 
> 15 import cbook
> ---> 16 from transforms import unit_bbox
> 17 
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> 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: Matthias M. <Mat...@gm...> - 2008年06月20日 15:01:57
Hello list,
I know it is not recommended to use matplotlib for 3d plotting, but for a 
while simple plots worked fine for me. This is not the case with actual svn 
version and therefore my question is: Would it break at lost or cost much 
effort to make the 3d-plot-examples of the Cookbook work?
if I try:
[1] import matplotlib.axes3d as p3
I get the error attached below.
Thanks for any advise in advance.
best regards Matthias
---------------------------------------------------------------------------
<type 'exceptions.ImportError'> Traceback (most recent call last)
/home/michler/CompPhys_2008/Uebungsaufgaben/050_Antidot/3D_matplotlib/<ipython 
console> in <module>()
/scratch/michler/SOFT/lib/python2.5/site-packages/matplotlib/axes3d.py in 
<module>()
 14 from axes import Axes
 15 import cbook
---> 16 from transforms import unit_bbox
 17 
 18 import numpy as np
<type 'exceptions.ImportError'>: cannot import name unit_bbox
> /scratch/michler/SOFT/lib/python2.5/site-packages/matplotlib/axes3d.py(16)<module>()
 15 import cbook
---> 16 from transforms import unit_bbox
 17 
From: Alan G I. <ai...@am...> - 2008年06月20日 14:40:05
> On Fri, Jun 20, 2008 at 8:41 AM, Alan G Isaac <ai...@am...> wrote:
>> If anyone wants to share an example where it is useful to 
>> work "backwards" like that, I'm sure I would learn from 
>> it. 
On 2008年6月20日, John Hunter wrote:
> Take a look at the draggable rectangle code in the example below.
> ... The PDF event handling tutorial which contains this 
> example is at 
> http://matplotlib.sourceforge.net/pycon/event_handling_tut.pdf 
Ah, I'm learning more than I bargained for!
But very usefully as it turns out.
Thanks!
Alan
From: John H. <jd...@gm...> - 2008年06月20日 13:52:41
On Fri, Jun 20, 2008 at 8:41 AM, Alan G Isaac <ai...@am...> wrote:
>> On Thu, Jun 19, 2008 at 3:37 PM, Alan G Isaac <ai...@am...> wrote:
>>> I still do not see why a figure has a canvas as data.
>
> On 2008年6月19日, John Hunter apparently wrote:
>> This is just a convenience so the child can see the parent. If I have
>> a function that gets a line, I can do line.axes.figure.canvas and walk
>> backwards up the containment hierarchy to get what I need. This is
>> backwards because a canvas holds a figure which holds an axes which
>> holds a line, but everybody stores a reference to their parent. A
>> side effect of having so many cyclic references is that we cannot use
>> __del__ anywhere in the mpl class hierarchy since this breaks garbage
>> collection with cyclic references.
>
> Thanks for the explanation!
> Alan
> PS If anyone wants to share an example where it is useful
> to work "backwards" like that, I'm sure I would learn
> from it.
Take a look at the draggable rectangle code in the example below. The
rDraggableRectangle class needs to be able to update the canvas with a
draw, but rather than having to pass in the canvas instance
explicitly, we can just get it from the rectangle. Ie, the artist
knows what canvas he is in even though the canvas contains the
rectangle. The PDF event handling tutorial which contains this
example is at http://matplotlib.sourceforge.net/pycon/event_handling_tut.pdf
if you want some context.
import numpy as np
import matplotlib.pyplot as plt
class DraggableRectangle:
 def __init__(self, rect):
 self.rect = rect
 self.press = None
 def connect(self):
 'connect to all the events we need'
 self.cidpress = self.rect.figure.canvas.mpl_connect(
 'button_press_event', self.on_press)
 self.cidrelease = self.rect.figure.canvas.mpl_connect(
 'button_release_event', self.on_release)
 self.cidmotion = self.rect.figure.canvas.mpl_connect(
 'motion_notify_event', self.on_motion)
 def on_press(self, event):
 'on button press we will see if the mouse is over us and store
some data'
 if event.inaxes != self.rect.axes: return
 contains, attrd = self.rect.contains(event)
 if not contains: return
 print 'event contains', self.rect.xy
 x0, y0 = self.rect.xy
 self.press = x0, y0, event.xdata, event.ydata
 def on_motion(self, event):
 'on motion we will move the rect if the mouse is over us'
 if self.press is None: return
 if event.inaxes != self.rect.axes: return
 x0, y0, xpress, ypress = self.press
 dx = event.xdata - xpress
 dy = event.ydata - ypress
 #print 'x0=%f, xpress=%f, event.xdata=%f, dx=%f,
x0+dx=%f'%(x0, xpress, event.xdata, dx, x0+dx)
 self.rect.set_x(x0+dx)
 self.rect.set_y(y0+dy)
 self.rect.figure.canvas.draw()
 def on_release(self, event):
 'on release we reset the press data'
 self.press = None
 self.rect.figure.canvas.draw()
 def disconnect(self):
 'disconnect all the stored connection ids'
 self.rect.figure.canvas.mpl_disconnect(self.cidpress)
 self.rect.figure.canvas.mpl_disconnect(self.cidrelease)
 self.rect.figure.canvas.mpl_disconnect(self.cidmotion)
fig = plt.figure()
ax = fig.add_subplot(111)
rects = ax.bar(range(10), 20*np.random.rand(10))
drs = []
for rect in rects:
 dr = DraggableRectangle(rect)
 dr.connect()
 drs.append(dr)
plt.show()
From: Alan G I. <ai...@am...> - 2008年06月20日 13:37:08
> On Thu, Jun 19, 2008 at 3:37 PM, Alan G Isaac <ai...@am...> wrote:
>> I still do not see why a figure has a canvas as data. 
On 2008年6月19日, John Hunter apparently wrote:
> This is just a convenience so the child can see the parent. If I have 
> a function that gets a line, I can do line.axes.figure.canvas and walk 
> backwards up the containment hierarchy to get what I need. This is 
> backwards because a canvas holds a figure which holds an axes which 
> holds a line, but everybody stores a reference to their parent. A 
> side effect of having so many cyclic references is that we cannot use 
> __del__ anywhere in the mpl class hierarchy since this breaks garbage 
> collection with cyclic references. 
Thanks for the explanation!
Alan
PS If anyone wants to share an example where it is useful
to work "backwards" like that, I'm sure I would learn
from it.
From: John H. <jd...@gm...> - 2008年06月20日 10:47:14
On Fri, Jun 20, 2008 at 12:39 AM, Paul Hartley <pha...@gm...> wrote:
>
> the broken_barh collection seems to lack the get_edgecolor() and get_color()
> fxns, yet you can set the edge colors with set_edgecolor(). Is there some
> way to get the edge colors of these guys?
Hmm, it appears we accidentally left this method out, but I just added
it to svn. If you don't have access to svn, you can "cheat" and do
 col._edgecolors
JDH
From: John H. <jd...@gm...> - 2008年06月20日 10:31:36
On Fri, Jun 20, 2008 at 2:26 AM, David Goldsmith
<d_l...@ya...> wrote:
>
> That example doesn't do anything on my computer...
Look again :-) It created a file called test.png in the directory in
which you ran the example. As long as you include the last line in
the example (the print_figure" line) it will save a figure.
JDH
From: Friedrich H. <fri...@gm...> - 2008年06月20日 09:05:38
On Thu, Jun 19, 2008 at 12:36:02PM -0500, John Hunter wrote:
> On Thu, Jun 19, 2008 at 11:02 AM, John Hunter <jd...@gm...> wrote:
>
> >> I want to adjust the x position of my ylabel, like
> >>
> >> subplot(111)
> >> ylabel('YLabel', x=-.25, y=.75)
> >>
> >> the 'y=.75' argument is applied but the 'x=-.2' argument has no affect.
> >> But why? Have you any idea to do this?
> >
> > The x position is automatically determined by the size of the
> > yticklabels. We should provide a means to override this x position,
> > but it is not possible currently.
>
> Since our typical mantra is "we don't do much autolayout but we make
> it possible for you to layout your figure as you like", I wasn't
> satisfied with my answer, so I committed a patch to svn which supports
> setting the label coords. See the example below
Oh, thank you very much. The
 gca().yaxis.set_label_coords(x, y)
command works fine for me :-)
But one qusetion. I think the user interface
 ylabel('yLabel', xpos, ypos)
would be better. So I would do somethink like this in ylabel()
 if xpos is not None:
 self.set_label_coords(xpos, ypos)
What do you think?
Many thanks,
 Friedrich
From: David G. <d_l...@ya...> - 2008年06月20日 07:26:27
That example doesn't do anything on my computer...
DG
--- On Thu, 6/19/08, Scott Sinclair <sin...@uk...> wrote:
> From: Scott Sinclair <sin...@uk...>
> Subject: Re: [Matplotlib-users] Image plotting using the OO interface
> To: Mat...@li...
> Date: Thursday, June 19, 2008, 3:58 AM
> >>> David Goldsmith <d_l...@ya...>
> 06/19/08 9:39 AM >>>
> Hi! I'm having trouble figuring out how to plot an
> array as an image with the OO interface - please help
> (e.g., w/ an example). Thanks,
> 
> DG
> >>>
> 
> >From the examples
> http://matplotlib.sourceforge.net/matplotlib_examples_0.98.0.zip
> 
> ../examples/api/agg_oo.py
> 
> --------------------------------------------
> #!/usr/bin/env python
> """
> A pure OO (look Ma, no pylab!) example using the agg
> backend
> """
> from matplotlib.backends.backend_agg import FigureCanvasAgg
> as FigureCanvas
> from matplotlib.figure import Figure
> 
> fig = Figure()
> canvas = FigureCanvas(fig)
> ax = fig.add_subplot(111)
> ax.plot([1,2,3])
> ax.set_title('hi mom')
> ax.grid(True)
> ax.set_xlabel('time')
> ax.set_ylabel('volts')
> canvas.print_figure('test')
> --------------------------------------------
> 
> You can replace the call to ax.plot() with a call to
> ax.imshow() or ax.pcolor()
> 
> Hope that gets you going.
> 
> Cheers,
> Scott
> 
> Please find our Email Disclaimer here:
> http://www.ukzn.ac.za/disclaimer/
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
From: Yves R. <yve...@ep...> - 2008年06月20日 07:21:00
Ryan May wrote:
> Yves Revaz wrote:
> 
>> Hi all,
>>
>> When I use:
>>
>> colorbar(orientation='horizontal')
>>
>> the color bar is drawn on the bottom of the corresponding graph.
>> Which option will draw the colorbar on the top of the graph ?
>> 
>
> I think (correct me if I'm wrong devs) you'll have to use the cax
> keyword argument to manually specifiy the position of the axes in which
> to draw the colorbar. You'll also need to adjust the position of the
> plot using figure.subplots_adjust. Like this maybe:
>
> import numpy as np
> import matplotlib.pyplot as plt
> data = np.random.randn(30,30)
> plt.pcolor(data)
> fig = plt.gcf()
> fig.subplots_adjust(top=0.85)
> ax = fig.add_axes([0.12, 0.9, 0.8, 0.05])
> plt.colorbar(cax=ax, orientation='horizontal')
>
> Hope this helps,
>
> 
ok, it works fine for that case.
Now, my problem is that my graph is a subplot:
Taking your example it corresponds to :
import numpy as np
import matplotlib.pyplot as plt
fig = plt.gcf()
plt.subplot(2,2,2)
data = np.random.randn(30,30)
plt.pcolor(data)
fig.subplots_adjust(top=0.85)
ax = fig.add_axes([0.12, 0.9, 0.8, 0.05])
plt.colorbar(cax=ax, orientation='horizontal')
plt.show()
Obviously, the colorbar has now the length of the whole figure and not
the one
of the subplot ! :-( 
I should do a "subplots_adjust" to the subplot and not to the "fig", but
how can I do that ?
Thanks,
yves
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> 
-- 
 (o o)
--------------------------------------------oOO--(_)--OOo-------
 Yves Revaz
 Laboratory of Astrophysics EPFL
 Observatoire de Sauverny Tel : ++ 41 22 379 24 28
 51. Ch. des Maillettes Fax : ++ 41 22 379 22 05
 1290 Sauverny e-mail : Yve...@ep...
 SWITZERLAND Web : http://www.lunix.ch/revaz/
----------------------------------------------------------------
From: Eric F. <ef...@ha...> - 2008年06月20日 07:08:04
Eric Firing wrote:
> Bill Baxter wrote:
>>
>> I tried putting this in my matplotlibrc but it seems to have no effect:
>>
>> font.size : 30.0
>>
>> Just to make sure things were actually working I also tried this:
>>
>> font.weight : bold
>>
>> That one worked, all text on the plot turned bold. That suggests to
>> me that the global font size setting probably just has a bug at the
>> moment.
> 
> I see one slightly obscure bug that is not the cause of this problem.
Fixed in the branch and trunk.
> 
> The big problem appears to be that although the mechanism is in place 
> for all this nice global control, it is not being *used* by default. 
> That is, the default sizes for axis labels and such are all given in 
> points, not using the strings "medium" etc. As a workaround you could 
> make a matplotlibrc file with the strings substituted for all the font 
> sizes in points that you can find; but it looks like this is something 
> we really need to fix.
Fixed in the trunk--please check it.
Eric
From: Paul H. <pha...@gm...> - 2008年06月20日 05:39:44
the broken_barh collection seems to lack the get_edgecolor() and get_color()
fxns, yet you can set the edge colors with set_edgecolor(). Is there some
way to get the edge colors of these guys?
From: Curtis J. <cu...@th...> - 2008年06月20日 04:16:33
No guarantees on when I'll have time, but I'll work on it.
Thanks for the info.
--
Curtis
On Thu, Jun 19, 2008 at 8:17 AM, John Hunter <jd...@gm...> wrote:
> On Wed, Jun 18, 2008 at 2:43 PM, Curtis Jensen <cu...@th...> wrote:
>> Nice. Thanks. I had tried to do something similar, but kept getting
>> a curved line between each data point.
>> Also, I too got errors with a previous versions of matplotlib, but 0.98 works.
>>
>> If someone were willing to add Radar plots to the matplotlib
>> functionality, would this be wanted by the users or maintainers?
>
> Yes, certainly. You may want to take a look at the polar
> implementation (can you inherit from it?) to reuse as much as
> possible. Michael has also written a short guide to developers
> working with nonlinear projections
>
> http://matplotlib.sourceforge.net/doc/html/devel/add_new_projection.html
>
> JDH
>
From: Eric F. <ef...@ha...> - 2008年06月20日 03:01:19
Bill Baxter wrote:
> Thanks for the reply.
> 
> On Fri, Jun 20, 2008 at 10:32 AM, Darren Dale <dsd...@gm...> wrote:
>> On Thursday 19 June 2008 9:13:15 pm Bill Baxter wrote:
>>> On Fri, Jun 20, 2008 at 10:01 AM, Darren Dale <dsd...@gm...> wrote:
>>>> Hi Bill,
>>>>
>>>> On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:
>>>>> Matplot folks,
>>>>> Is there a way to increase all font sizes globally across the board?
>>>>> I played around with some RC parameters but they don't seem to have
>>>>> any effect.
>>>> Here's a note from the default matplotlibrc:
>>>>
>>>> # note that font.size controls default text sizes. To configure
>>>> # special text sizes tick labels, axes, labels, title, etc, see the rc
>>>> # settings for axes and ticks. Special text sizes can be defined
>>>> # relative to font.size, using the following values: xx-small, x-small,
>>>> # small, medium, large, x-large, xx-large, larger, or smaller
>>>> #font.size : 12.0
>>>>
>>>> You set that size, and then set a relative size (like "medium") for your
>>>> other settings. I should include this in the new docs, if it is not
>>>> covered already.
>>> According to the docs the rc function is supposed to be able to do the
>>> same thing as editing matplotlibrc.
>>> I tried doing
>>> rc('font', size=20)
>>> and several variations of that invoked at several different places in
>>> my file, and it seemed to have no effect.
>>>
>>> Did I do it wrong? Does rc() not really work as advertised?
>>> Something completely different?
>> I think in this case, you need to change those settings before importing
>> pylab:
>>
>> import matplotlib
>> matplotlib.rcParams['font.size'] = 12
>> import pylab
> 
> I see. I usually just do it in one shot like:
> from matplotlib import pylab as plot
> 
>> or better yet, do it with a matplotlibrc file
>>
>>> For what it's worth my matplotlib.pylab.__version__ is '1.1.0'
>> Really? That looks like numpy's version, not matplotlib's.
> 
> I guess it's just namespace weirdness then. Using the import
> incantation I gave above, plot.__version__ reports 1.1.0.
> matplotlib.__version__ gives '0.98.0'.
> 
> I tried putting this in my matplotlibrc but it seems to have no effect:
> 
> font.size : 30.0
> 
> Just to make sure things were actually working I also tried this:
> 
> font.weight : bold
> 
> That one worked, all text on the plot turned bold. That suggests to
> me that the global font size setting probably just has a bug at the
> moment.
I see one slightly obscure bug that is not the cause of this problem.
The big problem appears to be that although the mechanism is in place 
for all this nice global control, it is not being *used* by default. 
That is, the default sizes for axis labels and such are all given in 
points, not using the strings "medium" etc. As a workaround you could 
make a matplotlibrc file with the strings substituted for all the font 
sizes in points that you can find; but it looks like this is something 
we really need to fix.
Eric
> 
> --bb
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: John H. <jd...@gm...> - 2008年06月20日 02:35:10
On Thu, Jun 19, 2008 at 9:19 PM, Charles Moad <cw...@gm...> wrote:
> Seems like that one little fix did the trick. I ran several examples and
> haven't had any problems. Committed now.
Thanks Charlie! Can you provide some basic instructions for those of
us on osx how we can enable and test this backend?
JDH
From: Charles M. <cw...@gm...> - 2008年06月20日 02:19:29
On Jun 12, 2008, at 4:27 PM, John Hunter wrote:
> On Thu, Jun 12, 2008 at 2:58 PM, İsmail Dönmez <is...@na...> 
> wrote:
>> Hi all,
>>
>> I was trying matplotlib 0.98.0 and Qt4 backend works great but Coca
>> backend seems to be broken :
>
> Charlie,
>
> any chance you can try and port cocoaagg over to the new trunk api.
> figure.dpi is no longer a lazy value, but a plain ol number. There
> are probably a few other changes that will need to be made as well.
> I'd like to clear up as many of these problems as we can and shoot for
> a bugfix release next week.
>
> JDH
Seems like that one little fix did the trick. I ran several examples 
and haven't had any problems. Committed now.
- Charlie
From: Bill B. <wb...@gm...> - 2008年06月20日 02:14:15
Thanks for the reply.
On Fri, Jun 20, 2008 at 10:32 AM, Darren Dale <dsd...@gm...> wrote:
> On Thursday 19 June 2008 9:13:15 pm Bill Baxter wrote:
>> On Fri, Jun 20, 2008 at 10:01 AM, Darren Dale <dsd...@gm...> wrote:
>> > Hi Bill,
>> >
>> > On Thursday 19 June 2008 8:18:12 pm Bill Baxter wrote:
>> >> Matplot folks,
>> >> Is there a way to increase all font sizes globally across the board?
>> >> I played around with some RC parameters but they don't seem to have
>> >> any effect.
>> >
>> > Here's a note from the default matplotlibrc:
>> >
>> > # note that font.size controls default text sizes. To configure
>> > # special text sizes tick labels, axes, labels, title, etc, see the rc
>> > # settings for axes and ticks. Special text sizes can be defined
>> > # relative to font.size, using the following values: xx-small, x-small,
>> > # small, medium, large, x-large, xx-large, larger, or smaller
>> > #font.size : 12.0
>> >
>> > You set that size, and then set a relative size (like "medium") for your
>> > other settings. I should include this in the new docs, if it is not
>> > covered already.
>>
>> According to the docs the rc function is supposed to be able to do the
>> same thing as editing matplotlibrc.
>> I tried doing
>> rc('font', size=20)
>> and several variations of that invoked at several different places in
>> my file, and it seemed to have no effect.
>>
>> Did I do it wrong? Does rc() not really work as advertised?
>> Something completely different?
>
> I think in this case, you need to change those settings before importing
> pylab:
>
> import matplotlib
> matplotlib.rcParams['font.size'] = 12
> import pylab
I see. I usually just do it in one shot like:
 from matplotlib import pylab as plot
> or better yet, do it with a matplotlibrc file
>
>> For what it's worth my matplotlib.pylab.__version__ is '1.1.0'
>
> Really? That looks like numpy's version, not matplotlib's.
I guess it's just namespace weirdness then. Using the import
incantation I gave above, plot.__version__ reports 1.1.0.
matplotlib.__version__ gives '0.98.0'.
I tried putting this in my matplotlibrc but it seems to have no effect:
 font.size : 30.0
Just to make sure things were actually working I also tried this:
 font.weight : bold
That one worked, all text on the plot turned bold. That suggests to
me that the global font size setting probably just has a bug at the
moment.
--bb
4 messages has been excluded from this view by a project administrator.

Showing results of 446

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