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


Showing 15 results of 15

From: andreyd <by...@gm...> - 2009年12月04日 22:20:23
avee wrote:
> 
> Dear users,
> I have been working on a scope based on matplotlib to monitor acquisition
> data. In order to enhance frame per seconds, I have used matplotlib's blit
> capabilities and works ok. No flickering, nice and smooth. Here's how it's
> done, take note that bbox is taken from the figure and not the axes object
> in order to make the scale animated. The problem I have, is that the
> figure is all white because of this.. just a question of esthetics :-) If
> bbox is taken from the axis, the scale will never be drawn. Any
> suggestion?
> 
> 
This worked for me:
to remove axis temporary and than to take background of the whole picture
but without ticks and labels of this axis:
 self.axxaxis = self.ax.get_xaxis()
 
# store ticker 
 MJF = self.axxaxis.get_major_formatter()
 MJL = self.axxaxis.get_major_locator()
#remove axis
 self.axxaxis.set_major_formatter(NullFormatter())
 self.axxaxis.set_major_locator(NullLocator())
 self.draw()
 ... 
 take background for blit
 ...
# restore ticker
 self.axxaxis.set_major_formatter(MJF)
 self.axxaxis.set_major_locator(MJL) 
 
-- 
View this message in context: http://old.nabble.com/animated-axis-tp26635860p26642470.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2009年12月04日 21:08:21
On Fri, Dec 4, 2009 at 2:49 PM, Ryan Neve <rya...@gm...> wrote:
> Than you for your assistance with AxesGrid.
>
> Concerning the documentation, on this page:
> http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.htmit says:
> Name Default Description aspect True aspect of axes
> then a few lines below:
> "*aspect*By default (False), widths and heigths of axes in the grid are
> scaled independently. If True, they are scaled according to their data
> limits (similar to aspect parameter in mpl)."
>
> **
Thanks a lot.
This need to be fixed.
> *Here is a more complete example of my code:
> *In the following code, x_grid and y_grid are are arrays created by
> meshgrid and represent time and water depth respectively.
> z_dim is a dictionary of one or more arrays of sensor readings
> corresponding to the depths and times in x_grid and y_grid.
>
>
>
Please, "more" complete example does not make any difference unless it is
complete.
Try the following code. This is based on the first part of your example. It
will show empty axes but without extra ticklabels. Again, I think an extra
axes is added to the figure somewhere in your code. And, without a complete,
runnable (but simple) code, there is not much I (or others) can help.
-JJ
from matplotlib import pyplot
from mpl_toolkits.axes_grid import AxesGrid
nrows = 3
DAP_figure = pyplot.figure(1,(20,8))
pyplot.figtext(0.05,.5,"Depth
(m)",rotation='vertical',verticalalignment='center')
# Create a grid of axes with the AxesGrid helper class
my_grid = AxesGrid(DAP_figure, 111, # Only one grid in this figure
 nrows_ncols = (nrows,1), # one or more rows, but only one
column
 axes_pad = 0.0, #pad between axes in inches
 aspect=False, # If True, all plots are superimposed upon one
another.
 add_all=True, # not sure why this would ever be False
 share_all=True, # I think this means that all axes have the
same x & y scales
 label_mode = "L", # labels for depth on left and time on
bottom
 cbar_location="right",
 cbar_mode="each", # each axes has a different scale
 cbar_size="2%",
 cbar_pad="1%",
 )
pyplot.draw()
pyplot.show()
From: Jae-Joon L. <lee...@gm...> - 2009年12月04日 20:09:49
First of all, unless you're displaying multiple images (with aspect),
there is not much of benefit of using axes_grid toolkit. So I
strongly recommend you to stick to subplot.
axes_grid toolkit uses different kind of artists to draw ticklabels.
Therefore, most of the matplotlib command that try to change the
properties of the ticklabels does not work.
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/axislines.html
You may recover the original matplotlib behavior, but some of the
feature in axes_grid toolkit won't work.
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.html#axisline
axes_grid way of rotating ticklabels is
 ax.axis["bottom"].major_ticklabels.set_rotation(90)
But, you may want to fiddle with other properties also.
 ax.axis["bottom"].major_ticklabels.set_va("top")
 ax.axis["bottom"].major_tick_pad = -8
Anyhow, I must admit that handling of ticklabels in axes_grid toolkit
is a bit messy currently. And I hope to improve it soon.
Regards,
-JJ
On Fri, Dec 4, 2009 at 12:56 PM, <PH...@ge...> wrote:
> Hey folks,
>
> I'm trying to make some bar plots using AxesGrid and the set_xlabels method doesn't seem to notice that I'm passing a 'rotation' kwarg.
>
> Here's a small script that showing that this doesn't work:
> # ------------------------------------------
> import matplotlib.pyplot as pl
> from mpl_toolkits.axes_grid import AxesGrid
>
> fig = pl.figure()
> grid = AxesGrid(fig, 111, nrows_ncols=(1,1), axes_pad=0.12)
> xlabs = ['paul', 'chris', 'patti']
>
> for ax in grid:
>  ax.plot([1,2,3], [2,2.5,3], 'bo')
>  ax.set_ylim([0,5])
>  ax.set_xlim([0,4])
>  ax.set_xticks([1,2,3])
>  ax.set_xticklabels(xlabs, rotation=90)
> # -----------------------------------------
>
> As you can see from the attached image, my labels aren't rotating. This is obviously a trivial example, but I'm trying to plot some chemical concentrations and the names are quite long.
>
> Any tips? Should I just be using subpolot instead?
>
> Python 2.6.2 and:
> In [25]: import matplotlib as mpl
> In [26]: mpl.__version__
> Out[26]: '0.99.1'
> In [27]: import numpy as np
> In [28]: np.__version__
> Out[28]: '1.3.0'
>
> Thanks!
>
> Paul M. Hobson
> Senior Staff Engineer
> --
> Geosyntec Consultants
> 55 SW Yamhill St, Ste 200
> Portland, OR 97204
> Phone: (503) 222-9518
> www.geosyntec.com
>
>
>
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing.
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Chuck Pepe-R. <cp...@mi...> - 2009年12月04日 20:07:36
I am trying to plot a line area graph similar to a stacked bar chart.
E.g
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
ind = np.arange(3)
y1 = np.array([1,2,3])
y2 = y1 * 2
a = ax.fill_between(ind, y1, np.zeros(len(ind)), facecolor='r')
b = ax.fill_between(ind, y2, y1, facecolor='b')
plt.show()
However, when I try to make my legend,
ax.legend((a,b),('a','b'))
I get an AttributeError. How do I extract the information I need from the
PolyCollection object to make a legend?
Thanks,
- Chuck
From: Ryan N. <rya...@gm...> - 2009年12月04日 19:50:01
Than you for your assistance with AxesGrid.
Concerning the documentation, on this page:
http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/users/overview.htmit
says:
 Name Default Description aspect True aspect of axes
then a few lines below:
"*aspect*By default (False), widths and heigths of axes in the grid are
scaled independently. If True, they are scaled according to their data
limits (similar to aspect parameter in mpl)."
*Here is a more complete example of my code:
*In the following code, x_grid and y_grid are are arrays created by meshgrid
and represent time and water depth respectively.
z_dim is a dictionary of one or more arrays of sensor readings corresponding
to the depths and times in x_grid and y_grid.
from matplotlib import pyplot
from mpl_toolkits.axes_grid import AxesGrid
nrows = len(z_dim) # Number of rows
DAP_figure = pyplot.figure(1,(20,8))
pyplot.figtext(0.05,.5,"Depth
(m)",rotation='vertical',verticalalignment='center')
# Create a grid of axes with the AxesGrid helper class
my_grid = AxesGrid(DAP_figure, 111, # Only one grid in this figure
 nrows_ncols = (nrows,1), # one or more rows, but only one
column
 axes_pad = 0.0, #pad between axes in inches
 aspect=False, # If True, all plots are superimposed upon one
another.
 add_all=True, # not sure why this would ever be False
 share_all=True, # I think this means that all axes have the
same x & y scales
 label_mode = "L", # labels for depth on left and time on
bottom
 cbar_location="right",
 cbar_mode="each", # each axes has a different scale
 cbar_size="2%",
 cbar_pad="1%",
 )
for i,parameter in enumerate(z_dim):
 z_dim[parameter] = maskDAP(z_dim[parameter],parameter,dev_mult) #Need to
mask NaNs and outliers for each grid
 ax = my_grid[i].pcolor(x_grid,y_grid,z_dim[parameter])
 my_grid[i].set_ylabel(long_name[parameter]) # Puts a y label on every
graph.
 my_grid.cbar_axes[i].colorbar(ax)
 my_grid.cbar_axes[i].axis["right"].toggle(ticklabels=True,label=True)
 my_grid.cbar_axes[i].set_ylabel(units[parameter]) #Puts the units on the
right side of the colorbar
pyplot.draw()
pyplot.show()
I do need a separate colorbar for each plot as they are results of different
sensors all taken at the same time and depth scales.
Here is what I have now:
[image: wutSM.png]
Which, aside from the extra scale labels on the x and y axis is getting
close.
Thank You for your help,
-Ryan
*matplotlib version:*
On Thu, Dec 3, 2009 at 4:36 PM, Jae-Joon Lee <lee...@gm...> wrote:
>
>
> On Thu, Dec 3, 2009 at 3:40 PM, Ryan Neve <rya...@gm...> wrote:
>
>>
>> I tried all sorts of things, but finally, by setting aspect=False I got
>> it to work. In the documentation, the table says this defaults to True and
>> the explanation of aspect below says it defaults to False. Although I don't
>> entirely understand what is going on, I think this threw me off.
>> So then I had this:
>>
>
> Can you be more specific about which documentation says the default aspect
> is False? This may need to be fixed. Note that AxesGrid is designed
> for displaying images with aspect=True. Otherwise, you may better stick to
> the subplot..
>
>
>
>
>> [image: 84Kna.png]
>> ... which looks much better, except that there are two sets of x and y
>> axis labels? This seems to have something to do with the colorbar. I've got:
>>
>>
> To me, there is another axes underneath the AxesGrid. It is hard to tell
> without a complete code.
>
>
>
>> label_mode = "L",
>> cbar_location="right",
>> cbar_mode="each",
>> cbar_size="2%",
>> cbar_pad="0.5%"
>>
>> Now I'm trying to get scales and labels on my colorbars.
>> I tried:
>> for i,parameter in enumerate(z_dim):
>> ax = my_grid[i].pcolor(x_grid,y_grid,z_dim[parameter]) # This is the
>> pcolor plot
>> my_grid[i].set_ylabel('Depth') # Correctly puts a y label on every
>> plot.
>> cb = my_grid.cbar_axes[i].colorbar(ax) # Puts in a colorbar for this
>> axes?s
>> cb.set_ylabel(parameter) #It would be nice if this was on the far
>> right next to the colorbar. I don't see it anywhere. Perhaps underneath
>> something?
>
>
> The label of the colorbar is set to invisible by default (this is a bug).
> So, try something like
>
> my_grid.cbar_axes[i].set_ylabel(parameter)
> my_grid.cbar_axes[i].axis["right"].toggle(ticklabels=True,
> label=True)
>
>
>
>
>>
>> [image: DPkWz.png]
>> It looks like perhaps the colorbar axes is inside the ax axes rather than
>> besides it?
>> In the demo_grid_with_each_cbar<http://matplotlib.sourceforge.net/examples/axes_grid/demo_axes_grid.html>example, how would you put a scale and label on the colorbar like in this
>> plot:?
>> [image: 58dFK.png]
>> I can put a y_label on each contour plot, but since they all have depth,
>> I'd like to label this only once.
>> Is there a way to label the entire AxesGrid (or is that subplot?)?
>>
>>
> Does label_mode="1" do what you want?
> You may manually make some of the labels invisible.
>
> Please post a "complete", but simple, script that reproduces your problem.
> Otherwise, it is hard to track down what is wrong.
> Also, please report what version of matplotlib you're using. The axes_grid
> toolkit is relatively new and some of the feature may not work in older
> versions.
>
> Regards,
>
> -JJ
>
>
>
>> Thank you very much for your help,
>>
>> -Ryan
>>
>>
>>
>> On Wed, Dec 2, 2009 at 10:21 PM, Jae-Joon Lee <lee...@gm...>wrote:
>>
>>> This happens because, when the AxesGrid is created, gca() is set to the
>>> last axes, which is the last colobar axes.
>>>
>>> If you use axes_grid toolkit, you'd better not use pyplot command that
>>> works on axes. Instead, use axes method directly.
>>>
>>> For example, instead of "pyplot.pcolor(..)" , use "ax.pcolor(..)".
>>>
>>> Regards,
>>>
>>> -JJ
>>>
>>>
>>>
>>>
>>> On Wed, Dec 2, 2009 at 2:18 PM, Ryan Neve <rya...@gm...> wrote:
>>>
>>>> Hello,
>>>>
>>>> I'm trying to use AxesGrid but I'm running into a problem:
>>>> I can plot a single pcolor plot:
>>>> [image: 58dFK.png]
>>>> But when I try to use AxesGrid, my pcolor plot is ending up where I
>>>> expect my colorbar to be.
>>>> [image: mEbTA.png]
>>>>
>>>> I want to have up to 6 of these plots stacked vertically, sharing a
>>>> common time axis and y (depth) scale.
>>>>
>>>> I'll try to simplify my code to show what I'm doing:
>>>>
>>>> # I have arrays x_grid and y_grid for time and water depth.
>>>> # z_dim is a dictionary of arrays (one for each plot)
>>>> # In the plot above it has two arrays.
>>>> from matplotlib import pyplot
>>>> nrows = len(z_dim) # Number of rows is the number of arrays
>>>> My_figure = pyplot.figure(1,(8,8))
>>>> my_grid = AxesGrid(My_figure, 111, #Is this always 111?
>>>> nrows_ncols = (nrows,1), # Always one column
>>>> axes_pad = 0.1,
>>>> add_all=True,
>>>> share_all=True, # They all share the same time and depth
>>>> scales
>>>> label_mode = "L",
>>>> cbar_location="right",
>>>> cbar_mode="each",
>>>> cbar_size="7%",
>>>> cbar_pad="2%",
>>>> )
>>>> for row_no,parameter in enumerate(z_dim):
>>>> ax = my_grid[row_no]
>>>> ax = pyplot.pcolor(x_grid,y_grid,z_dim[parameter])
>>>> pyplot.draw()
>>>> pyplot.show()
>>>>
>>>> I eventually want to end up with something like this matlab output
>>>> (which I didn't generate):
>>>> [image: jiIaK.png]
>>>> but without the duplication of x scales.
>>>>
>>>> I'm new to pyplot and even after reading the documentation much of this
>>>> is baffling.
>>>>
>>>> -Ryan
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Join us December 9, 2009 for the Red Hat Virtual Experience,
>>>> a free event focused on virtualization and cloud computing.
>>>> Attend in-depth sessions from your desk. Your couch. Anywhere.
>>>> http://p.sf.net/sfu/redhat-sfdev2dev
>>>> _______________________________________________
>>>> Matplotlib-users mailing list
>>>> Mat...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>
>>>>
>>>
>>
>
From: redrum <jva...@ho...> - 2009年12月04日 18:57:52
Hi all,
I'd like to delete x and y labelling in the navigation toolbar.
See picture: http://img256.imageshack.us/img256/1608/capturepc.th.png
http://old.nabble.com/file/p26636375/Capture.png 
How can I do this ?
Thanks for your answer
-- 
View this message in context: http://old.nabble.com/Matplotlib---navigation-toolbar---delete-x-and-y-labelling-tp26636375p26636375.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: <PH...@Ge...> - 2009年12月04日 17:57:25
Attachments: rotate_test.png
Hey folks,
I'm trying to make some bar plots using AxesGrid and the set_xlabels method doesn't seem to notice that I'm passing a 'rotation' kwarg.
Here's a small script that showing that this doesn't work:
# ------------------------------------------
import matplotlib.pyplot as pl
from mpl_toolkits.axes_grid import AxesGrid
fig = pl.figure()
grid = AxesGrid(fig, 111, nrows_ncols=(1,1), axes_pad=0.12)
xlabs = ['paul', 'chris', 'patti']
for ax in grid:
 ax.plot([1,2,3], [2,2.5,3], 'bo')
 ax.set_ylim([0,5])
 ax.set_xlim([0,4])
 ax.set_xticks([1,2,3])
 ax.set_xticklabels(xlabs, rotation=90)
# -----------------------------------------
As you can see from the attached image, my labels aren't rotating. This is obviously a trivial example, but I'm trying to plot some chemical concentrations and the names are quite long.
Any tips? Should I just be using subpolot instead?
Python 2.6.2 and:
In [25]: import matplotlib as mpl
In [26]: mpl.__version__
Out[26]: '0.99.1'
In [27]: import numpy as np
In [28]: np.__version__
Out[28]: '1.3.0'
Thanks!
Paul M. Hobson 
Senior Staff Engineer
-- 
Geosyntec Consultants 
55 SW Yamhill St, Ste 200
Portland, OR 97204
Phone: (503) 222-9518
www.geosyntec.com
From: Lisa M W. <Lis...@Co...> - 2009年12月04日 16:20:34
Hello.
I installed matplotlib from source in Mac OS 10.6. However, I am 
unable to print this simple example plot:
from pylab import *
plot([1,2,3])
show()
Here is what I get when I try using TkAgg as the backend:
casa98-125-dhcp:.matplotlib lisa$ python simple_plot.py --verbose- 
helpful
$HOME=/Users/lisa
matplotlib data path /Users/lisa/.local/lib/python2.6/site-packages/ 
matplotlib/mpl-data
loaded rc file /Users/lisa/.matplotlib/matplotlibrc
matplotlib version 0.99.1.1
verbose.level helpful
interactive is True
units is False
platform is darwin
CONFIGDIR=/Users/lisa/.matplotlib
Using fontManager instance from /Users/lisa/.matplotlib/fontList.cache
backend TkAgg version 8.5
Traceback (most recent call last):
 File "simple_plot.py", line 2, in <module>
 plot([1,2,3])
 File "/Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
pyplot.py", line 2134, in plot
 ax = gca()
 File "/Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
pyplot.py", line 582, in gca
 ax = gcf().gca(**kwargs)
 File "/Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
pyplot.py", line 276, in gcf
 return figure()
 File "/Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
pyplot.py", line 254, in figure
 **kwargs)
 File "/Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
backends/backend_tkagg.py", line 91, in new_figure_manager
 canvas = FigureCanvasTkAgg(figure, master=window)
 File "/Users/lisa/.local/lib/python2.6/site-packages/matplotlib/ 
backends/backend_tkagg.py", line 158, in __init__
 master=self._tkcanvas, width=w, height=h)
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/lib-tk/Tkinter.py", line 3284, in __init__
 Image.__init__(self, 'photo', name, cnf, master, **kw)
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/lib-tk/Tkinter.py", line 3240, in __init__
 self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: integer value too large to represent
I've tried the MacOSX backend and that opens a GUI that has the label 
Figure 1 but no plot. Saving to a post script file does not work 
either. Does anyone know what the problem is?
Lisa
From: Alan G I. <ala...@gm...> - 2009年12月04日 14:07:39
Another possibility is pyReport:
http://gael-varoquaux.info/computers/pyreport/
Alan Isaac
From: Sebastian R. <seb...@go...> - 2009年12月04日 14:02:09
Hi guys,
i wrote a little program to display filter sets used for microscopy. The
spectra data are shown using matplotlib and wxmpl. The GUI hat a menu item
"Set Lines" --> an extra Frame with checkboxes will open up.
Upon checking or unchecking, the laser lines should be displayed or deleted
inside the main panel as vertical lines, but I juts can not figure out, how
to acess the meain panel when checking.
The problem is located in line 58, 63 and 68
Here is the code:
#!/usr/bin/env python
import numpy
from pylab import *
import scipy
import scipy.linalg
import wx
import wxmpl
import os, sys
xmin = 350
xmax = 700
ymin = 0
ymax = 1.05
# normalizes dye spectra to 1
def normspec(datain):
 out = datain
 out[:,1] = datain[:,1]/datain[:,1].max(0)
 return out
# converts filters spectra to 0-1 range
def normspec_filter(datain):
 out = datain
 if datain[:,1].max(0)>10:
 out[:,1] = datain[:,1]/100
 return out
class MyApp(wx.App):
 def OnInit(self):
 self.frame = MyFrame(None, -1, 'FilterSpectra')
 self.frame.Show(True)
 return True
class SetLaser(wx.Frame):
 def __init__(self, parent, id, title):
 wx.Frame.__init__(self, parent, id, title, size=(220, 130))
 wl = array([405, 445, 473])
 panel = wx.Panel(self, -1)
 self.cb0 = wx.CheckBox(panel, 10, str(wl[0])+'nm', (10, 10))
 self.cb1 = wx.CheckBox(panel, 11, str(wl[1])+'nm', (80, 10))
 self.cb2 = wx.CheckBox(panel, 12, str(wl[2])+'nm', (150, 10))
 self.Bind(wx.EVT_CHECKBOX, self.on_checkbox0, id=10)
 self.Bind(wx.EVT_CHECKBOX, self.on_checkbox1, id=11)
 self.Bind(wx.EVT_CHECKBOX, self.on_checkbox2, id=12)
 self.CenterOnParent()
 self.Show()
 def on_checkbox0(self, event):
 self.cb0value = event.IsChecked()
 print self.cb0value
 self.glaser0, = self.axes.plot([wl[i],wl[i]],[0,1],'b', lw=2)
 def on_checkbox1(self, event):
 self.cb1value = event.IsChecked()
 print self.cb1value
 self.glaser1, = self.axes.plot([wl[i],wl[i]],[0,1],'b', lw=2)
 def on_checkbox2(self, event):
 self.cb2value = event.IsChecked()
 print self.cb2value
 self.glaser2, = self.axes.plot([wl[i],wl[i]],[0,1],'b', lw=2)
class MyFrame(wx.Frame):
 def __init__(self, parent, id, title):
 wx.Frame.__init__(self, parent, id, title, size=(1000, 800))
 menuBar = wx.MenuBar()
 self.CreateStatusBar()
 #--------------------------------------------------------------
 file = wx.Menu()
 file.Append(100, 'Save As ...', 'Saves Figure as ...')
 file.AppendSeparator()
 file.Append(113, '&Quit\tCtrl+W')
 #--------------------------------------------------------------
 dyes = wx.Menu()
 dyes.Append(101, '&Load Dye Absorption', 'Loads Absorption Spectra
(*.abs)')
 dyes.Append(102, '&Load Dye Fluorescence', 'Loads Fluorescence
Emission Spectra (*.flu)')
 dyes.AppendSeparator()
 dyes.Append(111, '&Delete last Absorption', 'Deletes last Absorption
Spectra')
 dyes.Append(112, '&Delete last Fluorescence', 'Deletes last
Fluorescence Emission')
 #--------------------------------------------------------------
 filter = wx.Menu()
 filter.Append(103, '&Load Excitation Filter', 'Loads Excitation
Filter (*.ex)')
 filter.Append(104, '&Load Dichroic Mirror', 'Loads Dichroic Mirror
(*.di)')
 filter.Append(105, '&Load Emission Filter', 'Loads Emission Filter
(*.em)')
 filter.AppendSeparator()
 filter.Append(107, '&Delete last EX filter', 'Deletes the last EX
filter')
 filter.Append(108, '&Delete last DI mirror', 'Deletes the last DI
mirror')
 filter.Append(109, '&Delete last EM filter', 'Deletes the last EM
filter')
 #--------------------------------------------------------------
 lightsource = wx.Menu()
 lightsource.Append(106, '&Load Light Source', 'Loads Spectral Data
of Light Source (*.txt)')
 lightsource.AppendSeparator()
 lightsource.Append(110, '&Delete last Light Source', 'Deletes the
last Light Source')
 #--------------------------------------------------------------
 laserline = wx.Menu()
 laserline.Append(114, '&Set Laser Lines',' Displays the selected
laser lines')
 #--------------------------------------------------------------
 menuBar.Append(file, '&File')
 menuBar.Append(dyes, '&Dyes')
 menuBar.Append(filter, '&Filter')
 menuBar.Append(lightsource, '&Light Source')
 menuBar.Append(laserline, '&Laser Lines')
 #--------------------------------------------------------------
 self.SetMenuBar(menuBar)
 #--------------------------------------------------------------
 self.Bind(wx.EVT_MENU, self.saveas, id = 100)
 self.Bind(wx.EVT_MENU, self.openabs, id = 101)
 self.Bind(wx.EVT_MENU, self.openflu, id = 102)
 self.Bind(wx.EVT_MENU, self.openex, id = 103)
 self.Bind(wx.EVT_MENU, self.opendi, id = 104)
 self.Bind(wx.EVT_MENU, self.openem, id = 105)
 self.Bind(wx.EVT_MENU, self.openls, id = 106)
 self.Bind(wx.EVT_MENU, self.delex, id = 107)
 self.Bind(wx.EVT_MENU, self.deldi, id = 108)
 self.Bind(wx.EVT_MENU, self.delem, id = 109)
 self.Bind(wx.EVT_MENU, self.dells, id = 110)
 self.Bind(wx.EVT_MENU, self.delabs, id = 111)
 self.Bind(wx.EVT_MENU, self.delflu, id = 112)
 self.Bind(wx.EVT_MENU, self.OnQuit, id = 113)
 self.Bind(wx.EVT_MENU, self.laserlines, id = 114)
 self.plotPanel = wxmpl.PlotPanel(self, -1,)
 fig = self.plotPanel.get_figure()
 self.axes = fig.gca()
 self.axes.set_xticks(arange(xmin - 100, xmax + 100, 25))
 self.axes.set_yticks(arange(ymin - 100, ymax + 100, 0.1));
 self.axes.axis([xmin,xmax,ymin,ymax])
 self.axes.grid(True)
 self.axes.set_xlabel('Wavelength [nm]',fontsize=16)
 self.axes.set_ylabel('Transmission [%] or Intensity
[a.u.]',fontsize=16)
 def openex(self, event):
 dlg = wx.FileDialog(self, "Choose a Excitation Filter", os.getcwd(),
"", "*.ex*", wx.OPEN)
 if dlg.ShowModal() == wx.ID_OK:
 pathex = dlg.GetPath()
 mypathex = os.path.basename(pathex)
 self.SetStatusText("Selected EX: %s" % mypathex)
 ex = numpy.loadtxt(pathex)
 ex = normspec_filter(ex)
 self.gex, = self.axes.plot(ex[:,0],ex[:,1],'b', lw=2,label =
mypathex)
 #self.axes.plot(ex[:,0],ex[:,1],'b', lw=2,label = mypathex)
 self.axes.axis([xmin,xmax,ymin,ymax])
 self.axes.legend(loc=4)
 self.plotPanel.draw()
 dlg.Destroy()
#...
# --> here is some more code ...
#...
class MyApp(wx.App):
 def OnInit(self):
 myframe = MyFrame(None, -1, "FilterSpectra")
 myframe.CenterOnScreen()
 myframe.Show(True)
 return True
app = MyApp(0)
app.MainLoop()
-- 
Dr. Sebastian Rhode
Grünwalder Str. 103a
81547 München
Tel: +49 89 4703091
seb...@go...
From: John H. <jd...@gm...> - 2009年12月04日 13:56:02
On Fri, Dec 4, 2009 at 1:17 AM, David Arnold <dwa...@su...> wrote:
> All.
>
> I see the Sphinx tutorial Sampledoc on the Matplotlib site and am
> working through the tutorial. This semester, my students have really
> enjoyed using Matlab's publish to HTML tool, then they upload the
> resulting files to their Drop Box on our Sakai course management system.
>
> I am wondering if Sampledoc type files can be used for this same
> purpose. Is there a way you can gather the output html and upload them
> to our Sakai drop boxes?
I'm not familiar with the Sakai drop interface, but you can certainly
upload the files generated by Sphinx in _build/html to a web site.
There are normally a bunch of files that need to be uploaded, so it
would help if Sakai supports some kind of directory or zipfile upload.
JDH
From: Alan G I. <ala...@gm...> - 2009年12月04日 13:45:46
On 12/4/2009 2:17 AM, David Arnold wrote:
> I am wondering if Sampledoc type files can be used for this same
> purpose. Is there a way you can gather the output html and upload them
> to our Sakai drop boxes?
> 
Is the following at all related to what you want to do?
Using reStructuredText, you can use the `include` directive
to include code files, and the `figure` directive to include
figures. The code is actually in the file produced with the
rst2html script; the figures remain in separate files.
Alan Isaac
From: avee <av...@bl...> - 2009年12月04日 11:37:34
Dear users,
I have been working on a scope based on matplotlib to monitor acquisition
data. In order to enhance frame per seconds, I have used matplotlib's blit
capabilities and works ok. No flickering, nice and smooth. Here's how it's
done, take note that bbox is taken from the figure and not the axes object
in order to make the scale animated. The problem I have, is that the figure
is all white because of this.. just a question of esthetics :-) If bbox is
taken from the axis, the scale will never be drawn. Any suggestion?
# Set all the animated object to animated
self.ax.get_xaxis().set_animated(True)
line = Line2D(tdata,ydata,animated=True)
# Then a copy of the display
background = self.canvas.copy_from_bbox(self.fig.bbox)
# then loop over the acquisition and update
self.ax.set_xlim(tdata[-1] - self.maxt,tdata[-1]) # update axis
self.line.set_data(tdata,ydata) # update line data
self.canvas.restore_region(background) # restore background
self.ax.draw_artist(self.line[0]) # redraw line
self.ax.draw_artist(self.ax.get_xaxis()) # redraw axis
	
self.canvas.blit(self.fig.bbox) # blit
http://old.nabble.com/file/p26635860/acquisition.png 
-- 
View this message in context: http://old.nabble.com/animated-axis-tp26635860p26635860.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Wayne W. <sie...@sb...> - 2009年12月04日 09:58:47
Hi, actually, more question was more informational than how to do it. I
wrote a function to do it, but wondered why such a function didn't seem
to exist. In my case, the histogram is from a small processor that
produces frequency data from 307K points. Unraveling the frequency data
and returning it to original set of points seems counterproductive. The
data is produced from the pixel values in a 640x480 image.
Matthias Michler wrote:
> Hi Wayne,
>
> you are right all these function use the sample-data and not the pdf / 
> frequency of occurence-histogram, because typically the data is available and 
> not the pdf. Maybe the scipy mailing list could give you a solution to your 
> problem.
>
> In case that your freqency of occurence are integers you could do something 
> like the following to generate the sample-data and than you the previous 
> mentioned functions:
> bin_centers = np.array([ 1., 2., 3., 4., 5.])
> n_vals = np.array([1, 3, 0, 2, 1])
> sample_new = np.array([])
> for bin_center, n in zip(bin_centers, n_vals): 
> # append new value 'n' times: 
> sample_new = np.concatenate((sample_new, [bin_center]*n))
>
> Kind regards,
> Matthias
>
> On Tuesday 01 December 2009 17:51:31 Wayne Watson wrote:
> 
>> I do not believe that any of those calculations are based on the pdf,
>> frequency of occurrence-histogram. This, (1, 2,2, 4, 2,5,4) and not this
>> (1,3, 0,2,1). The latter are the frequencies of occurrence for 1,2,3,4,5.
>>
>> John Hunter wrote:
>> 
>>> On Tue, Dec 1, 2009 at 6:32 AM, Wayne Watson
>>>
>>> <sie...@sb...> wrote:
>>> 
>>>> Is there some statistics function that computes the mean, std. dev.,
>>>> min/max, etc. from a frequency distribution?
>>>> 
>>> numpy has many functions for basic descriptive statistics. If "data"
>>> is an array of your data, you can do (import numpy as np)
>>>
>>> mean: np.mean(data)
>>> median: np.median(data)
>>> standard deviation: np.std(data)
>>> min: np.min(data)
>>> max: np.max(data)
>>>
>>> In scipy.stats, there are many more (skew, kurtosis, etc...) See
>>> also, this example:
>>>
>>>
>>> http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/py4science/
>>> examples/stats_descriptives.py?view=markup&pathrev=4027
>>>
>>> JDH
>>> 
>
>
>
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing. 
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> 
-- 
 Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
 Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
 The popular press and many authorities believe the number
 of pedofiles that prowl the web is 50,00. There are no
 figures that support this. The number of children below
 18 years of age kidnapped by strangers is 1 in 600,000,
 or 115 per year. -- The Science of Fear by D. Gardner
 Web Page: <www.speckledwithstars.net/>
From: David A. <dwa...@su...> - 2009年12月04日 07:17:45
All.
I see the Sphinx tutorial Sampledoc on the Matplotlib site and am 
working through the tutorial. This semester, my students have really 
enjoyed using Matlab's publish to HTML tool, then they upload the 
resulting files to their Drop Box on our Sakai course management system.
I am wondering if Sampledoc type files can be used for this same 
purpose. Is there a way you can gather the output html and upload them 
to our Sakai drop boxes?
David Arnold
College of the Redwoods

Showing 15 results of 15

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