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




Showing results of 152

<< < 1 2 3 4 5 .. 7 > >> (Page 3 of 7)
From: Gary R. <ga...@em...> - 2004年08月19日 09:42:47
Hi John,
Thanks very much for attending to the errorbar bar-ends. FYI, I ran the p=
atched code over my own errorbar plots and the refactoring seems to work =
correctly in all cases.
kudos,
Gary
> As Gary noted, recently we changed the way error bars were drawn which
> apparently had some unintended consequences. The root of the problem
> is related to one that came up earlier on the list about differences
> in the way regular lines and marker lines are handled.
<snip>
> Replace matplotlib.axes.Axes.errorbar with the code below. Errorbar
> users, I would be much obliged if you test this. I tried all of
> Gary's errorbar_demo examples and they appeared to work fine....
--=20
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
From: Gregory L. <gre...@ff...> - 2004年08月19日 08:34:19
On Wed, 2004年08月18日 at 20:45, Paul Barrett wrote:
> Nor Pirzkal wrote:
> > 
> > I really like the way matplotlib has been turning out. As a Mac 
> > user, I was wondering how portable to Aquaterm the entire thing might 
> > be. Any idea if a aqua front-end is in the work. While tcl/tk WX etc.. 
> > works well under OSX, it is a lot of stuff to have to compile and 
> > install for a plotting package.
> 
> No. There is currently no Aqua front-end being developed that I am aware of.
> 
> Have you any interest in developing one for Aqua? I'd suggest an AquaAgg/MacAgg 
> backend, i.e. use Agg to do the rendering and Aqua to do the windowing, such as 
> is done with GtkAgg, WXAgg, and TkAgg. Once the GUI wrapper is done, most of 
> matplotlib comes along for free.
Hi,
I confirm this, I wrote an fltkAgg backend without much experience of
matplotlib or gui programming to start with, by modification of an
existing *Agg (TkAgg, which is the best to start with as GtkAgg and
WXAgg have non-Agg version, and inherit most of their windowing methods
from the non-Agg version...so a copy and modify approach is not as
easy)...This took me a few days, some used for extending fltk and agg
for speed optimization...So I guess, except if Aqua is really different
from other toolkit, it should be a 1-2 day work for any Aqua/python
guru, at most :-)
So, any volunteer? ;-)
Greg.
From: Sigve T. <pu...@tj...> - 2004年08月19日 07:25:33
Hi everyone,
Is there any planned support for a Qt-backend? We are using Qt in our 
project, and I would like to use Matplot lib for plotting.
If there is not any support for Qt how hard would it be to make it myself? 
Would it be best to base it on the Agg backend, or should I make a native 
Qt backend? What is the least work? Is it possible to write the whole 
backend in Python or should I use C++ in addition?
Thanks,
Sigve Tjora
From: Stephen W. <ste...@cs...> - 2004年08月19日 00:24:45
On Wed, 2004年08月18日 at 15:02, Mark Howson wrote:
> Hi,
> 
> Is there any easy way of adding missing points to a (line) plot? Matlab 
> can do this using NaN, but as far as I can tell matplotlib doesn't 
> support this.
This would be very nice. Gnuplot has a similar characteristic: to
create the plots at http://www.csun.edu/sfo, I use a trick like this:
f(x) = (x==-999999 ? 1/0 : x)
plot "file" using 1ドル:(f(2ドル))
so that an equally spaced time series appears with gaps where we have
missing data.
Hmmm...is this something which should be supported via masked arrays? I
tried plotting a masked array with matplotlib and numarray's MA package,
and found matplotlib checks for the existence of a mask but throws an
exception if you try to plot it.
From: Mark H. <ao...@ds...> - 2004年08月18日 22:02:55
Hi,
Is there any easy way of adding missing points to a (line) plot? Matlab 
can do this using NaN, but as far as I can tell matplotlib doesn't 
support this. Something like the code below would be nice, but I don't 
know if this is Numeric compatible/cross platform enough/etc?
from numarray.ieeespecial import *
plot([10, 20, nan, 30])
I guess I can do split(source array) --> a, b and then plot(a, 
linestyle, b, linestyle) but having missings directly in the array would 
be preferable if possible.
On 2004年8月18日, John Hunter apparently wrote:
> Would you mind testing it for me? I tried it on a linux and winxp
> platform and it worked. But I never had problems before on those two
> platforms so it would be helpful to try yours as well.
Seems to work fine.
I also changed font_manager.py the same way:
 Change
 afmpath = os.environ.get('USERPROFILE', get_data_path())
 to
 afmpath = get_home()
 if afmpath is None: afmpath = get_data_path()
Sidenote:
recall that because of this problem, during installation
I ended up with a directory named literally
 Python23\%USERPROFILE
literally. Until I removed this, get_home did not work
quite right (because the first existence test was unexpectedly true!)
So you'll want to make sure this installation problem is
also gone.
Cheers,
Alan Isaac
From: John H. <jdh...@ac...> - 2004年08月18日 19:51:52
>>>>> "Paul" == Paul Barrett <ba...@st...> writes:
 Paul> I'm not sure what is going on here, but I can tell you that
 Paul> the Verdana font is somehow being corrupted, specifically
 Paul> the sfnts data. This font works fine for me with the
 Paul> simple_plot example.
FYI, I get the same problem on Windows XP with simple_plot.ps.
It's a simple win32 gotcha: you have to open binary files on win32 as
'rb'. linux doesn't make a distinction but windows does.
win32 ps users, you need to edit
site-packages/matplotlib/backends/backend_ps.py line 356 and use
 font = file(fontfile, 'rb')
The corrupted binary data hint triggered the idea - thanks Paul for
the hint and Alan for the bug report!
JDH
From: Dominique O. <Dom...@po...> - 2004年08月18日 19:45:45
Great, this is doing the job nicely, thanks ! I am not very clear as to=20
what the 'subs' argument really does. In your example:
 > #full control
 > gca().set_xscale('log',base=3D100,subs=3D[10,20,50])
 > #Major tick every 16**i, minor tick every subs*16**i
(16 should be 100 right?). There's a major tick at 100, 100^2, 100^3,=20
etc. And you're saying there are minor tick marks at 10*100*i ?!?
What if you'd want tick labels [0, 1, 2, 3, 4, ...] instead of (in base=20
2, say) [1, 2, 4, 8, 16, ...] ? Is that easily done? I tried to obtain=20
it based on the example custom_ticker1.py (in the examples=20
subdirectory), but haven't been successful so far.
Thanks A LOT for the update of axes.py and ticker.py,
Dominique
Gregory Lielens wrote:
> Hi, I though about this too and your message has convinced me it was
> worth spending a few minutes adding this ;-)
> I just patched loglocator and logformater to be able to use arbitrary
> base, and also to use arbitrary "minor" ticks. Well, I put minor betwee=
n
> quotes because Logticker do not really use minor ticks, only discard
> label for ticks that are not integer exponents of base...
> Usage is like this:
> Semilogx(x,y)
>=20
> #compatible with previous usage
> gca().set_xscale('log')=20
> # major tick every 10**i, minor tick every range(2,10)*10**I
>=20
> #change base
> gca().set_xscale('log',base=3D16)
> #Major tick every 16**i, minor tick every range(2,16)*16**i=20
>=20
> #full control
> gca().set_xscale('log',base=3D100,subs=3D[10,20,50])
> #Major tick every 16**i, minor tick every subs*16**i=20
>=20
>=20
> This gives me all the flexibility I need, and I feel it is a step in th=
e
> right direction, but:
> -maybe a rework of log ticker is needed so that it use minor/major tic=
k
> mechanism? Current mechanism is not as clean as it could, imho
> -maybe autoscale for loglocator should adjust the base/range to avoid
> excessive ticking (A discussion I had with john, with a zoom out it is
> possible to have very dense ticking)...Not so easy to do though, as sub=
s
> has to be adjusted too if one does not want too many minor ticks, as
> this adjustment is not so easy to do if one want "usefull" minor ticks
> in logscale...
> I thing these 2 points are linked, I would not go to 2 if 1 is not done=
,
> but if one is done (using some kind of linear locator (with autoscale
> capability) on 1 decade for minor ticks, and repeat this minor tick on
> each decade as I have done with my subs, I think we can have a very nic=
e
> framework to have fully automatic and nicely configurable log ticking
> :-)=20
>=20
>=20
> Best regards,
>=20
> Greg.
>=20
> PS: the 2 modified files are included, I made my modif relative to
> CVS...
>=20
>=20
>>-----Message d'origine-----
>>De : mat...@li...=20
>>[mailto:mat...@li...] De la=20
>>part de Dominique Orban
>>Envoy=E9 : mardi 17 ao=FBt 2004 18:57
>>=C0 : mat...@li...
>>Objet : [Matplotlib-users] Log plot in base b?
>>
>>
>>Hi,
>>
>>What would be the easiest way, in matplotlib, to achieve log scaling,=20
>>along the x axis, say, in a base other than 10? I see in axes.py that=20
>>semilog[xy] have LOG10 hardwired. I am using matplotlib 0.60.2.
>>
>>Thanks,
>>Dominique
From: Paul B. <ba...@st...> - 2004年08月18日 19:26:58
John Hunter wrote:
> I'm forwarding this problem from the scipy list
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Subject:
> Matplotlib font encoding problem
> From:
> Alan G Isaac <ai...@am...>
> Date:
> 2004年8月17日 23:17:34 -0400 (Eastern Daylight Time)
> To:
> scipy-user <sci...@sc...>
> 
> To:
> scipy-user <sci...@sc...>
> CC:
> jdh...@ni...
> 
> 
> Matplotlib is doing something with its fonts that
> is unfriendly. E.g., Ghostscript and Distiller choke on
> http://www.american.edu/econ/problems/matplotlib.fontproblem.eps
> 
> Ghostscript says it is an invalid front.
> 
> If I get rid of the verdana font encoding, the file displays fine.
> 
> I have the same problem when I try to use the TeX fonts.
Hi Alan,
I'm not sure what is going on here, but I can tell you that the Verdana font is 
somehow being corrupted, specifically the sfnts data. This font works fine for 
me with the simple_plot example.
Comparing the embedded fonts in the two .eps files, shows that the font in your 
file is corrupted. There are two possibilities here: either your TrueType Font 
(TTF) file is corrupted, or your binascii.b2a_hex function in the Python library 
is producing corrupted output. This function converts the TTF file to ASCII hex 
and is likely to be the culprit, since the length of some of the lines in sfnts 
array are incorrect. They should be 72 characters in length unless they begin 
or end with a '<' or '>', resp..
 -- Paul
-- 
Paul Barrett, PhD Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Branch
FAX: 410-338-4767 Baltimore, MD 21218
From: Paul B. <ba...@st...> - 2004年08月18日 18:45:17
Nor Pirzkal wrote:
> 
> I really like the way matplotlib has been turning out. As a Mac 
> user, I was wondering how portable to Aquaterm the entire thing might 
> be. Any idea if a aqua front-end is in the work. While tcl/tk WX etc.. 
> works well under OSX, it is a lot of stuff to have to compile and 
> install for a plotting package.
No. There is currently no Aqua front-end being developed that I am aware of.
Have you any interest in developing one for Aqua? I'd suggest an AquaAgg/MacAgg 
backend, i.e. use Agg to do the rendering and Aqua to do the windowing, such as 
is done with GtkAgg, WXAgg, and TkAgg. Once the GUI wrapper is done, most of 
matplotlib comes along for free.
>>
>> What's new in matplotlib-0.61.0 -
>>
>> Note win32 pygtk users - if you encounter problems or errors related
>> to svg loading, see note at end of this email.
>>
[snip, snip]
-- 
Paul Barrett, PhD Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Branch
FAX: 410-338-4767 Baltimore, MD 21218
>>>>> "Thomas" == Thomas Barket <tho...@ya...> writes:
 Thomas> Btw, what does "TkAgg sets interactive mode to True when
 Thomas> you issue the show command" mean exactly?
It means that if you are using tkagg and issue show, it launches the
interactive interpreter (python shell)
 Thomas> Wx has such a grid widget which can be used for
 Thomas> displaying/editing data, which is what I was hoping to
 Thomas> use. However, I am not sure if one should mix different
 Thomas> gui's. Iow, if I use tkagg or gtk as my interactive
 Thomas> matplotlib gui, can I also display and interact with
 Thomas> wxpython grid widgets in the same script smoothly? Am I
 Thomas> asking for trouble having the same script display
 Thomas> interactive matplotlib charts using one gui type and then
 Thomas> display these grid widgets using another gui type? Or
 Thomas> should I just stick with one gui type throughout the
 Thomas> entire script so that the interactive matplotlib charts
 Thomas> use say gtk and the same script also uses gtk for its grid
 Thomas> widgets?
OK, now I see better where you are coming from. You have a deluge of
data coming back from the prompt in the interactive shell and are
looking for a better way to deal with it. This is really beyond the
scope of matplotlib since it is a plotting library and your question
goes more to interacting with data. See ipython for solutions to
facilitate better interaction with data.
I can give you a couple of pointers though.
If you save the return value of a plot as a named variable, the output
will be suppressed. Then you can use array slicing to only show a
portion of it. 
 1 >>> n, bins, patches = hist(randn(10000), 100) # no output printed
 2 >>> n[:5] # look at your data in slices using indexing
 Out[2]: [1,1,2,5,3,]
ipython has additional features to automatically suppress really large
arrays
 1 >>> rand(100,100)
 Out[1]: array (100,100) , type = d, has 10000 elements
On to your question about mixing GUIs. Don't do it. You will
explode.
If you want to display your data in a wx grid, you could use the wxagg
matplotlib backend and write some functions to display the data in a
wx grid. Eg, if you are working in a shell that supports wx
interactive work (pycrust), you could write a function to display any
array or vector in a wx grid and then call that function
interactively. Fernando is working on an interactive shell (mentioned
previously) that supports matplotlib/gtk. Once he gets the kinks
worked out, he plans to support matplotlib/wx as well.
If you want to work in gtk (eg matplotlib/gtkagg) the equivalent to a
wx grid is a treeview/liststore. You can write functions to pipe
arrays into grids and then display them by calling that function
interactively. Here is an example using Fernando's ipython-gtk
 hunter:~/python/examples/pygtk> python ~/tmp/ip/ipython-gtk.py
 Extra content at the end of the document
 Python 2.3.2 (#1, Oct 13 2003, 11:33:15)
 [GCC 3.3.1] on linux2
 Type "copyright", "credits" or "license" for more information.
 (MatplotlibShell)
 1 >>> from matplotlib.numerix import rand
 2 >>> from array_to_grid import view_array
 3 >>> view_array( rand(20,10))
 Out[3]: <ArrayView object (GtkWindow) at 0x4136db94>
And this is the screenshot -
http://nitace.bsd.uchicago.edu:8080/files/share/Screenshot-Ipython-gtk.py.png
While it would be possible for us to write functions in matplotlib
that would implement view_array (or something like it) for each of the
GUI backends, allowing you to call this function for tk, wx or gtk,
it's really beyond the scope of matplotlib (we're busy enough trying
to plot!). It's more in the domain of a matlab / mathematica like
integrated scientific computing environment, another topic near and
dear to Fernando's heart.
Here is the code array_to_grid.py - you can do a lot more with
treeviews and liststores, eg make a proper editable spreadsheet
interface with scroll bars in both x and y directions, but this will
get you started
'Display an array as a treeview'
import pygtk
pygtk.require('2.0')
import gobject
import gtk
from gtk import gdk
def view_array(X):
 'instantiate an ArrayView instance and show it'
 grid = ArrayView(X)
 grid.show_all()
 return grid
 
class ArrayView(gtk.Window):
 def __init__(self, X):
 gtk.Window.__init__(self)
 self.numRows, self.numCols = X.shape
 self.data = X
 self.set_title('Array display')
 self.set_border_width(8)
 vbox = gtk.VBox(False, 8)
 self.add(vbox)
 sw = gtk.ScrolledWindow()
 sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
 sw.set_policy(gtk.POLICY_NEVER,
 gtk.POLICY_AUTOMATIC)
 vbox.pack_start(sw, True, True)
 model = self.create_model()
 self.treeview = gtk.TreeView(model)
 self.treeview.set_rules_hint(True)
 sw.add(self.treeview)
 self.add_columns()
 self.set_default_size(640, 480)
 self.add_events(gdk.BUTTON_PRESS_MASK |
 gdk.KEY_PRESS_MASK|
 gdk.KEY_RELEASE_MASK)
 def add_columns(self):
 model = self.treeview.get_model()
 renderer = gtk.CellRendererText()
 for i in range(self.numCols):
 column = gtk.TreeViewColumn('%d'%i, gtk.CellRendererText(), text=i)
 self.treeview.append_column(column)
 def create_model(self):
 types = [gobject.TYPE_DOUBLE]*self.numCols
 store = gtk.ListStore(*types)
 for row in self.data:
 iter = store.append()
 pairs = []
 for i, num in enumerate(row): pairs.extend((i, num))
 store.set(iter, *pairs)
 return store
 
if __name__=='__main__':
 from matplotlib.numerix import rand
 view_array(rand(10,10))
 gtk.main()
John,
Many thanks for your reply. I had seen the interactive.html page before but
I didn't realize I had to drop the "show()" statement in order to accomplish
interactivity. Iow, I had set my matplotlibc file to have interactive be
true, but when I wrote scripts, I kept on using the "show()" command. Oops.
Tks for clearing that up.
Btw, what does "TkAgg sets interactive mode to True when you issue the show
command" mean exactly? Should it say False instead? Anyway, I kept using
"show()" in my scripts, which "hid" interactivity from me. I got that now.
My explanation of what I meant by displaying data in grid-like tables was
not good. Pls let me try again. Your example is v informative and useful,
but it doesn't get at what I had in mind. I did not mean displaying
multiple charts in one window in a grid-like orientation. By displaying the
data set in a grid-like table, I want to see the underlying numerical data
(ie, the actualy numbers) displayed in a grid window.
Perhaps I can better explain what I mean by continuing with your example.
When I run it, upon entering the line that reads "hist(randn(10000), 100)
# lower right", my python prompt prints out the following:
>>> hist(randn(10000), 100) # lower right
(array([ 3, 0, 3, 5, 4, 10, 3, 5, 11, 2, 17, 9, 7,
 17, 24, 31, 29, 38, 42, 36, 53, 57, 70, 79, 78, 84,
 105, 103, 132, 158, 141, 164, 177, 172, 181, 217, 223, 243, 254,
 258, 286, 276, 279, 279, 300, 312, 333, 280, 305, 270, 278, 278,
 273, 257, 239, 223, 204, 216, 216, 174, 169, 142, 136, 120, 118,
 102, 89, 79, 69, 60, 48, 55, 42, 37, 27, 31, 30, 25,
 14, 12, 19, 12, 10, 5, 2, 5, 2, 2, 2, 1, 1,
 3, 2, 2, 1, 2, 0, 0, 0, 1]), array([-3.35781891
57051, -3.21132211, -3.13807372, -3.06482532,
 -2.99157693, -2.91832853, -2.84508014, -2.77183174, -2.69858334,
 -2.62533495, -2.55208655, -2.47883816, -2.40558976, -2.33234137,
 -2.25909297, -2.18584457, -2.11259618, -2.03934778, -1.96609939,
 -1.89285099, -1.8196026 , -1.7463542 , -1.6731058 , -1.59985741,
 -1.52660901, -1.45336062, -1.38011222, -1.30686383, -1.23361543,
 -1.16036703, -1.08711864, -1.01387024, -0.94062185, -0.86737345,
 -0.79412506, -0.72087666, -0.64762826, -0.57437987, -0.50113147,
 -0.42788308, -0.35463468, -0.28138629, -0.20813789, -0.13488949,
 -0.0616411 , 0.0116073 , 0.08485569, 0.15810409, 0.23135248,
 0.30460088, 0.37784928, 0.45109767, 0.52434607, 0.59759446,
 0.67084286, 0.74409125, 0.81733965, 0.89058805, 0.96383644,
 1.03708484, 1.11033323, 1.18358163, 1.25683002, 1.33007842,
 1.40332682, 1.47657521, 1.54982361, 1.623072 , 1.6963204 ,
 1.76956879, 1.84281719, 1.91606558, 1.98931398, 2.06256238,
 2.13581077, 2.20905917, 2.28230756, 2.35555596, 2.42880435,
 2.50205275, 2.57530115, 2.64854954, 2.72179794, 2.79504633,
 2.86829473, 2.94154312, 3.01479152, 3.08803992, 3.16128831,
 3.23453671, 3.3077851 , 3.3810335 , 3.45428189, 3.52753029,
 3.60077869, 3.67402708, 3.74727548, 3.82052387, 3.89377227])...
To me, that isnt a fun way to look at (or attempt to edit) the numbers in my
data set. I think it would be much more useful to display the numbers such
as those above in a separate window. What if I have 5,000 data
observations? A scrollable data grid window would make a much nicer
display. The picture at http://freshmeat.net/screenshots/36907/39220/ gives
the basic idea of what I mean by a data grid (though what I need is much
more basic than that picture).
Wx has such a grid widget which can be used for displaying/editing data,
which is what I was hoping to use. However, I am not sure if one should mix
different gui's. Iow, if I use tkagg or gtk as my interactive matplotlib
gui, can I also display and interact with wxpython grid widgets in the same
script smoothly? Am I asking for trouble having the same script display
interactive matplotlib charts using one gui type and then display these grid
widgets using another gui type? Or should I just stick with one gui type
throughout the entire script so that the interactive matplotlib charts use
say gtk and the same script also uses gtk for its grid widgets?
I hope that makes more sense.
Thanks again,
Tom
-----Original Message-----
From: John Hunter [mailto:jdh...@ac...] 
Sent: Tuesday, August 17, 2004 12:59 PM
To: Thomas Barket
Cc: mat...@li...
Subject: Re: [Matplotlib-users] Requesting advice on multi-threaded
matplotlib session + grids displaying data
>>>>> "Thomas" == Thomas Barket <tho...@ya...> writes:
 Thomas> Hello, I am fairly new to matplotlib in particular and
 Thomas> using gui's in general and don't have much experience yet
 Thomas> with threading. From a python command prompt, I want to
 Thomas> be able to use python to create and work with data sets,
 Thomas> while simultaneously be able to chart the data with
 Thomas> matplotlib. Since I would like to display more than one
 Thomas> matplotlib chart at a time, I presume this involves
 Thomas> working with threads. Furthermore, I would like to also
 Thomas> display the data sets in a grid-like table, and since I
 Thomas> want to see more than one such grid-like table at a time
 Thomas> (and of course see grid-like tables and matplotlib charts
 Thomas> at the same time too), I think this will also involve
 Thomas> threading.
Have you had a chance to read
http://matplotlib.sourceforge.net/interactive.html? This gives a little
background on using matplotlib interactively.
As stated on that page, the best approach with the current matplotlib
(0.61) is to set 
 backend : TkAgg
 interactive : True
in your matplotlibrc file
(http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC). If you do this,
you will not need to call show.
Fernando Perez, author of ipython, is working on a much improved interactive
shell for matplotlib + GTK. He plans eventually to support all the
backends, but right now is focusing on GTK (tkagg already works with
ipython). You will need CVS ipython and CVS matplotlib to try this out, but
it is very nice. See his earlier post
 
http://sourceforge.net/mailarchive/forum.php?thread_id=5323260&forum_id=3340
5
As for the grids, if I understand you correctly, the best way to do this is
create multiple axes with the subplot command, eg,
 from matplotlib.matlab import *
 subplot(221) # upper left
 plot(range(10), 'go')
 subplot(222)
 pcolor(rand(10,10)) # upper right
 subplot(223)
 scatter(rand(12), rand(12)) # lower left
 subplot(224)
 hist(randn(10000), 100) # lower right
 show()
Is this what you are looking for? [You can embed multiple matplotlib figure
canvases into a wx grid or a gtk.Table if you want to use the GUI API, but
I'm assuming you're looking for something simpler, as above].
JDH
>>>>> "John" == John Hunter <jdh...@ac...> writes:
 John> THE HACK for Windows users with the problematic install and
 John> behavior: change HOME to USERPROFILE in font_manager.py.
Hi Alan, 
Thanks for the bug report and the pointer to the solution I added the
following code to matplotlib.__init__.py above the get_data_path
function
def get_home():
 """
 return the users HOME dir across platforms or None.
 
 On win32, if either HOME is not set or HOME is set but doesn't
 exist, the value of USERPROFILE will be used instead.
 """
 if os.environ.has_key('HOME'):
 path = os.environ['HOME']
 if os.path.exists(path): return path
 if sys.platform=='win32' and os.environ.has_key('USERPROFILE'):
 path = os.environ['USERPROFILE']
 if os.path.exists(path): return path
 return None
And then use this everywhere in the code that wants HOME.
Fortunately, that is only two places, once in matplotlib_fname and
once in the font_manager. 
In font_manager, if you import it
from matplotlib import rcParams, get_data_path, get_home
and use it
 ttfpath = get_home()
 if ttfpath is None: ttfpath = get_data_path()
 ttfcache = os.path.join(ttfpath, '.ttffont.cache')
it should fix the bug.
Would you mind testing it for me? I tried it on a linux and winxp
platform and it worked. But I never had problems before on those two
platforms so it would be helpful to try yours as well.
Thanks!
JDH
From: John H. <jdh...@ac...> - 2004年08月18日 13:02:52
>>>>> "Dominique" == Dominique Orban <Dom...@po...> writes:
 Dominique> Sorry if this is a silly question; i couldn't find the
 Dominique> answer in the source files or the mailing list archive.
 Dominique> I am using matplotlib 0-60.2. Is there an equivalent in
 Dominique> matplotlib to the matlab command 'axis square', to set
 Dominique> the aspect ratio to 1? More generally, can i set the
 Dominique> aspect ratio to any ratio i like? I am interested in
 Dominique> this for plot() and scatter().
There is no axis square at the moment (easy to add though). But yes,
you can set the axes to any aspect ratio you want. Rather than
calling 'subplot', call 'axes'.
 # left, bottom, width, height
 axes([0.15, 0.15, 0.7, 0.7])
The numbers are fractions of the figure size. So left is 0.15*figure
width, bottom is 0.15 * figure height, width is 0.7 * figure width and
height is 0.7 * figure height. See
http://matplotlib.sourceforge.net/matplotlib.matlab.html#-axes for
more info.
You can control the figure dimensions using the figsize argument (args
in inches, my apologies)
 # figure is 6 inches square
 figure(1, figsize=(6, 6))
See http://matplotlib.sourceforge.net/matplotlib.matlab.html#-figure.
Here is and example script
 from matplotlib.matlab import *
 side = 7 # side of square in inches
 figure(1, figsize=(side, side))
 # left, bottom, width, height
 axes([0.15, 0.15, 0.7, 0.7])
 N = 500 # number of scatter points
 scatter(rand(N), rand(N)) # should be square
 savefig('test.ps')
 show()
That said, there is a very important caveat. This probably won't
appear square on your monitor because the dots per inch on your
monitor likely differ in the horizontal and vertical directions (it
should be square if you save as *.ps and print it on a postscript
printer). When I implemented freetype fonts for matplotlib, I asked
on this list if anyone was interested in matplotlib supporting dpi in
the x and y direction so that you could actually create figures in
true sizes on the monitor, but there was no interest at the time. The
freetype lib supports horizontal and vertical dpi, which is why it
came up at the time.
JDH
From: Gregory L. <gre...@ff...> - 2004年08月18日 12:57:40
Attachments: axes.py ticker.py
Oups, sorry, sent an older version of my modified files...
Here they are...
Also, this works of course for both x and y scales, who can have
different bases and subs...
Best regards, Greg.
From: John H. <jdh...@ac...> - 2004年08月18日 12:46:58
>>>>> "danny" == danny shevitz <dan...@ya...> writes:
 danny> howdy, I'm doing an errorbar plot. The cap colors are
 danny> always black, even when ecolor is explicitly set. The
 danny> documentation states that the second argument returned by
 danny> errorbar is a list of "error bar lines". I looked at the
 danny> return value and it appears to be a list of 3-tuples of
 danny> Line2D instances. I presume each 3-tuple is the errorbar,
 danny> and the two endcaps. If I explicitly set the color of the
 danny> whole erno collection, only the errorbar color is changed
 danny> not the cap color. I can't find any "errorbar Line2D" class
 danny> or documentation to that effect.
As Gary noted, recently we changed the way error bars were drawn which
apparently had some unintended consequences. The root of the problem
is related to one that came up earlier on the list about differences
in the way regular lines and marker lines are handled.
A little background. The Line2D class makes a distinction between
markers and lines: the color of markers, eg circles and squares, are
determined by the 'markeredgecolor' and 'markerfacecolor' properties;
the color of regular lines is determined by the 'color' property.
There is another special thing about markers: their sizes are in
points, and so do not depend on the axes scale or transformation. If
you zoom in on a marker, it still looks the same.
For errorbars, the last property is a nice, because we want the error
bar caps to be a fixed capsize in points rather than depend on the
scale. So we changed errorbar to use the new line *marker* symbols
'_' and '|'. While they plot like a solid line, matplotlib considers
them to be markers. So
 >> plot(x,y,'_') 
are horizontal lines centered at x, with height y, and length 
*in points* determined by the markersize. Ditto for '|, which are
vertical lines. Perfect for tick marks or errorbar caps.
However, as markers, their color is determined by the markerfacecolor
and markeredgecolor, which is a bit whacked, I realize. Perhaps they
should be factored into a separate category, or perhaps I should just
change the Line2D class to forward calls from set_color to
set_facecolor and set_edgecolor for these special markers.
I rewrote (and simplified) the errorbar code to fix this problem. It
should be faster too, because I plot the x and y caps in single calls
to plot rather than creating a bunch of individual lines, which was
how the '_' and '|' markers were meant to be used. Code below.
 danny> So what am I missing and how do I change errobar cap colors
 danny> without doing an explicit loop over the 3-tuples and
 danny> setting their colors explicitly?
For future reference, 'set' will loop for you
 >>> lines, errbars = errorbar(t, s, [e,g], f, fmt='o')
 >>> set(errbars, markerfacecolor='g', markeredgecolor='g')
but with the patched code, that won't be necessary.
Replace matplotlib.axes.Axes.errorbar with the code below. Errorbar
users, I would be much obliged if you test this. I tried all of
Gary's errorbar_demo examples and they appeared to work fine....
 def errorbar(self, x, y, yerr=None, xerr=None,
 fmt='b-', ecolor='k', capsize=3):
 """
 Plot x versus y with error deltas in yerr and xerr.
 Vertical errorbars are plotted if yerr is not None
 Horizontal errorbars are plotted if xerr is not None
 xerr and yerr may be any of:
 a rank-0, Nx1 Numpy array - symmetric errorbars +/- value
 an N-element list or tuple - symmetric errorbars +/- value
 a rank-1, Nx2 Numpy array - asymmetric errorbars -column1/+column2
 Alternatively, x, y, xerr, and yerr can all be scalars, which
 plots a single error bar at x, y.
 
 fmt is the plot format symbol for y. if fmt is None, just
 plot the errorbars with no line symbols. This can be useful
 for creating a bar plot with errorbars
 Return value is a length 2 tuple. The first element is a list of
 y symbol lines. The second element is a list of error bar lines.
 capsize is the size of the error bar caps in points
 """
 if not self._hold: self.cla()
 # make sure all the args are iterable arrays
 if not iterable(x): x = asarray([x])
 else: x = asarray(x)
 if not iterable(y): y = asarray([y])
 else: y = asarray(y)
 if xerr is not None:
 if not iterable(xerr): xerr = asarray([xerr])
 else: xerr = asarray(xerr)
 if yerr is not None:
 if not iterable(yerr): yerr = asarray([yerr])
 else: yerr = asarray(yerr)
 if fmt is not None:
 l0 = self.plot(x,y,fmt)
 else: l0 = None
 caplines = []
 barlines = []
 
 capargs = {'c':ecolor, 'mfc':ecolor, 'mec':ecolor, 'ms':2*capsize}
 if xerr is not None:
 if len(xerr.shape) == 1:
 left = x-xerr
 right = x+xerr
 else:
 left = x-xerr[0]
 right = x+xerr[1]
 barlines.extend( self.hlines(y, x, left) )
 barlines.extend( self.hlines(y, x, right) ) 
 caplines.extend(self.plot(left, y, '|', **capargs))
 caplines.extend(self.plot(right, y, '|', **capargs)) 
 if yerr is not None:
 if len(yerr.shape) == 1:
 lower = y-yerr
 upper = y+yerr
 else:
 lower = y-yerr[0]
 upper = y+yerr[1]
 barlines.extend( self.vlines(x, y, upper ) )
 barlines.extend( self.vlines(x, y, lower ) ) 
 caplines.extend(self.plot(x, lower, '_', **capargs))
 caplines.extend(self.plot(x, upper, '_', **capargs)) 
 for l in barlines:
 l.set_color(ecolor)
 self.autoscale_view()
 return (l0, caplines+barlines)
From: Alan G I. <ai...@am...> - 2004年08月18日 04:46:32
ON 2004年08月17日 16:05 Dominique Orban <Dominique@po...> wrote:
> I am using matplotlib 0-60.2. Is there an equivalent in matplotlib to 
> the matlab command "axis square", to set the aspect ratio to 1? More 
> generally, can i set the aspect ratio to any ratio i like? I am 
> interested in this for plot() and scatter().
 
Please post any info you get.
I need the same thing.
Thank you,
Alan Isaac
From: <ga...@em...> - 2004年08月18日 02:12:59
Hi Danny,
I think I know what's going on here - The rendering of bar-ends was chang=
ed at one point to use tick line markers instead of being rendered as par=
t of the line. I had seen the behaviour you describe at one point, but fo=
r some reason (brain failure!) had convinced myself later that the behavi=
our had remedied itslef somehow. I didn't understand this at the time, bu=
t I should have put the effort in because it's crept through and you've t=
ripped over it. The solution is to revert the bar-end rendering to the wa=
y it used to be done. I don't know if you can fix this without touching t=
he Matplotlib source since I suspect the line markers reference isn't bei=
ng returned. I can't look at this for a day or more, so either be patient=
 and I'll post the fix to this list, or maybe John Hunter will get to it =
first,
regards,
Gary Ruben
----- Original Message -----
From: danny shevitz <dan...@ya...>
Date: 2004年8月17日 09:38:40 -0700 (PDT)
To: matplotlib <mat...@li...>
Subject: [Matplotlib-users] errorbar cap color
> howdy,=20
> I'm doing an errorbar plot. The cap colors are always black, even when
> ecolor is explicitly set. The documentation states that the second
> argument returned by errorbar is a list of "error bar lines". I looked
> at the return value and it appears to be a list of 3-tuples of Line2D
> instances. I presume each 3-tuple is the errorbar, and the two endcaps.
> If I explicitly set the color of the whole erno collection, only the
> errorbar color is changed not the cap color. I can't find any "errorbar
> Line2D" class or documentation to that effect.=20
>=20
> So what am I missing and how do I change errobar cap colors without
> doing an explicit loop over the 3-tuples and setting their colors
> explicitly?
>=20
> TIA,
> Danny
--=20
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
From: John H. <jdh...@ac...> - 2004年08月17日 23:27:20
>>>>> "danny" == danny shevitz <dan...@ya...> writes:
 danny> Howdy, Another stupid problem. Before .61 when I plotted
 danny> with symbols, the symbols were unfilled, now they are
 danny> filled. How do I control this? I can't find any
 danny> markerfilled property in the Line2D class.
You can override the markerfacecolor as a kwarg
 >>> plot(arange(10), 'ro', markerfacecolor=None)
You can also use the abbreviation 'mfc'
 >>> plot(arange(10), 'ro', mfc=None)
Should help!
JDH
From: Dominique O. <Dom...@po...> - 2004年08月17日 23:05:52
Sorry if this is a silly question; i couldn't find the answer in the 
source files or the mailing list archive.
I am using matplotlib 0-60.2. Is there an equivalent in matplotlib to 
the matlab command 'axis square', to set the aspect ratio to 1? More 
generally, can i set the aspect ratio to any ratio i like? I am 
interested in this for plot() and scatter().
Thanks !
Dominique
>>>>> "Thomas" == Thomas Barket <tho...@ya...> writes:
 Thomas> Hello, I am fairly new to matplotlib in particular and
 Thomas> using gui's in general and don't have much experience yet
 Thomas> with threading. From a python command prompt, I want to
 Thomas> be able to use python to create and work with data sets,
 Thomas> while simultaneously be able to chart the data with
 Thomas> matplotlib. Since I would like to display more than one
 Thomas> matplotlib chart at a time, I presume this involves
 Thomas> working with threads. Furthermore, I would like to also
 Thomas> display the data sets in a grid-like table, and since I
 Thomas> want to see more than one such grid-like table at a time
 Thomas> (and of course see grid-like tables and matplotlib charts
 Thomas> at the same time too), I think this will also involve
 Thomas> threading.
Have you had a chance to read
http://matplotlib.sourceforge.net/interactive.html? This gives a
little background on using matplotlib interactively.
As stated on that page, the best approach with the current matplotlib
(0.61) is to set 
 backend : TkAgg
 interactive : True
in your matplotlibrc file
(http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC). If you do
this, you will not need to call show.
Fernando Perez, author of ipython, is working on a much improved
interactive shell for matplotlib + GTK. He plans eventually to
support all the backends, but right now is focusing on GTK (tkagg
already works with ipython). You will need CVS ipython and CVS
matplotlib to try this out, but it is very nice. See his earlier post
 http://sourceforge.net/mailarchive/forum.php?thread_id=5323260&forum_id=33405
As for the grids, if I understand you correctly, the best way to do
this is create multiple axes with the subplot command, eg,
 from matplotlib.matlab import *
 subplot(221) # upper left
 plot(range(10), 'go')
 subplot(222)
 pcolor(rand(10,10)) # upper right
 subplot(223)
 scatter(rand(12), rand(12)) # lower left
 subplot(224)
 hist(randn(10000), 100) # lower right
 show()
Is this what you are looking for? [You can embed multiple matplotlib
figure canvases into a wx grid or a gtk.Table if you want to use the
GUI API, but I'm assuming you're looking for something simpler, as
above].
JDH
From: Dominique O. <Dom...@po...> - 2004年08月17日 17:40:12
Hi,
What would be the easiest way, in matplotlib, to achieve log scaling, 
along the x axis, say, in a base other than 10? I see in axes.py that 
semilog[xy] have LOG10 hardwired. I am using matplotlib 0.60.2.
Thanks,
Dominique
From: danny s. <dan...@ya...> - 2004年08月17日 17:10:41
howdy, 
I'm doing an errorbar plot. The cap colors are always black, even when
ecolor is explicitly set. The documentation states that the second
argument returned by errorbar is a list of "error bar lines". I looked
at the return value and it appears to be a list of 3-tuples of Line2D
instances. I presume each 3-tuple is the errorbar, and the two endcaps.
If I explicitly set the color of the whole erno collection, only the
errorbar color is changed not the cap color. I can't find any "errorbar
Line2D" class or documentation to that effect. 
So what am I missing and how do I change errobar cap colors without
doing an explicit loop over the 3-tuples and setting their colors
explicitly?
TIA,
Danny
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 
From: danny s. <dan...@ya...> - 2004年08月17日 16:54:34
Howdy,
Another stupid problem. Before .61 when I plotted with symbols, the
symbols were unfilled, now they are filled. How do I control this? I
can't find any markerfilled property in the Line2D class.
TIA,
Danny
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 
Hello,
I am fairly new to matplotlib in particular and using gui's in general and
don't have much experience yet with threading. From a python command
prompt, I want to be able to use python to create and work with data sets,
while simultaneously be able to chart the data with matplotlib. Since I
would like to display more than one matplotlib chart at a time, I presume
this involves working with threads. Furthermore, I would like to also
display the data sets in a grid-like table, and since I want to see more
than one such grid-like table at a time (and of course see grid-like tables
and matplotlib charts at the same time too), I think this will also involve
threading.
I am currently pretty comfortable using matplotlib, though I don't yet know
how to plot a chart and get the python cursor back to do more work and
interact with the chart dynamically. 
I know wxpython has a grid-like table for displaying data called wx.grid. I
was hoping to be able to use matplotlib in a threaded manner and also use
these wx.grid widgets to display data in a threaded manner from the same
python session. How complicated is it to accomplish this kind of
functionality?
Since the interactive2.py threading example uses pygtk, is pygtk the best
way to create multiple, threaded plots from a python prompt and interact
with them while also doing data manipulation at the python prompt?
If pygtk is the best/easiest way to create threaded matplotlib plots, is it
possible/desirable to utilize threaded wx.grids in the same session, or
should I stick with whatever grid-like table is provided by pygtk in order
for the grids to play nice with the charts (ie, keep all threaded gui
objects to be pygtk widgets)?
Is it not possible to use python's thread or queue module to do most of the
work here, instead of utilizing pygtk threads or wxpython threads? Why cant
I just create any new gui object (whether a matplotlib chart or some kind of
grid-like table of data) in a new python thread?
Thanks vm for your help.
Tom
4 messages has been excluded from this view by a project administrator.

Showing results of 152

<< < 1 2 3 4 5 .. 7 > >> (Page 3 of 7)
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 によって変換されたページ (->オリジナル) /