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

Showing results of 36569

<< < 1 .. 1449 1450 1451 1452 1453 .. 1463 > >> (Page 1451 of 1463)
From: John H. <jdh...@ac...> - 2004年03月01日 23:47:37
>>>>> "James" == James Boyle <bo...@ll...> writes:
 James> I have used nc = 3 or 4 if I use the plot command and all
 James> the plots are squished into the subregions for which I
 James> asked - even if things get ugly.
This is a one character bug!
I mainly use multiple rows in my own plots and never noticed it. On
or around line 1492 in axes.Subplot.__init__
change
 figLeft = left + colNum*(figW + sepH)
 ^
to
 figLeft = left + colNum*(figW + sepW)
 ^
Thanks for the detailed bug report and example code.
JDH 
From: Arnold M. <arn...@wu...> - 2004年03月01日 23:25:35
Dear John,
> Well, the behavior you are seeing is the correct, documented
> behavior. I think it would be easier for you to pass errorbar what it
> is expecting than for errorbar to handle this additional use case -
> it's already getting pretty hairy in there.
> 
> DO you have a problem doing
> 
> errorbar([1],[2],xerr=[.1])
Not really, it's just that I hate to think beforehand about whether a
routine eats everything or just arrays ;). The adjustments needed are
only minor I found out, after sending the previous mail. Here is the
diff against matplotlib-0.50e
<diff>
> 
> 7c7
< log10, Float
---
> log10, Float, NewAxis
527a528,531
> if (len(x.shape) == 0): x=x[NewAxis,] if (len(y.shape) == 0): 
> y=y[NewAxis,]
533,534c537,544
< if xerr is not None: xerr = asarray(xerr)
< if yerr is not None: yerr = asarray(yerr)
---
> if xerr is not None: xerr = asarray(xerr) if (len(xerr.shape) == 0): 
> xerr=xerr[NewAxis,] if yerr is not None: yerr = asarray(yerr) if
> (len(yerr.shape) == 0): yerr=yerr[NewAxis,]
</diff>
> 
> You're not the first! The temporary workaround is to use 
> plot(x,y,'o') which uses fixes sizes in points for the symbols (you
> can also use '*', '+', etc) However, you cannot vary the size or
> color of the symbols so this may not be workable.
I'm perfectly happy with the plot command to do normal scatter plots. I
even think that it would be more logical (but perhaps not
matlab-compatible) to move all machinery of scatter to plot.
You asked for information of how people (would like to) use scatter
plots. Well, my wishlist for scatter would be more or less like (sorry
it's a long wishlist, but see them as suggestions, not commands!):
* Scatter plots of symbols where the size of the symbols can be set per
 x-y pair. The use of this is that it depends on the number of points
 whether you want tiny dots, or large circles (the latter being nice
 when you have 10 points, but not when you have a million. For me,
 the size does not need to be specified in points, or another seemingly
 exact measure. I can live with a 'default size' (say 1/100 of the
 smallest of the axes) and a multiplier that can set by the user (like
 in Gnuplot).
* The symbols should be the same kind of symbols as used in plot (i.e.
 squares, triangles, circles etc.). The blob-symbols as plotted now
 should be a special case rather than the default. For myself, I only
 see a useful usage for *circular* (irrespective of axes) blobs where
 the radius is set by the s-keyword. But perhaps others like to have
 ellipsoid blobs that have a *two* axes that make physical sense.
* It would be nice if all symbols -as far as applicable- come in 'open'
 and 'filled' versions (nice if you want to plot in one scatter plot
 data referring to the same physical quantity, but separating between
 daytime and nighttime for instance).
 For me, the number of symbols needed in one plot is rather limited: I
 hardly use more than 4 simultaneously in one scatter plot. On the
 other hand, in general x-y plots (lines, line-points, or points in
 Gnuplot terms) I would like to have at least say 10 symbols, since I
 usually use symbols to clarify the difference between lines, because
 that's easier than to ask the reader to differentiate between dash,
 dash-dot, dash-dash-dot etc.
* With respect to the coloring (c-keyword) it is perhaps easiest if this
 is applied to the symbols directly: just as one can say 'b>' in plot,
 it would be something like:
 scatter(x, y, '>', c=color_array)
* Assume that the new symbol for the 'blobs' would be say '@', then
 scatter(x, y, '@', s=size_array, c=color_array)
 gives colored blobs with unequal axes (as now),
 scatter(x, y, 'b@', s=size_array)
 gives blue blobs with unequal axes
 scatter(x, y, 'b@', s=size_array*-1)
 gives blue blobs with equal axes
 etc.
I hope this helps. And perhaps I can help in some other ways.
With kind regards,
Arnold Moene
> 
> When I refactor the scatter / pcolor etc commands as discussed in my
> response to Dominique Orban above, I'll make sure that this case is
> handled as well. I plan to support efficient handling of scatter
> with arbitrary (or at least several) shapes where the size can be in
> data (x,y) or user-defined coords, eg, physical sizes. It would be
> helpful for me if people gave some information about how they would
> like scatter to behave, particularly in regard to the sizes since I
> am still working this out.
> 
> Would you like physical sizes, eg circles with radius in points, or
> what?
> 
> Should the shape depend on the aspect ratio of the plotting window.
> Eg, if it's a circle and you have a short, wide window, should it
> appear ellipsoidal?
> 
> What basic scatter symbols should be supported?
> 
> What are the most common uses: fixed size? fixed color? vary both?
> 
> JDH
> 
-- 
------------------------------------------------------------------------
Arnold F. Moene NEW tel: +31 (0)317 482604
Meteorology and Air Quality Group fax: +31 (0)317 482811
Wageningen University e-mail: Arn...@wu...
Duivendaal 2 url: http://www.met.wau.nl 6701
AP Wageningen
The Netherlands
------------------------------------------------------------------------
Openoffice.org - Freedom at work
------------------------------------------------------------------------
-- 
------------------------------------------------------------------------
Arnold F. Moene NEW tel: +31 (0)317 482604
Meteorology and Air Quality Group fax: +31 (0)317 482811
Wageningen University e-mail: Arn...@wu...
Duivendaal 2 url: http://www.met.wau.nl
6701 AP Wageningen
The Netherlands
------------------------------------------------------------------------
Openoffice.org - Freedom at work
------------------------------------------------------------------------
From: James B. <bo...@ll...> - 2004年03月01日 22:51:49
I was making subplots using the bar command and ran into a problem I do 
not understand.
nr = number of rows, nc = number of columns
I want nr = 1, i.e. just one row of plots. If nc is 1 or 2 all is 
well, but nc =3 the third plot is cutoff in the middle. If nc = 4, I 
get 3 plots and the fourth cannot be seen.
What seems to be happening is that the subplots are not scaled to fit 
the viewport dictated by suplot(nr,nc,plotNumber).
I have used nc = 3 or 4 if I use the plot command and all the plots 
are squished into the subregions for which I asked - even if things get 
ugly.
I use the PS and Agg backends and both yield similar results.
My code is below.
Thanks for any help.
Jim
The Code:
import matplotlib
matplotlib.use('PS')
#matplotlib.use('Agg')
from matplotlib.matlab import *
import showPS
import showAGG
nTypes = 3
ind = arange(nTypes) # the x locations for the groups
width = .2 # the width of the bars
nr = 1
nc = 3
crap = []
for c in range(nc):
 for r in range(nr):
 subplotID = nc*r + c + 1
 crap.append(subplotID)
 ax = subplot(nr,nc,subplotID)
 frame = ax.get_frame()
 frame.set_linewidth(1.5)
 amip = (20, 35, 30)
 p1 = bar(ind, amip, width, color='r')
 climo = (25, 32, 34)
 p2 = bar(ind+width, climo, width, color='y')
 isccp = (5, 10, 60)
 p3 = bar(ind+2.0*width, isccp, width, color='g')
 atlas = (20, 40, 70)
 p4 = bar(ind+3.0*width, atlas, width, color='b')
 ylabel('Cloud Fraction (%)')
 title('Cloud' + str(subplotID)+'_'+str(c)+'_'+str(r) )
 set(gca(), 'xticks', ind+2*width)
 set(gca(), 'xticklabels', ('low', 'mid', 'high') )
 set(gca(), 'yticks', arange(0,100,10))
 legend( (p1[0], p2[0],p3[0],p4[0]), ('Amip', 
'climo','isccp','atlas') )
savefig('barchart_test')
showPS.showPS('barchart_test')
From: John H. <jdh...@ac...> - 2004年03月01日 15:21:41
>>>>> "Arnold" == Arnold Moene <arn...@wu...> writes:
 Arnold> Dear all, Praise for this first serious python plotting
 Arnold> package!
Thanks!
 Arnold> I have two minor comments:
 -> when I try to do an errorbar plot with a scalar, rather than an
 Arnold> array as the argument (i.e. errorbar(scalar_x, scalar_y,
 Arnold> xerr=scalar_xerr)) I get the following error message:
 Arnold> "/usr/lib/python2.3/site-packages/matplotlib/axes.py",
 Arnold> line 569, in errorbar right = x+xerr[1] IndexError: index
 Arnold> out of bounds
 Arnold> This is due to the fact that the length of xerr is tested
 Arnold> only to be 1 or greater than 1 (asymmetric
 Arnold> errors). However, the option that I would like to plot
 Arnold> just one point is not included. So an extra if-clause is
 Arnold> needed before the present code that checks whether x and
 Arnold> xerr are arrays or not.
Well, the behavior you are seeing is the correct, documented behavior.
I think it would be easier for you to pass errorbar what it is
expecting than for errorbar to handle this additional use case - it's
already getting pretty hairy in there.
DO you have a problem doing
 errorbar([1],[2],xerr=[.1])
 -> I very much like the option for scatter to color the blobs to
 -> be
 Arnold> plotted. However, I have an application where the shape of
 Arnold> the blobs is immaterial: I would rather have filled
 Arnold> circles (or even better: filled symbols, be it circles,
 Arnold> triangles ...). Anyhow: I would like them to be symmetric
 Arnold> irrespective of the range of the axes. One option would be
 Arnold> to allow the s-keyword to be allowed to be negative, where
 Arnold> negative means: symmetric and the value of the negative
 Arnold> number being the size relative to some default size.
You're not the first! The temporary workaround is to use
plot(x,y,'o') which uses fixes sizes in points for the symbols (you
can also use '*', '+', etc) However, you cannot vary the size or
color of the symbols so this may not be workable. 
When I refactor the scatter / pcolor etc commands as discussed in my
response to Dominique Orban above, I'll make sure that this case is
handled as well. I plan to support efficient handling of scatter with
arbitrary (or at least several) shapes where the size can be in data
(x,y) or user-defined coords, eg, physical sizes. It would be helpful
for me if people gave some information about how they would like
scatter to behave, particularly in regard to the sizes since I am
still working this out. 
Would you like physical sizes, eg circles with radius in points, or
what?
Should the shape depend on the aspect ratio of the plotting window.
Eg, if it's a circle and you have a short, wide window, should it
appear ellipsoidal?
What basic scatter symbols should be supported?
What are the most common uses: fixed size? fixed color? vary both?
JDH
From: John H. <jdh...@ac...> - 2004年03月01日 15:08:36
>>>>> "Dominique" == Dominique Orban <do...@da...> writes:
 Dominique> Hello, I am having trouble viewing scatter plots of
 Dominique> large data sets with the GTK backend. The plots are
 Dominique> sparsity patterns of sparse matrices, much in the way
 Dominique> of Matlab's spy function. First of all, there may be a
 Dominique> conflict somewhere with my version of GTK/PyGTK;
 Dominique> issuing a plot() or scatter() command often results in
 Dominique> the message 'None Active' being displayed. After a
 Dominique> couple of seconds, the python prompt comes back, and
 Dominique> the 'scatter' command results in a huge number of
 Dominique> messages of the form
 Dominique> <matplotlib.patches.Circle instance at 0x4531730c>
Hi Dominique, 
It looks like there is a "print" statement somewhere in your code.
It's possible that this was from a vestigial debug command I left in.
I don't get get it on my system. Are you using matplotlib-0.50? I
also don't get the "None Active" line.
I'm using this as a test script 
 from matplotlib.matlab import *
 x = 100*rand(100000)
 y = 100*rand(100000)
 s = rand(100000)
 scatter(x,y,s)
 #plot(x,y,'o')
 show()
Takes about 30s on my system. Note that plot with circles can be must
faster that scatter if you don't need to vary the size or color of the
symbols.
 Dominique> begin displayed; litterally hundreds of them---it takes
 Dominique> some 10 seconds. Finally, a show() opens up a Figure
 Dominique> window, but no plot. The matrix has 80519 nonzero
 Dominique> elements and is symmetric, so the scatter plot contains
 Dominique> roughly twice as many points. I have a Gnuplot
 Dominique> interface and a spy-like function which works just fine
 Dominique> and displays the pattern in a matter of a fraction of a
 Dominique> second.
There are several areas where matplotlib performance is subpar -
mostly for large numbers of patches (circles for scatter, rectangles
for pcolor). Fixing this is a fairly high priority and I have a good
idea how to go about it - see
http://sourceforge.net/mailarchive/message.php?msg_id=7142332 for a
recent discussion. I think in the next 3-4 weeks I can get this
fixed. Basically, the plan is to set up an additional backend method
or two that the various backends may optionally implement in extension
code for performance.
 Dominique> Sometimes, a plot using the GTK backend gets stuck in
 Dominique> gtk.mainloop(), and i have to interrupt it with
 Dominique> Ctrl-C. I am using SuSE Linux 8.0. I have installed the
 Dominique> most recent versions of GTK and PyGTK.
Are you using the default GTK that comes with SuSE or did you upgrade?
I have gotten myself into a world of pain before trying to upgraded
GTK libs on a linux box. It does look like you are getting some
unusual behavior. Make sure you are using the latest matplotlib and
try running the test script I posted above. If you still get the same
errors, something is whacked with your install or paths. Otherwise,
stay tuned for performance enhancements coming soon to theaters
everywhere.
JDH
From: John H. <jdh...@ac...> - 2004年03月01日 14:53:07
 - I have 2 Suplots on top of each other, but when I select only one
 axis on the drop-down button I get an error: 
This was a python2.2 specific bug relating to nested scopes. It's
fixed for the next release.
 - I want to systematically disable the vertical zoom/move on the
 second subplot, but not the first. How can I do that ?
Well, when the menu is working properly that is how you do it. By
"systematically", do you mean by default so it's disabled when the
plot comes up?
If so, this depends on how you are building your GUI window.
Basically you need to get your hands on the gtk.Toolbar instance,
which contains an omenu (gtk.OptionMenu) attribute (wait until the
next release, a couple of days, where I've cleaned this up a bit).
Eg, if you are using the matlab interface
 manager = get_current_fig_manager()
 items = manager.toolbar.omenuItems
 items[-1].set_active(False)
Turns off navigation for the last subplot. items[0] would turn off
navigation for the first subplot, and so on.
Here are the docs for gtk.MenuItem -
http://www.gnome.org/~james/pygtk-docs/class-gtkmenuitem.html
 - How can I activate a tooltip on top of my plots ?
You'll have to read up on gtk tooltips. Depends on what elements you
want to add tips to. Give me a little more info. DO you want to add
tips to the navigation buttons or lines on your plot or text elements
or what?
http://www.gnome.org/~james/pygtk-docs/class-gtktooltips.html
Also check out the pygtk FAQ http://www.async.com.br/faq/pygtk and
tutorial
http://www.moeraki.com/pygtktutorial/pygtk2tutorial/index.html.
 - I cannot zoom or move an plot I set the axis ticks to , ie
 ax.set_xticks([])
This is a bug - thanks for reporting it. I use the tick width as the
default interval in pan. When there are no ticks, I divided by the
number of ticks and got a division by zero error. I now check for 0
and default to 20% of the plot if there are no ticks.
 - How could I add a button to directly print out the picture in the toolbar ?
Print as in to a printer? No support for that yet and am not sure I
want to go there right now (cross platform printing would might take
lot of work). Best I can offer you currently is the savefig button.
I think gnome-print has made a fair amount of progress since I first
wrote matplotlib so if you want to be on the vanguard and explore this
option I would be happy.
 - Is there any density plot available ?
Do you mean hist?
http://matplotlib.sourceforge.net/screenshots.html#histogram_demo
http://matplotlib.sourceforge.net/matplotlib.matlab.html#-hist
 - Can I change the size taken by each of the Suplots ? 
Just use axes. Subplot derives from Axes. With axes, you can set the
size of your subplot with a rect [left, bottom, width, height]
http://matplotlib.sourceforge.net/matplotlib.matlab.html#-axes
http://matplotlib.sourceforge.net/matplotlib.axes.html
http://matplotlib.sourceforge.net/screenshots.html#axes_demo
- I have MANY small plots on my graph. Is there a cost effective way
 to filter which plots to show ?
I don't know what this means. Wouldn't you want to show all the plots
on your figure? Why else would you put them there? Please elaborate.
Cheers,
JDH
From: John H. <jdh...@ac...> - 2004年03月01日 14:26:08
>>>>> "matthew" == matthew arnison <ma...@ca...> writes:
 matthew> Specifically, what about making the default behaviour to
 matthew> clip the data at the first point which is equal or
 matthew> greater than the axis range? That should maintain the
 matthew> efficiency gains of clipping, while still keeping the
 matthew> scientific plotting behaviour that I think most users are
 matthew> accustomed to.
Hi Matthew -
That's a good idea - the data clipping feature was a gotcha for many.
For the next release, I turned data clipping off by default since I
don't think it's the typical use case and implemented the "first point
which is equal or greater" suggestion. However, I also have created a
config file, so you can set the default as you like.
JDH 
From: Kuzminski, S. R <SKu...@fa...> - 2004年03月01日 14:08:43
I upgraded to GD v2 and gdmodule v0.52 and I noticed that line widths
don't work correctly. If the line width is >1 the line comes out as
'stripes'. This is on Linux. The GD lib < 2.0 didn't have line width
support at all so maybe I've never seen GD create variable width lines
on linux? I wonder if this is a GD problem.
=20
I tried the new Agg backend, very nice. I'm all set to jettison GD
altogether and go with Agg except that the anti-aliased graphs that look
so great, print poorly.. :-( Is there a way to turn off the
anti-aliasing? It would be *great* to be able to drop that GD
dependency.
=20
thanks,
Stefan =20
From: Arnold M. <arn...@wu...> - 2004年03月01日 12:30:33
Dear all,
Praise for this first serious python plotting package!
I have two minor comments:
-> when I try to do an errorbar plot with a scalar, rather than an array 
as the argument (i.e. errorbar(scalar_x, scalar_y, xerr=scalar_xerr)) I 
get the following error message:
"/usr/lib/python2.3/site-packages/matplotlib/axes.py", line 569, in errorbar
 right = x+xerr[1]
IndexError: index out of bounds
This is due to the fact that the length of xerr is tested only to be 1 
or greater than 1 (asymmetric errors). However, the option that I would 
like to plot just one point is not included. So an extra if-clause is 
needed before the present code that checks whether x and xerr are arrays 
or not.
-> I very much like the option for scatter to color the blobs to be 
plotted. However, I have an application where the shape of the blobs is 
immaterial: I would rather have filled circles (or even better: filled 
symbols, be it circles, triangles ...). Anyhow: I would like them to be 
symmetric irrespective of the range of the axes. One option would be to 
allow the s-keyword to be allowed to be negative, where negative means: 
symmetric and the value of the negative number being the size relative 
to some default size.
Thanks and keep up the good work,
Arnold Moene
From: Dominique O. <do...@da...> - 2004年03月01日 00:23:17
Hello,
I am having trouble viewing scatter plots of large data sets
with the GTK backend. The plots are sparsity patterns of
sparse matrices, much in the way of Matlab's spy function.
First of all, there may be a conflict somewhere with my
version of GTK/PyGTK; issuing a plot() or scatter() command
often results in the message 'None Active' being displayed.
After a couple of seconds, the python prompt comes back, and
the 'scatter' command results in a huge number of messages
of the form 
 <matplotlib.patches.Circle instance at 0x4531730c>
begin displayed; litterally hundreds of them---it takes some
10 seconds. Finally, a show() opens up a Figure window, but
no plot. The matrix has 80519 nonzero elements and is
symmetric, so the scatter plot contains roughly twice as
many points. I have a Gnuplot interface and a spy-like
function which works just fine and displays the pattern in a
matter of a fraction of a second.
Sometimes, a plot using the GTK backend gets stuck in
gtk.mainloop(), and i have to interrupt it with Ctrl-C. I am
using SuSE Linux 8.0. I have installed the most recent
versions of GTK and PyGTK.
Thanks in advance for any suggestions.
Dominique
From: Jean-Baptiste C. <Jea...@de...> - 2004年02月27日 13:58:30
S=E6l !
I have been developing a small interface based on matlpotlib. I must say I =
really enjoy it.
I came to the point of a lot of small questions, not found in the FAQ
I am using matplotlib 0.50e on RedHat 9.0 linux and mainly the object picke=
r class
- I have 2 Suplots on top of each other, but when I select only one axis on=
 the drop-down button I get an error:
	Traceback (most recent call last):
 File "/usr/lib/python2.2/site-packages/matplotlib/backends/backend_gtk.py=
", line 987, in toggled
 if item=3D=3DitemAll:
NameError: free variable 'itemAll' referenced before assignment in enclosin=
g scope
- I want to systematically disable the vertical zoom/move on the second sub=
plot, but not the first. How can I do that ?
- How can I activate a tooltip on top of my plots ?
- I cannot zoom or move an plot I set the axis ticks to , ie ax.set_xticks(=
[])
- How could I add a button to directly print out the picture in the toolbar=
 ?
- Is there any density plot available ?
- Can I change the size taken by each of the Suplots ?=20
- I have MANY small plots on my graph. Is there a cost effective way to fil=
ter which plots to show ?
Thanks a lot for this great library !
Kve=F0ja
Jean-Baptiste
=09
--=20
-----------------------------
Jea...@de...
Department of Statistics
deCODE genetics Sturlugata,8
570 2993 101 Reykjav=EDk
From: matthew a. <ma...@ca...> - 2004年02月25日 22:35:50
I suggest to John a while back that for plotting it makes more sense for 
data ranges to be inclusive 
[] or min <= x <= max
rather than half-inclusive 
[) or min <= x < max
as is the python default for functions like range().
Specifically, what about making the default behaviour to clip the data at
the first point which is equal or greater than the axis range? That should
maintain the efficiency gains of clipping, while still keeping the
scientific plotting behaviour that I think most users are accustomed to.
Cheers,
Matthew.
From: John H. <jdh...@ac...> - 2004年02月25日 18:18:31
>>>>> "James" == James Boyle <bo...@ll...> writes:
 James> I set the axis bounds when I am plotting a number of lines
 James> some of which have a larger domain. While interested in the
 James> behaviour in the limited domain, I would like to retain the
 James> information that some lines extend beyond. When I first
 James> encountered this behaviour, I thought that I had mistakenly
 James> truncated my input data - I think that the plot should show
 James> as much of the data passed to it as possible.
 James> Is there something I am missing - or is this a feature?
It's a feature!
matplotlib does two kinds of clipping: data clipping and viewport
clipping. Viewport clipping is the typical clipping where the lines
are clipped to the viewport. data clipping throws out all points not
in the viewport.
I work with very long data sets of which only a small portion is in
the viewport, and use the interactive navigation controls to scroll
trough it. I found it was much more efficient to first clip the data
with Numeric before plotting it. See examples/stock_demo.py, of which
only a few days of 60 days of data are initially in the viewport.
You can control this in a couple of ways:
 from matplotlib.matlab import *
 ax = subplot(111)
 line1, line2 = plot([1,2,3,4],'bo', [1,2,3,4],'k')
 line1.set_data_clipping(False)
 line2.set_data_clipping(False)
 axis([0.,2.4,1.,4.])
 show()
Or edit the init function of lines.Line2D to turn data clipping off by
default
 self._useDataClipping = False
I've been meaning to make a matplotlibrc file to control things like
default line width, color, fontsize and name, antialiasing, data
clipping and so on.
JDH
From: James B. <bo...@ll...> - 2004年02月25日 17:56:53
If I set the axis limits to a value less than the actual domain of the 
data, the line is not extended to the edge of the plot but rather is 
only drawn to the final point within the domain. The following 
illustrates what I mean:
ax = subplot(111)
plot([1,2,3,4],'bo', [1,2,3,4],'k')
axis([0.,2.4,1.,4.])
The plot stops at the point (2,3) although the data go to (3,4). When I 
have dealt with these issues, I usually draw the line to its full 
extent and then clip the line so it stops at the edge of the plot 
frame.
I set the axis bounds when I am plotting a number of lines some of 
which have a larger domain. While interested in the behaviour in the 
limited domain, I would like to retain the information that some lines 
extend beyond.
When I first encountered this behaviour, I thought that I had 
mistakenly truncated my input data - I think that the plot should show 
as much of the data passed to it as possible.
Is there something I am missing - or is this a feature?
JIm
From: Gary P. <pa...@in...> - 2004年02月23日 23:22:17
> >>>>> "Gary" == Gary Pajer <pa...@in...> writes:
> 
> Gary> If I start interactive2.py, it complains that ShowOn can't
> Gary> be imported. Sure enough, there seems to be no method
> Gary> ShowOn. Or at least I can't find it. Consequently
> Gary> interactive2.py loses it's charm :)
> 
> Gary> Or have I misunderstood something?
> 
> You are using an out-of-date interactive2.py. Matplotlib recently
> changed (improved!) the way it sets the interactive flags. You have
> the new matplotlib module and the old interactive2.py code. Grab
> the latest *.tar.gz or *.zip and use examples/interactive2.py from
> that code.
> 
> Should help,
> JDH
Yes, thank you. 
From: James B. <bo...@ll...> - 2004年02月23日 19:01:27
On Feb 23, 2004, at 9:16 AM, John Hunter wrote
>
> Perhaps a better solution is to allow keyword args to the plot command
>
> plot(datar, -1.0*pr, 'b',
> linewidth=0.2, label='a red line', alpha=0.2)
>
> This could be extended to handle plot multiple plots with one command
> as follows
>
> plot(x1, y1, 'b', x2, y2, 'r--',
> linewidth=(2,3), label=('a blue line', 'a red line'),
> alpha=(1.0,0.5), antialiased = (True,False))
>
I strongly agree with the kwargs approach, it makes things clear as to 
what is being set.
> Just an oversight on my part - I've been adding these neglected
> accessor methods as people need them. The axes border is a
> patches.Rectangle instance. If you add the following accessor method
> to class Axes (on or around line 598)
>
> def get_frame(self):
> "Return the axes Rectangle frame"
> return self._axesPatch
> from matplotlib.matlab import *
> ax = subplot(111)
> plot([1,2,3])
> frame = ax.get_frame()
> frame.set_linewidth(3.0)
> frame.set_facecolor('r')
> frame.set_edgecolor('y')
> show()
I applied this patch and it worked fine. On my Mac I use the PS 
backend and convert to PDF. With the default frame width (0.5), the 
frame was not visible using Adobe Reader 6.0. The file printed fine, 
but the on screen viewing omitted the frame. This might be a personal 
problem on my setup, but it might be useful if other people have this 
difficulty. Making the frame width equal to 1 fixes things.
using matplotlib and lovin' it.
Jim
From: John H. <jdh...@ac...> - 2004年02月23日 17:45:33
>>>>> "James" == James Boyle <bo...@ll...> writes:
 James> I would like to be able to change the width of a line. If
 James> I just use B/W the use of line widths and styles can
 James> differentiate a number of lines. Currently, I do this: p =
 James> plot(datar,-1.0*(pr),'b') p.extend(
 James> plot(datac,-1.0*(pc),'r--')) p[0].set_linewidth(2)
 James> p[1].set_linewidth(3)
 James> Is this the way to do this? or is there something more
 James> elegant. 
I guess beauty is in the eye of the beholder, but I find this more
elegant
 liner, linec = plot(datar, -1.0*pr, 'b', 
 datac, -1.0*pc, 'r--')
 liner.set_linewidth(2)
 linec.set_linewidth(3) 
 James> It might be useful for the third argument to have color,
 James> style and width.
It's certainly doable, but my hesitancy in doing this is that there
are a lot of properties of a line that one could make an argument for
putting in the format string. matthew suggested allowing a label as
in 'r--;red line' (ala octave). Should the alpha property be in
there? My inclination is to follow the python design philosophy of
"one obvious way to do it". 
Perhaps a better solution is to allow keyword args to the plot command
 plot(datar, -1.0*pr, 'b', 
 linewidth=0.2, label='a red line', alpha=0.2)
This could be extended to handle plot multiple plots with one command
as follows
 plot(x1, y1, 'b', x2, y2, 'r--', 
 linewidth=(2,3), label=('a blue line', 'a red line'), 
 alpha=(1.0,0.5), antialiased = (True,False)) 
legend can be altered to use line labels if they exist, so you could
build the legend of this plot just by callinging
 legend()
I find this the kwargs approach a little cleaner than having a
mother-of-all-format-strings.
 James> I have not been able to figure out how to change the line
 James> thickness of the axis frame, i.e. the x and y axis
 James> themselves. There are examples for the grid, if one is
 James> used, and the tick marks but not the frame itself.
Just an oversight on my part - I've been adding these neglected
accessor methods as people need them. The axes border is a
patches.Rectangle instance. If you add the following accessor method
to class Axes (on or around line 598) 
 def get_frame(self):
 "Return the axes Rectangle frame"
 return self._axesPatch
I just added it to the src tree. You can then control the axes
rectangle as well, as in this example
 from matplotlib.matlab import *
 ax = subplot(111)
 plot([1,2,3])
 frame = ax.get_frame()
 frame.set_linewidth(3.0)
 frame.set_facecolor('r')
 frame.set_edgecolor('y')
 show()
Hope this helps,
JDH
From: James B. <bo...@ll...> - 2004年02月23日 17:21:35
I would like to be able to change the width of a line. If I just use 
B/W the use of line widths and styles can differentiate a number of 
lines. Currently, I do this:
 p = plot(datar,-1.0*(pr),'b')
 p.extend( plot(datac,-1.0*(pc),'r--'))
 p[0].set_linewidth(2)
 p[1].set_linewidth(3)
Is this the way to do this? or is there something more eleganf. It 
might be useful for the third argument to have color, style and width.
I have not been able to figure out how to change the line thickness of 
the axis frame, i.e. the x and y axis themselves. There are examples 
for the grid, if one is used, and the tick marks but not the frame 
itself.
Thanks for any help.
Jim
From: John H. <jdh...@ac...> - 2004年02月23日 01:53:44
>>>>> "katrin" == katrin schenk <sc...@ph...> writes:
 katrin> C:\GTK\lib and C:\GTK\include to the path
 ^^^
 should be C:\GTK\bin.
Also make sure you have no spaces in other entries in your path. 
Correcting your PATH will probably cure you, but if you still have
troubles you should read the FAQ entry "I cannot import gtk / gdk /
gobject" at http://matplotlib.sourceforge.net/faq.html and if you
still are having trouble after trying what is suggested there and
reading the links, you may want to consider using the wx backend.
http://matplotlib.sourceforge.net/backends.html#WX
Sorry you're having so much trouble; don't give up hope!
JDH
From: katrin s. <sc...@ph...> - 2004年02月22日 22:56:41
Hi again,
I have given up on installing matplotlib on linux for now, i have to 
upgrade my mandrake install anyway, then I will try again. Now I have an 
issue with installing matplotlib with gtk on my windows 2000 partition:
I followed the instructions on the web page to the letter:
	installed python23
 installed pygtk2.0 
 	installed gtk in C:\GTK
	added C:\GTK\lib and C:\GTK\include to the path
	installed matplotlib
For a test i ran:
	import pygtk
	pygtk.require('2.0')
	import gtk
At this point i get a system error telling me that the dynamic link 
library libglib-2.0-0.dll could not be found on my path. This makes sense 
since there IS no file libglib-2.0-0.dll in the GTK install, only a file 
called libglib-2.0.dll.a
What is going on? What have I done wrong?
Any help would be appreciated greatly!
katrin
From: John H. <jdh...@ac...> - 2004年02月22日 19:19:44
>>>>> "Gary" == Gary Pajer <pa...@in...> writes:
 Gary> If I start interactive2.py, it complains that ShowOn can't
 Gary> be imported. Sure enough, there seems to be no method
 Gary> ShowOn. Or at least I can't find it. Consequently
 Gary> interactive2.py loses it's charm :)
 Gary> Or have I misunderstood something?
You are using an out-of-date interactive2.py. Matplotlib recently
changed (improved!) the way it sets the interactive flags. You have
the new matplotlib module and the old interactive2.py code. Grab
the latest *.tar.gz or *.zip and use examples/interactive2.py from
that code.
Should help,
JDH
From: Gary P. <pa...@in...> - 2004年02月22日 19:14:48
If I start interactive2.py, it complains that ShowOn can't be imported.
Sure enough, there seems to be no method ShowOn. Or at least I can't find
it. Consequently interactive2.py loses it's charm :)
Or have I misunderstood something?
-gary
WinXP, python 2.3.3, matplotlib 5.0, GTK 2.2.4.1
From: John H. <jdh...@ac...> - 2004年02月22日 14:04:46
>>>>> "katrin" == katrin schenk <sc...@ph...> writes:
 katrin> Hi all, I am DESPERATE to use matplotlib on my linux
 katrin> box...Here is the problem, according to my linux box,
 katrin> Gtk+2.0 and the corresponding libgtk developer tools are
 katrin> installed. However, when I try to configure pygtk2.0
 katrin> (needed by matplotlib) I get an error saying that gtk+2.0
 katrin> is not installed, (I also tried (foolishly) to run a
 katrin> matplotlib example file with a gtk backgroud and got a
 katrin> "gobject missing" error). Has anyone else had a problem
 katrin> like this? Anyone know how to fix?
Hi Katrin,
I saw that you were already getting some good suggestions on the pygtk
list, which I also read. Those are the same things I would suggest
too: try an rpm, if not, make sure your pkgconfig for pygtk is updated
eg, what doed the following reveal?
 localhost:~> pkg-config --modversion gtk+-2.0
 2.2.1
Even if your RPM installed them, if pkgconfig cannot find them, you'll
have install troubles. You can set the path pkgconfig uses to find
files, eg, 
 setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/usr/lib/pkgconfig
In this case, you want to make sure the file gtk+-2.0.pc is in your
PKG_CONFIG_PATH path.
But these are all fallback suggestions if the rpm doesn't work for
you. If you have more trouble, it will help also to provide the exact
compiler error.
Good luck. If you figure out what was going wrong and fix it, let me
know and I'll update the website docs.
JDH
From: katrin s. <sc...@ph...> - 2004年02月22日 08:25:54
Hi all,
I am DESPERATE to use matplotlib on my linux box...Here is the problem,
according to my linux box, Gtk+2.0 and the corresponding libgtk developer 
tools are installed. However, when I try to configure pygtk2.0 (needed by 
matplotlib) I get an error saying that gtk+2.0 is not installed, (I 
also tried (foolishly) to run a matplotlib example file with a gtk 
backgroud and got a "gobject missing" error). Has anyone else had a 
problem like this? Anyone know how to fix?
katrin
From: John H. <jdh...@ac...> - 2004年02月21日 14:51:43
>>>>> "David" == David ASN <as...@ho...> writes:
 David> Hi all, I'm starting to get in matlabplot world :-D Before
 David> it I tried chaco but it doesn't work in Linux, so I want to
 David> try this. I'm trying to develope an oscilloscope and I
 David> need it to embed it into a wx application. i was thinking
 David> in derive a class from wxScrolledWindow and create a Figure
 David> inside, is it possible?
Is certainly possible. Have you looked at examples/anim.py and
examples/system_monitor.py? These use GTK, but will show you how to
dynamically update your figure. Both WX and GTK have a mainloop,
which probably means you need to define an update function that
updates your plot along the lines of system_monitor, and then pass
that function to an idle handler in wx.
 David> I want to know something about the Class Hierarchy in
 David> matplotlib, from which class figure derives, which is the
 David> 'main' class (Figure, i hope), where is the data stored,...
I assume you are using the latest matplotlib release 0.50. In this
release, there are two important objects for you. The first is
Figure, which is what the figure command creates and it contains all
the axes, plots, etc... This has nothing to do with wx, The second is
FigureCanvasWx. In backend wx, this derives from wxPanel and so is a
wx widget. It contains your figure.
In the matlab interface, you can access all of these attributes as
follows
manager = get_current_fig_manager()
canvas = manager.canvas # in wx mode, this is FigureCanvasWx
figure = canvas.figure # this is the backend independent Figure instance
In you oscilloscope update function, you will probably want to do
something along the lines of
lines = plot(t, y) # the initial plot at time 0
line = lines[0] # a matplotlib.lines.Line2D instance
def update_scope(*args):
 # get a new t, y
 line.set_data(t, y)
 canvas.draw()
# this is a made up function, meaning, tell wx's idle handler to call
# update_scope every 100ms
wx.idle_handler(update_scope, 0.1) 
show() # enter the wx mainloop
You don't need to use the matlab interface at all - you can work
directly with the wx widgets if you prefer. See
examples/embedding_in_wx.py
If you run into more trouble, post some code back here and someone can
probably help you out.
Good luck,
JDH
657 messages has been excluded from this view by a project administrator.

Showing results of 36569

<< < 1 .. 1449 1450 1451 1452 1453 .. 1463 > >> (Page 1451 of 1463)
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 によって変換されたページ (->オリジナル) /