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
(4) |
2
(8) |
3
(3) |
4
(4) |
5
|
|
6
|
7
(3) |
8
(8) |
9
(6) |
10
(8) |
11
(5) |
12
(2) |
|
13
(4) |
14
(2) |
15
(12) |
16
(11) |
17
(3) |
18
|
19
(1) |
|
20
|
21
(2) |
22
(13) |
23
(4) |
24
(6) |
25
|
26
(2) |
|
27
|
28
(2) |
29
(8) |
30
(2) |
|
|
|
|
From: John H. <jdh...@ac...> - 2004-06-22 15:27:55
|
>>>>> "Thomas" == Thomas Barket <tho...@ya...> writes:
Thomas> Hello, When I run the following script, the ganged
Thomas> candlestick plots appear as expected. However, there is a
Thomas> second plot behind but sticking out (with different x and
Thomas> y axes) that shouldn't be there. Am I not doing this
Thomas> correctly? I can't see where in the code below I am
Thomas> mistakenly creating two plots that overlap, or is there a
Thomas> bug with ganged candlesticks?
Hi Thomas,
Delete the line that reads
sub = subplot(1, 1, 1)
you are creating a subplot that you never use. subplot and axes are
both Axes creations commands. Since you manually create your axes
with axes, you don't need the subplot.
There is a problem with ganged plots in that the ytick labels tend to
overlap at the borders. You can fix this using a custom tick
formatter - I can help you with this if you need.
JDH
|
|
From: Thomas B. <tho...@ya...> - 2004-06-22 14:49:28
|
Hello,
When I run the following script, the ganged candlestick plots appear as
expected. However, there is a second plot behind but sticking out (with
different x and y axes) that shouldn't be there. Am I not doing this
correctly? I can't see where in the code below I am mistakenly creating two
plots that overlap, or is there a bug with ganged candlesticks?
Tks vm,
Tom
-----------------------------------------------------------
from matplotlib.matlab import *
from matplotlib.dates import MONDAY
from matplotlib.finance import candlestick
from matplotlib.ticker import WeekdayLocator, DayLocator, DateFormatter
series1 = []
series1.append((1041379200, 100.0, 100.5, 99.0, 102.0))
series1.append((1041465600, 101.0, 101.5, 98.0, 103.0))
series1.append((1041552000, 103.0, 104.0, 103.0, 106.0))
series1.append((1041638400, 105.0, 102.5, 102.0, 108.0))
series2 = []
series2.append((1041379200, 1000.0, 1000.5, 999.0, 1002.0))
series2.append((1041465600, 1001.0, 1001.5, 998.0, 1003.0))
series2.append((1041552000, 1003.0, 1004.0, 1003.0, 1006.0))
series2.append((1041638400, 1005.0, 1002.5, 1002.0, 1008.0))
series3 = []
series3.append((1041379200, 10000.0, 10000.5, 9999.0, 10002.0))
series3.append((1041465600, 10001.0, 10001.5, 9998.0, 10003.0))
series3.append((1041552000, 10003.0, 10004.0, 10003.0, 10006.0))
series3.append((1041638400, 10005.0, 10002.5, 10002.0, 10008.0))
sub = subplot(1, 1, 1)
ax1 = axes([0.1, 0.1, 0.8, 0.25]) # lower
ax2 = axes([0.1, 0.35, 0.8, 0.25]) # middle
ax2.set_xticklabels([])
ax3 = axes([0.1, 0.6, 0.8, 0.25]) # upper
ax3.set_xticklabels([])
candlestick(ax1, series1, width=0.6)
candlestick(ax2, series2, width=0.6)
candlestick(ax3, series3, width=0.6)
mondays = WeekdayLocator(MONDAY)
days = DayLocator()
fmt = DateFormatter('%b %d')
ax1.xaxis.set_major_locator(mondays)
ax1.xaxis.set_major_formatter(fmt)
ax1.xaxis.set_minor_locator(days)
ax1.autoscale_view()
show()
|
|
From: John H. <jdh...@ac...> - 2004-06-22 13:10:15
|
>>>>> "Stephen" == Stephen Roderick <snr...@ya...> writes:
Stephen> I'm using matplotlib 0.54.2 (failed in 0.53.1 also) on
Stephen> Mac OS X with Python 2.3 and wxPython 2.5.1.5, and get
Stephen> the following traceback from this code. Looking at the
Stephen> backend_wx.py, I can find no other mention of
Stephen> "FigureBase" anywhere else. What should this line
Stephen> actually be? (I tried a few thoughts, but none worked)
Stephen> I'm basically trying to create a class that encapsulates
Stephen> a multi-value temperature bar graph, using the Observer
Stephen> pattern, and have inherited from the FigureCanvasWx
Stephen> class. If this is incorrect, I'm all ears to alternative
Stephen> suggestions.
Try replacing line 888 in backend_wx with
FigureCanvasBase.add_axis(self, a)
Sorry for the trouble....
|
|
From: John H. <jdh...@ac...> - 2004-06-22 13:07:44
|
>>>>> "MWallis" == MWallis <mw...@sw...> writes:
MWallis> I am having some problems using the specgram function
MWallis> with gtk and was wondering if anyone had an example they
MWallis> were willing to share.
See http://matplotlib.sf.net/examples for the current examples.
Normally, you can always get the examples directory in the src
distribution (*.tar.gz or *.zip) but on the last release I failed to
upload a zip file.
The example you are looking for is called specgram_demo.py.
http://matplotlib.sf.net/examples/specgram_demo.py
Hope this helps,
JDH
|
|
From: John H. <jdh...@ac...> - 2004-06-22 13:03:50
|
from matplotlib.matlab import *
m = array([0.1, 0.2, 0.3, 0.6, 0.8, 1, 3])
r = array([18, 180, 1800, 1.8, 0.18, 250, 2.8])
plot(m, r)
set(gca(), "yscale", "log")
show()
This is a known issue I've been meaning to work on. Here's what is
happening. On the plot command the tick locator is autoranging the
axes and ymin becomes 0. Since the log transformation applies to the
tick locations as well as the data, it is log transforming the tick
location of zero. To fix this, I need to check the axes range when
the call to set yscale is made and fix it. In the meantime, you can
explicity set the ylim after the call to plot and before the call to
yscale.
from matplotlib.matlab import *
m = array([0.1, 0.2, 0.3, 0.6, 0.8, 1, 3])
r = array([18, 180, 1800, 1.8, 0.18, 250, 2.8])
plot(m, r)
set(gca(), 'ylim', (0.1, 2000))
set(gca(), "yscale", "log")
show()
JDH
|
|
From: John H. <jdh...@ac...> - 2004-06-22 12:57:55
|
>>>>> "Thomas" == Thomas Barket <tho...@ya...> writes:
Thomas> C:\Matplotlib\matplotlib src\examples>python stock_demo.py
Thomas> Traceback (most recent call last): File "stock_demo.py",
Thomas> line 4, in ? from matplotlib.matlab import * File
Thomas> "C:\Python23\lib\site-packages\matplotlib\matlab.py", line
Thomas> 134, in ? from axes import Axes File
Thomas> "C:\Python23\lib\site-packages\matplotlib\axes.py", line
Thomas> 9, in ? from artist import Artist File
Thomas> "C:\Python23\lib\site-packages\matplotlib\artist.py", line
Thomas> 4, in ? from transforms import identity_transform File
Thomas> "C:\Python23\lib\site-packages\matplotlib\transforms.py",
Thomas> line 181, in ? from _transforms import IDENTITY, LOG10,
Thomas> Func, FuncXY, PolarXY ImportError: cannot import name
Thomas> IDENTITY
Thomas> C:\Matplotlib\matplotlib src\examples>
Something is wrong with your installation. My transforms.py line 181
is something different. _transforms should be providing IDENTITY.
Thomas> Is version 0.54.2 not the correct starting point for doing
Thomas> this unzip? If solving this is a hassle, I don't mind
Thomas> going back to the old 0.54.2 and waiting for the bug fixes
Thomas> that come with the next proper release.
We're planning on doing a release in the near future, so if you can
wait for the new installer, that would be easiest.
JDH
|
|
From: Stephen R. <snr...@ya...> - 2004-06-22 12:34:57
|
I'm using matplotlib 0.54.2 (failed in 0.53.1 also) on Mac OS X with
Python 2.3 and wxPython 2.5.1.5, and get the following traceback from
this code. Looking at the backend_wx.py, I can find no other mention of
"FigureBase" anywhere else. What should this line actually be? (I tried
a few thoughts, but none worked)
I'm basically trying to create a class that encapsulates a multi-value
temperature bar graph, using the Observer pattern, and have inherited
from the FigureCanvasWx class. If this is incorrect, I'm all ears to
alternative suggestions.
TIA
Code:
class ociTemperatureGraph(FigureCanvasWx, Observer):
def __init__(self, parent):
wxPanel.__init__(self, parent, -1)
self.fig = Figure((3,3), 75)
self.subplot = Subplot(self.fig, 111)
<snip>
self.add_axis(self.subplot) <<-- blows up here
Traceback (most recent call last):
File "./ociTemperatureGraph.py", line 86, in ?
main()
File "./ociTemperatureGraph.py", line 74, in main
frame = PlotFigure()
File "./ociTemperatureGraph.py", line 60, in __init__
self.fig = ociTemperatureGraph(self)
File "./ociTemperatureGraph.py", line 42, in __init__
self.add_axis(self.subplot)
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/site-packages/matplotlib/backends/backend_wx.py", line 888,
in add_axis
FigureBase.add_axis(self, a)
NameError: global name 'FigureBase' is not defined
|
|
From: Gary R. <ga...@em...> - 2004-06-22 09:27:31
|
As a followup to my reply to this (the suggestion found by searching the list archives and due to John Hunter), I tried an example errorbar plot and got a traceback. I think this is highlighting a bug as demonstrated by the following example. It's not an errorbar plot, but errorbar generates a traceback too. Danny, if you get a traceback, it'd be worth letting the list know:
from matplotlib.matlab import *
m = array([0.1, 0.2, 0.3, 0.6, 0.8, 1, 3])
r = array([18, 180, 1800, 1.8, 0.18, 250, 2.8])
semilogy(m, r)
set(gca(), "yscale", "linear")
show()
works fine
whereas
from matplotlib.matlab import *
m = array([0.1, 0.2, 0.3, 0.6, 0.8, 1, 3])
r = array([18, 180, 1800, 1.8, 0.18, 250, 2.8])
plot(m, r)
set(gca(), "yscale", "log")
show()
generates a traceback:
Traceback (most recent call last):
File "C:\APPS\PYTHON23\Lib\site-packages\matplotlib\backends\backend_gtkagg.py", line 75, in callback
self.draw()
File "C:\APPS\PYTHON23\Lib\site-packages\matplotlib\backends\backend_gtkagg.py", line 42, in draw
agg.draw()
File "C:\APPS\PYTHON23\Lib\site-packages\matplotlib\backends\backend_agg.py", line 296, in draw
self.figure.draw(self.renderer)
File "C:\APPS\PYTHON23\Lib\site-packages\matplotlib\figure.py", line 130, in draw
for a in self.axes: a.draw(renderer)
File "C:\APPS\PYTHON23\Lib\site-packages\matplotlib\axes.py", line 597, in draw
self.transData.freeze() # eval the lazy objects
ValueError: Cannot take log of nonpositive value
I think both should work.
John, is this a bug?
Gary Ruben
--
_______________________________________________
Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free!
http://www.net2phone.com/cgi-bin/link.cgi?143
|
|
From: Gary R. <ga...@em...> - 2004-06-22 07:16:54
|
Hi Danny, Have you tried adding set(gca(), "yscale", "log") after your errorbar line? I think this does what you want. Gary Ruben ----- Original Message ----- > Is there any way to do semi-log y errorbar plots? I know there is the > errorbar plot, and the semi-log plot. If I use an errorbar plot and > take the logarithm of the y data, then the y axis ticking won't look > right. Is there a way to fake this that I don't know about. > > thanks, > Danny -- _______________________________________________ Talk More, Pay Less with Net2Phone Direct(R), up to 1500 minutes free! http://www.net2phone.com/cgi-bin/link.cgi?143 |
|
From: Thomas B. <tho...@ya...> - 2004-06-22 06:52:50
|
John,
Tks vm for your reply. I was able to get the script
to run with your "examples" directory. Much
appreciated.
However, when I unzipped the py.60a.zip files over my
site-packages directory and re-ran the script, I got
the following error:
C:\Matplotlib\matplotlib src\examples>python
stock_demo.py Traceback (most recent call last):
File "stock_demo.py", line 4, in ?
from matplotlib.matlab import *
File
"C:\Python23\lib\site-packages\matplotlib\matlab.py",
line 134, in ?
from axes import Axes
File
"C:\Python23\lib\site-packages\matplotlib\axes.py",
line 9, in ?
from artist import Artist
File
"C:\Python23\lib\site-packages\matplotlib\artist.py",
line 4, in ?
from transforms import identity_transform
File
"C:\Python23\lib\site-packages\matplotlib\transforms.py",
line 181, in ?
from _transforms import IDENTITY, LOG10, Func,
FuncXY, PolarXY
ImportError: cannot import name IDENTITY
C:\Matplotlib\matplotlib src\examples>
Is version 0.54.2 not the correct starting point for
doing this unzip? If solving this is a hassle, I
dont mind going back to the old 0.54.2 and waiting
for the bug fixes that come with the next proper
release.
Tks again,
Tom
-----Original Message-----
From: John Hunter
[mailto:jdh...@ac...]
Sent: Monday, June 21, 2004 2:26 PM
To: Thomas Barket
Cc: mat...@li...
Subject: Re: [Matplotlib-users] problem reading data
file in stock_demo.py
>>>>> "Thomas" == Thomas Barket
<tho...@ya...> writes:
Thomas> Hello, i cant get stock_demo.py to run
correctly. it
Thomas> seems there is a problem reading the data
files,
Thomas> specifically using numarray/Numeric's
"fromstring" on the
Thomas> example data files. the first result
below is with
Thomas> numarray and the second is with Numeric.
im using python
Thomas> 2.3.4 and matplotlib 0.54.2 win32 for
python 2.3.
Where are you getting the examples dir from? I notice
that I failed to upload a zip file that includes the
examples directory with the
0.54.2 release. Are you using one from a previous
release?
It looks like you make have a corrupt stock data file.
I was able to load the stock_demo example using both
the numeric and numarray win32 builds, with either
numerix setting in my rc file.
I did, however, discover a bug in the navigation code
in that example related to data clipping.
The zip file below fixes the latter problem. Unzip it
in your site-packages dir (do not remove the old
matplotlib code, just unzip this over it)
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-py.60a.zip
And get a fresh examples dir from
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-examples.60a.zip
Hope this helps,
JDH
|
|
From: Thomas B. <tho...@ya...> - 2004-06-22 06:40:06
|
John,
Tks vm for your reply. I was able to get the script to run with your
"examples" directory. Much appreciated.
However, when I unzipped the py.60a.zip files over my site-packages
directory and re-ran the script, I got the following error:
C:\Matplotlib\matplotlib src\examples>python stock_demo.py
Traceback (most recent call last):
File "stock_demo.py", line 4, in ?
from matplotlib.matlab import *
File "C:\Python23\lib\site-packages\matplotlib\matlab.py", line 134, in ?
from axes import Axes
File "C:\Python23\lib\site-packages\matplotlib\axes.py", line 9, in ?
from artist import Artist
File "C:\Python23\lib\site-packages\matplotlib\artist.py", line 4, in ?
from transforms import identity_transform
File "C:\Python23\lib\site-packages\matplotlib\transforms.py", line 181,
in ?
from _transforms import IDENTITY, LOG10, Func, FuncXY, PolarXY
ImportError: cannot import name IDENTITY
C:\Matplotlib\matplotlib src\examples>
Is version 0.54.2 not the correct starting point for doing this unzip? If
solving this is a hassle, I don't mind going back to the old 0.54.2 and
waiting for the bug fixes that come with the next proper release.
Tks again,
Tom
-----Original Message-----
From: John Hunter [mailto:jdh...@ac...]
Sent: Monday, June 21, 2004 2:26 PM
To: Thomas Barket
Cc: mat...@li...
Subject: Re: [Matplotlib-users] problem reading data file in stock_demo.py
>>>>> "Thomas" == Thomas Barket <tho...@ya...> writes:
Thomas> Hello, i cant get stock_demo.py to run correctly. it
Thomas> seems there is a problem reading the data files,
Thomas> specifically using numarray/Numeric's "fromstring" on the
Thomas> example data files. the first result below is with
Thomas> numarray and the second is with Numeric. im using python
Thomas> 2.3.4 and matplotlib 0.54.2 win32 for python 2.3.
Where are you getting the examples dir from? I notice that I failed to
upload a zip file that includes the examples directory with the
0.54.2 release. Are you using one from a previous release?
It looks like you make have a corrupt stock data file. I was able to load
the stock_demo example using both the numeric and numarray win32 builds,
with either numerix setting in my rc file.
I did, however, discover a bug in the navigation code in that example
related to data clipping.
The zip file below fixes the latter problem. Unzip it in your site-packages
dir (do not remove the old matplotlib code, just unzip this over it)
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-py.60a.zip
And get a fresh examples dir from
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-examples.60a.zip
Hope this helps,
JDH
|
|
From: danny s. <dan...@ya...> - 2004-06-21 22:38:51
|
Is there any way to do semi-log y errorbar plots? I know there is the errorbar plot, and the semi-log plot. If I use an errorbar plot and take the logarithm of the y data, then the y axis ticking won't look right. Is there a way to fake this that I don't know about. thanks, Danny __________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo |
|
From: John H. <jdh...@ac...> - 2004-06-21 18:49:42
|
>>>>> "Thomas" == Thomas Barket <tho...@ya...> writes:
Thomas> Hello, i cant get stock_demo.py to run correctly. it
Thomas> seems there is a problem reading the data files,
Thomas> specifically using numarray/Numeric's "fromstring" on the
Thomas> example data files. the first result below is with
Thomas> numarray and the second is with Numeric. im using python
Thomas> 2.3.4 and matplotlib 0.54.2 win32 for python 2.3.
Where are you getting the examples dir from? I notice that I failed
to upload a zip file that includes the examples directory with the
0.54.2 release. Are you using one from a previous release?
It looks like you make have a corrupt stock data file. I was able to
load the stock_demo example using both the numeric and numarray win32
builds, with either numerix setting in my rc file.
I did, however, discover a bug in the navigation code in that example
related to data clipping.
The zip file below fixes the latter problem. Unzip it in your
site-packages dir (do not remove the old matplotlib code, just unzip
this over it)
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-py.60a.zip
And get a fresh examples dir from
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-examples.60a.zip
Hope this helps,
JDH
|
|
From: Thomas B. <tho...@ya...> - 2004-06-19 00:17:15
|
Hello,
i cant get stock_demo.py to run correctly. it seems
there is a problem reading the data files,
specifically using numarray/Numeric's "fromstring" on
the example data files. the first result below is
with numarray and the second is with Numeric. im
using python 2.3.4 and matplotlib 0.54.2 win32 for
python 2.3.
C:\Matplotlib\matplotlib src\examples>python
stock_demo.py
Traceback (most recent call last):
File "stock_demo.py", line 7, in ?
(d1, p1, d2, p2 ) = get_two_stock_data()
File "C:\Matplotlib\matplotlib
src\examples\data_helper.py", line 12, in
get_two_stock_data
M1 = fromstring( file('data/%s.dat' % ticker1,
'rb').read(), 'd')
File
"C:\Python23\Lib\site-packages\numarray\numarraycore.py",
line 358, in fromstring
raise ValueError("Type size inconsistent with
string length")
ValueError: Type size inconsistent with string length
C:\Matplotlib\matplotlib src\examples>python
stock_demo.py
Traceback (most recent call last):
File "stock_demo.py", line 7, in ?
(d1, p1, d2, p2 ) = get_two_stock_data()
File "C:\Matplotlib\matplotlib
src\examples\data_helper.py", line 12, in
get_two_stock_data
M1 = fromstring( file('data/%s.dat' % ticker1,
'rb').read(), 'd')
ValueError: string size must be a multiple of element
size
since the example data files are binary, i cant figure
out how to investigate what may be happening with
them.
Is there something else i should be doing?
Tks vm,
Tom
|
|
From: John H. <jdh...@ac...> - 2004-06-17 14:13:33
|
>>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes:
Peter> self.nonsingular(self.dataInterval.get_bounds()) TypeError:
Peter> nonsingular() takes exactly 3 arguments (2 given)
Peter> -------------
Should be
self.nonsingular(*self.dataInterval.get_bounds())
Peter> 2) The auto-scaling in plot_date() does not scale properly
Peter> in some special cases. Consider this:
The example seems to work now with the above change and the changes
you suggested in below.
Peter> ticks.Base when int() gives zero. Also, to finalize this,
Peter> one would have to write a DayMultiLocator type class for
I added DayMultiLocator to matplotlib.ticker
Peter> the Weeks, otherwise when the number of weeks is close, but
Peter> less then the number of weeks in numticks*months it will
Peter> get crowded. This will probably be a little more involved
Peter> than dealing with days, but perhaps one could use your
Peter> existent WeekdayLocator class to simplify the problem.
A WeekMultiLocator would be useful, but it's not a priority for me.
If you come up with one, send it my way.
Peter> Also note that there was an error in defining months in
Peter> your code; I changed the line to:
Peter> months = span/(SEC_PER_DAY*31) # approx
Thanks for the fix.
Peter> Let me know what you think.
Looks good; thanks!
JDH
|
|
From: Peter G. <pgr...@ge...> - 2004-06-17 04:01:47
|
Thanks for the prompt response and the detailed explanation.
The scaling is working now, and I have not encountered those old problems. There are a couple of things I should mention however:
1) The axes.auto_scale() seems to be broken. I get a following error:
------------
Traceback (most recent call last):
File "./e3.py", line 97, in ?
ax.autoscale_view()
File "/usr/lib/python2.2/site-packages/matplotlib/axes.py", line 436, in autoscale_view
tup = locator.autoscale()
File "/usr/lib/python2.2/site-packages/matplotlib/ticker.py", line 327, in autoscale
return self.nonsingular(self.dataInterval.get_bounds())
TypeError: nonsingular() takes exactly 3 arguments (2 given)
-------------
When I run this:
--------
#!/usr/bin/env python
import time
from matplotlib.dates import EpochConverter
from matplotlib.matlab import *
from matplotlib.ticker import FuncFormatter, NullLocator, MinuteLocator, DayLocator, HourLocator, MultipleLocator, DateFormatter
wantLegend=1
time1=[1087192789.89]
data1=[-65.54]
time2=[
1087161589.89 ,
1087192289.0,
1087192389.0,
1087192489.0,
1087192589.0,
1087192689.0,
1087192789.89 ,
1087192889.0,
1087192989.0,
1087193089.0,
1087193189.0,
1087193289.0,
1087238100.0 ,
]
data2=[
-55.44
-64.54 ,
-66.54 ,
-61.54 ,
-69.54 ,
-45.66,
-55.54 ,
-77.54,
-65.54 ,
-49.54 ,
-57.54 ,
-68.54 ,
-55.54 ,
-23.44
]
ax = subplot(111)
p1Size=len(time1)
p2Size=len(time2)
p1=plot_date(time1, data1, None, '-', color='r')
p2=plot_date(time2, data2, None, '-', color='b')
p1=plot(time1, data1,'-', color='r')
p2=plot(time2, data2,'-', color='b')
now=time2[-1]
then=time2[0]
deltaSec=now-then
deltaTickSec=deltaSec/7.0
tickList=[item for item in list(arange(then, now, deltaTickSec))]
def tickString(x, pos):
return time.strftime("%H:%M:%S", time.localtime(x))
formatter = FuncFormatter(tickString)
ax.set_xticks(tickList)
ax.xaxis.set_major_formatter(formatter)
ax.xaxis.set_minor_locator(NullLocator())
#This line does not work.
ax.autoscale_view()
if wantLegend:
legend((p1, p2), ('small data set (%d)' % p1Size, 'large data set (%d)' % p2Size))
xlabel('time')
grid(True)
show()
#savefig('./blah.png')
------
Things work when I comment out the line:
ax.autoscale_view()
2) The auto-scaling in plot_date() does not scale properly in some special cases. Consider this:
-----------------
from matplotlib.matlab import *
time2= [
1087321489.89, 1087321500.0,
1087321789.89, 1087321800.0, 1087322089.89, 1087322100.0, 1087322389.89, 1087322700.0, 1087322989.89,
1087323000.0, 1087323289.89, 1087323300.0, 1087323589.89, 1087323600.0, 1087323889.89, 1087323900.0,
1087324189.89, 1087324200.0, 1087324489.89, 1087324500.0, ]
data2=[ 3.02,
3.02,
3.14,
3.14,
3.21,
3.21,
3.26,
3.26,
3.39,
3.39,
3.51,
3.51,
3.58,
3.58,
3.75,
3.75,
4.0,
4.0,
4.22,
4.22,]
plot_date(time2, data2, None, '-', color='b')
xlabel('time')
grid(True)
show()
---------------
The same thing happens over differnt ranges when the amount of ticks is large. Perhaps you may use something similar to the code below
(from axes.py) to deal with these things. Note the ceilings get rid of the AssertErrors in ticks.Base when int() gives zero. Also, to finalize this,
one would have to write a DayMultiLocator type class for the Weeks, otherwise when the number of weeks is close, but less then the number
of weeks in numticks*months it will get crowded. This will probably be a little more involved than dealing with days, but perhaps one could use
your existent WeekdayLocator class to simplify the problem.
Also note that there was an error in defining months in your code; I changed the line to:
months = span/(SEC_PER_DAY*31) # approx
-----------
def plot_date(self, d, y, converter, fmt='bo', **kwargs):
"""
plot_date(d, y, converter, fmt='bo', **kwargs)
d is a sequence of dates; converter is a dates.DateConverter
instance that converts your dates to seconds since the epoch for
plotting. y are the y values at those dates. fmt is a plot
format string. kwargs are passed on to plot. See plot for more
information.
pass converter = None if your dates are already in epoch format
"""
if not self._hold: self.cla()
if converter is not None:
e = array([converter.epoch(thisd) for thisd in d])
else:
e = d
assert(len(e))
ret = self.plot(e, y, fmt, **kwargs)
span = self.dataLim.intervalx().span()
if span==0: span = SEC_PER_MIN
minutes = span/SEC_PER_MIN
hours = span/SEC_PER_HOUR
days = span/SEC_PER_DAY
weeks = span/SEC_PER_WEEK
months = span/(SEC_PER_DAY*31) # approx years = span/(SEC_PER_WEEK*52) # approx
#These should go to the top module.
from math import ceil
from ticker import DayMultiLocator
numticks = 5
if years>numticks:
locator = YearLocator(ceil(years/numticks)) # define
fmt = '%Y'
elif months>numticks:
locator = MonthLocator(ceil(months/numticks)) # define
fmt = '%b %Y'
elif weeks>numticks:
locator = WeekdayLocator(0)
fmt = '%b %d'
#Hack - need a DayLocator which operates like HourLocator
#ie. Have a tick every so many days other than every day at a
#particular hour.
#This is a class I added to ticker.py:
## class DayMultiLocator(MultipleLocator):
## """
## Make ticks on day which are multiples of base
## """
## def __init__(self, base):
## MultipleLocator.__init__(self, base*SEC_PER_DAY)
elif days>numticks:
locator = DayMultiLocator(ceil(days/numticks))
fmt = '%b %d'
elif hours>numticks:
locator = HourLocator(ceil(hours/numticks))
fmt = '%H:%M\n%b %d'
elif minutes>numticks:
locator = MinuteLocator(ceil(minutes/numticks))
fmt = '%H:%M:%S'
else:
locator = MinuteLocator(1)
fmt = '%H:%M:%S'
formatter = DateFormatter(fmt)
self.xaxis.set_major_locator(locator)
self.xaxis.set_major_formatter(formatter)
self.autoscale_view()
return ret
Let me know what you think.
Peter
John Hunter wrote:
>>>>>> "Peter" == Peter Groszkowski <pgr...@ge...> writes:
>>>>>>
>
>
> Peter> It does?! Do you mean that this is done automatically? Can
> Peter> you show me an example of this using only the time module
> Peter> (since I use python2.2, dont have datetime)? I thought that
> Peter> I had to manually set things up and tell matplotlib whether
>
> No, it's designed to work automagically. If you take a look at
> axes.Axes.plot_date you'll see how it works. It looks at the max/min
> span of your data and chooses a locator and formatter accordingly.
> All the examples use custom locators and formatters ( I was busy
> showing off how you could customize), but you don't need to
>
> from matplotlib.matlab import *
>
> time2= [ 1087161589.89 , 1087192289.0, 1087192389.0, 1087192489.0,
> 1087192589.0, 1087192689.0, 1087192789.89 , 1087192889.0,
> 1087192989.0, 1087193089.0, 1087193189.0, 1087193289.0, 1087238100.0,
> ]
> data2=[ -55.44 -64.54 , -66.54 , -61.54 , -69.54 , -45.66, -55.54,
> -77.54, -65.54 , -49.54 , -57.54 , -68.54 , -55.54 , -23.44 ]
>
> plot_date(time2, data2, None, '-', color='b')
> xlabel('time')
> grid(True)
>
> show()
>
> In general you should try not to set the limits or ticks explicitly
> since this is the job of the autolocator. I realize you were
> encountering troubles and this is what led you to do it. Hopefully
> the discussion below will save you from having to do this.
>
> Peter> On the other note, regarding the weird scaling that I
> Peter> talked about (and showed pretty pics for) in my last mail,
> Peter> I finally put together a small script that exposes the
> Peter> problem. It is a bit rough because I ripped bits and pieces
> Peter> from here and there, but shows the issue. Use the
> Peter> 'wantBadPlot' and 'wantStandardDateTics' to see how things
> Peter> go wrong.
>
> I looked at this and figured out the root cause of the problem. Your
> "bad data" is a singleton plot
>
> time1=[1087192789.89]
> data1=[-65.54]
> p1=plot_date(time1, data1, None, '-', color='r')
>
> These are difficult to deal with - I'll explain why. The default
> linear transformation maps data limits to display limits, and needs to
> divide by the data span to do so. In this case min=max so the span is
> zero and the transformation is undefined. To handle this case, I
> detect the span=0 case and reset the data limits, lowering the min a
> bit and raising the max a bit.
> In earlier versions of maptlotlib, I did
>
> minx, maxx = min(xdata), max(xdata)
> if minx==maxx:
> minx -= 1
> maxx += 1
>
> A problem arose if a person issued multiple calls to plot, first with
> a singleton and then with a range of data, all really small
>
> >>> plot([1e-9], [10]) # x limits are now approx -1, 1 due to above
> >>> plot([1e-9,2e-9,3e-9], [10,20,30])
> after the second call the data limits are still -1,1 because the limit
> code only changes the data limits if the new lines are outside the
> range of the existing limits. In this case they are not. The effect
> is the plot is badly scaled since the data limits are wide compared to
> all the xdata.
>
> Thinking myself clever (first mistake!), I rewrote the above code as
>
> minx, maxx = min(xdata), max(xdata)
> if minx==maxx:
> minx -= 0.001*abs(minx)
> maxx += 0.001*abs(maxx)
>
> So the scaling would be proportionate to the data size. This helps in
> some cases, but is failing for you. Again, in your example code, you
> do the dreaded singleton plot followed by more plot commands
>
> p1=plot_date([1087192789.89], [-65.54], None, '-', color='r')
> p2=plot_date(times, values, None, '-', color='r')
>
> Since minx==maxx in the first plot, the xlimits become 1086105597.1,
> 1088279982.67. This is very wide compared to the subsequent range of
> data you put in in the second plot_date call. This explains the bad
> scaling you are seeing.
>
> Upon writing this, I realized that the fundamental problem is that I
> am manipulating data limits to deal with a singular range, when the
> data limits should *always* accurately reflect the true data limits
> (doh!). It's the view limits that need to be mucked with to handle
> this case. I had to make a number of changes throughout the code to
> get everybody playing nicely with this new insight, but now everything
> is working. Even your wantBadPlot example!
>
> Give it a try:
>
> http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-0.54.3a.tar.gz
>
> and let me know if it passes your tests.
>
> JDH
>
>
---- Msg sent via @Mail - http://WebBasedEmail.com/
|
|
From: Ryugan M. <ryu...@sb...> - 2004-06-16 16:26:56
|
I ran the following script on IDLE and the Boa-constructor. I had a problem
on both of these when I
didn't include:
matplot.interactive(False)
Thanks for the info on matplotlibrc.
----- Original Message -----
From: "John Hunter" <jdh...@ac...>
To: "Ryugan Mizuta" <ryu...@sb...>
Cc: <mat...@li...>; "Barry Drake"
<bl...@ad...>
Sent: Wednesday, June 16, 2004 6:56 AM
Subject: Re: [Matplotlib-users] Re:Newbie Question...
> >>>>> "Ryugan" == Ryugan Mizuta <ryu...@sb...> writes:
>
> Ryugan> Thanks for all who gave me a reply.... Somehow the
> Ryugan> following script worked...:
>
> import matplotlib
> matplotlib.interactive(False)
> matplotlib.use("WX")
>
> from matplotlib.matlab import *
> plot([1,2,3,4])
> show()
>
>
> I just want to point out that in my opinion, the easiest way to set
> the default backend is to use your matplotlibrc file -
> http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC. For windows,
> this is found at C:\Python23\share\matplotlib\.matplotlibrc.
>
> You can achieve the same effect by setting
>
> backend : WX # the default backend
> interactive : False # see
http://matplotlib.sourceforge.net/interactive.html
>
> which will not be so invasive to your script (ie, you can change the
> default behavior of your scripts w/o changing the scripts
> themselves). Using
>
> import matplotlib
> matplotlib.interactive(False)
> matplotlib.use("WX")
>
> should be something you reserve to depart from the desired default
> behavior.
>
> Glad it's working for you! I have two more questions I am curious
> about, for both you and Barry
>
> * Does WXAgg also work?
>
> * In which IDEs do you find this combination works?
>
> Following your question yesterday I added the FAQ entry
> http://matplotlib.sourceforge.net/faq.html#FREEZE, and I'd like to
> update it to make it as complete as possible.
>
> JDH
|
|
From: Barry D. <bl...@ad...> - 2004-06-16 13:23:36
|
John,
I ran the tests mentioned in a previous msg with both
WX and WXAgg.
Should also mention that the test with Idle doesn't
completely fail. That is the graph window is
displayed and the program "appears" to terminate
normally. It looks like some memory is being left
hanging and Idle, the OS, or matplotlib is trying to
write there on subsequent runs of the program (?).
Barry
--- John Hunter wrote:
> >>>>> "Barry" == Barry Drake
> writes:
>
> Barry> Ryugan, Thanks. That fixed my
problem as
> well: the graph
> Barry> window disappearing after the call
to
> show().
>
> Hi Barry,
>
> import matplotlib
> matplotlib.interactive(False)
> matplotlib.use("WX")
>
> from matplotlib.matlab import *
> plot([1,2,3,4])
> show()
>
> Which line is responsible for the fix? And are
you
> using WX or WXAgg?
>
> JDH
>
>
>
-------------------------------------------------------
> This SF.Net email is sponsored by The 2004
> JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's
> Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone
Center
> in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf
> Priority Code NWMGYKND
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: John H. <jdh...@ac...> - 2004-06-16 13:12:12
|
>>>>> "Colin" == Colin Rundel <ru...@ma...> writes:
Colin> I'm trying to 'freeze' a script of mine using py2exe and I
Colin> cant seem to get it to play nicely with matplotlib. More
Colin> specifically, my script is a wxpython frame that displays
Colin> several data plots that are created with the Agg backend
Colin> and converted to bitmaps. From my limited knowledge of
Colin> py2exe it appears that the problem arises from py2exe
Colin> trying to import several backends at once.
Hi Colin,
Sorry for the delay in getting back to you. I just started playing
with py2exe. I have an app that uses matplotlib that I would like to
freeze as well, so may as well take the plunge.
I found I could freeze a simple plot with
# setup.py
from distutils.core import setup
import glob
import py2exe
data = glob.glob(r'C:\Python23\share\matplotlib\*')
data.append(r'C:\Python23\share\matplotlib\.matplotlibrc')
setup(console=["simple_plot.py"],
data_files=[("share",data)],
)
where simple_plot.py is
from matplotlib.matlab import *
plot([1,2,3])
show()
I also got a similar warning message at the end like you about "The
following modules appear to be missing" but it appears to be harmless.
A simple_plot.exe was created in my dist dir, as were a number of dlls
and the matplotlib share data dir. I had to set the MATPLOTLIB env
var to point to the share dir, ie
set MATPLOTLIBDATA=c:\python\jdh\py2exe\simple_plot\dist\share
but then it (partly) worked. TkAgg and WXAgg worked out of the box (I
could change the default backend in the rc file). Plain vanilla WX
behaved strangely: The WX frame with navigation bars etc popped up but
no graph. I could click 'save' and save the graph to a jpeg which
viewed correctly. But no image in the wx frame. Hmm. Haven't gotten
GTK* working yet.
Are you using the latest py2exe? Notably, I didn't get the gtk dll
error when I left out the excludes.
JDH
|
|
From: Barry D. <bl...@ad...> - 2004-06-16 13:07:55
|
John,
I tested with DrPython 2.4.2, PyPe 1.9, PythonWin,
Idle, SciTE 1.6, and, my usual dev environment,
UltraEdit 10.20b.
Only SciTE hasn't worked so far; it exits with the
error:
Fatal Python error: PyEval_RestoreThread: NULL tstate
Even from a Win shell (DOS) the disappearing window
problem occurred until I inserted the line
matplotlib.interactive(False)
Idle seems to fail on the second run with error:
Unhandled exception at 0x1e0078d4 in pythonw.exe:
0xC0000005: Access violation reading location
0x00000004.
In the MS debugger I see the disassembled code:
1E0078CF nop
1E0078D0 mov edx,dword ptr [esp+4]
1E0078D4 mov ecx,dword ptr [edx+4]
where it breaks on the last line.
Thanks for the pointer on the matplotlibrc file. I'll
switch to using that from now on (more *nix-like
anyway).
Barry
--- John Hunter wrote:
> >>>>> "Ryugan" == Ryugan Mizuta
> <ryu...@sb...> writes:
>
> Ryugan> Thanks for all who gave me a
reply....
> Somehow the
> Ryugan> following script worked...:
>
> import matplotlib
> matplotlib.interactive(False)
> matplotlib.use("WX")
>
> from matplotlib.matlab import *
> plot([1,2,3,4])
> show()
>
>
> I just want to point out that in my opinion, the
> easiest way to set
> the default backend is to use your matplotlibrc
file
> -
>
http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC.
> For windows,
> this is found at
> C:\Python23\share\matplotlib\.matplotlibrc.
>
> You can achieve the same effect by setting
>
> backend : WX # the default backend
> interactive : False # see
>
http://matplotlib.sourceforge.net/interactive.html
>
> which will not be so invasive to your script (ie,
> you can change the
> default behavior of your scripts w/o changing the
> scripts
> themselves). Using
>
> import matplotlib
> matplotlib.interactive(False)
> matplotlib.use("WX")
>
> should be something you reserve to depart from
the
> desired default
> behavior.
>
> Glad it's working for you! I have two more
> questions I am curious
> about, for both you and Barry
>
> * Does WXAgg also work?
>
> * In which IDEs do you find this combination
> works?
>
> Following your question yesterday I added the FAQ
> entry
>
http://matplotlib.sourceforge.net/faq.html#FREEZE,
> and I'd like to
> update it to make it as complete as possible.
>
> JDH
>
>
>
-------------------------------------------------------
> This SF.Net email is sponsored by The 2004
> JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's
> Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone
Center
> in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf
> Priority Code NWMGYKND
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: John H. <jdh...@ac...> - 2004-06-16 12:32:32
|
>>>>> "Barry" == Barry Drake <bl...@ad...> writes:
Barry> Ryugan, Thanks. That fixed my problem as well: the graph
Barry> window disappearing after the call to show().
Hi Barry,
import matplotlib
matplotlib.interactive(False)
matplotlib.use("WX")
from matplotlib.matlab import *
plot([1,2,3,4])
show()
Which line is responsible for the fix? And are you using WX or WXAgg?
JDH
|
|
From: John H. <jdh...@ac...> - 2004-06-16 12:20:29
|
>>>>> "Ryugan" == Ryugan Mizuta <ryu...@sb...> writes:
Ryugan> Thanks for all who gave me a reply.... Somehow the
Ryugan> following script worked...:
import matplotlib
matplotlib.interactive(False)
matplotlib.use("WX")
from matplotlib.matlab import *
plot([1,2,3,4])
show()
I just want to point out that in my opinion, the easiest way to set
the default backend is to use your matplotlibrc file -
http://matplotlib.sourceforge.net/faq.html#MATPLOTLIBRC. For windows,
this is found at C:\Python23\share\matplotlib\.matplotlibrc.
You can achieve the same effect by setting
backend : WX # the default backend
interactive : False # see http://matplotlib.sourceforge.net/interactive.html
which will not be so invasive to your script (ie, you can change the
default behavior of your scripts w/o changing the scripts
themselves). Using
import matplotlib
matplotlib.interactive(False)
matplotlib.use("WX")
should be something you reserve to depart from the desired default
behavior.
Glad it's working for you! I have two more questions I am curious
about, for both you and Barry
* Does WXAgg also work?
* In which IDEs do you find this combination works?
Following your question yesterday I added the FAQ entry
http://matplotlib.sourceforge.net/faq.html#FREEZE, and I'd like to
update it to make it as complete as possible.
JDH
|
|
From: Barry D. <bl...@ad...> - 2004-06-16 12:16:22
|
Ryugan,
Thanks. That fixed my problem as well: the graph
window disappearing after the call to show().
Barry
--- Ryugan Mizuta wrote:
> Thanks for all who gave me a reply....
>
> Somehow the following script worked...:
>
> import matplotlib
> matplotlib.interactive(False)
> matplotlib.use("WX")
>
> from matplotlib.matlab import *
> plot([1,2,3,4])
> show()
>
> Thanks all for the help.
>
> Ryugan
>
>
|
|
From: Ryugan M. <ryu...@sb...> - 2004-06-16 09:06:34
|
Thanks for all who gave me a reply....
Somehow the following script worked...:
import matplotlib
matplotlib.interactive(False)
matplotlib.use("WX")
from matplotlib.matlab import *
plot([1,2,3,4])
show()
Thanks all for the help.
Ryugan
|
|
From: John H. <jdh...@ac...> - 2004-06-16 03:05:00
|
>>>>> "Flavio" == Flavio Codeco Coelho <fcc...@fi...> writes:
Flavio> how do I force the second plot to have the same limits on
Flavio> the x axis as the first?
The short answer is you can't. You could write some helper functions
or classes to force axes to behave similarly. The example code below
will call any function on all the axes. Use with caution!
class CallAll:
def __init__(self, seq, name):
self.seq = seq
self.name = name
def __call__(self, *args, **kwargs):
for a in self.seq:
func = getattr(a, self.name)
func(*args, **kwargs)
class SharedAxes:
def __init__(self, axlist):
self.axlist = axlist
def __getattr__(self, key):
return CallAll(self.axlist, key)
ax1 = subplot(211)
plot(blah, blah)
ax2 = subplot(212)
plot(blah, blah)
shared = SharedAxes((ax1, ax2))
shared.set_xlim(0,2)
|