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
(10) |
2
(30) |
3
(11) |
|
4
(5) |
5
(14) |
6
(21) |
7
(19) |
8
(29) |
9
(23) |
10
(5) |
|
11
(3) |
12
(9) |
13
(6) |
14
(12) |
15
(10) |
16
(15) |
17
(5) |
|
18
(6) |
19
(4) |
20
(28) |
21
(8) |
22
(5) |
23
(10) |
24
(4) |
|
25
(1) |
26
(6) |
27
(13) |
28
(11) |
29
(9) |
30
(23) |
|
|
From: <and...@ti...> - 2005-09-09 21:54:15
|
Hello NG,
in my app, I plot the position of some oil wells
represented by dots in a x-y plot. The coordinates of the positions are
integers. I use the command:
myaxes.plot(xc, yc, "ko")
where xc, yc
are the wells' coordinates. After some calculations, I would like to do
these 2 things in the most *efficient* or *intelligent* way:
1)
Depending on the value of a certain parameter, every well (dot) should
have a color (there are only 5 colors that a well may assume). For
example, if this parameter has a value less than 0.1, a well is painted
green, if it has a value greater than 0.1 but smaller than 1, a well is
painted blue and so on. At the moment, the only way I can think about
to implement such a thing is to do:
for ii in xrange(len(xc)):
axdata.plot([xc[i]], [yc[i]], 'ko')
which means defining a new Lines2D
object for every well. Next, it is easier to assign a different colour
to each well.
2) When the user presses the mouse "near" a well, I
would like to be able to:
a) Verify that the mouse click was "really"
near a well and not somewhere else, where there are no wells;
b) If a)
is True, retrieving which wells was clicked (which Lines2D was
clicked).
At the moment, using the plot command:
self.mp = myaxes.plot
(xc, yc, "ko")
I do these steps:
def mouse_press(self, event):
# Check if the click is inside the axes
if event.inaxes
is None:
return
xvalue, yvalue = event.xdata,
event.ydata
# Round to integer the click coordinates
xc, yc = int(round(xvalue)), int(round(yvalue))
# get
xdata and ydata for all the wells
xdata = self.mp[0][0].
get_xdata()
ydata = self.mp[0][0].get_ydata()
if xc in xdata:
# find which wells have X coordinates
equals to xc
indxs = [x[0] for x in enumerate(xdata) if x
[1] == xc]
if yc in ydata:
# find which
wells have Y coordinates equals to yc
indys = [x[0] for
x in enumerate(ydata) if x[1] == yc]
lenx = len(indxs)
leny = len(indys)
# create 2 lists
that can be compared in length
if lenx < leny:
indxs.extend([-9999]*(leny-lenx))
elif leny < lenx:
indys.extend([-9999]*(lenx-leny))
tmp = []
# find the intersections
between the 2 lists
for xcoord in indxs:
if xcoord in indys:
tmp.
append(indys.index(xcoord))
# ==>
The click matches the well if len(tmp) > 0
if len(tmp)
> 0:
ind = tmp[0]
# get
wellnames from other sources
currentwell = self.
wellnames[indys[ind]]
Thank you for every suggestion. Great work with
matplotlib!
Andrea.
|
|
From: Sascha <sas...@gm...> - 2005-09-09 20:46:45
|
John, > Hey Sascha, thanks for this example. If you get some time, could you > add it to the matplotlib wiki at > http://www.scipy.org/wikis/topical_software/MatplotlibCookbook? It's been a pleasure. I have added my example (including your suggested changes) to the wiki: http://www.scipy.org/wikis/topical_software/MatplotlibAndZope Sascha > I have one suggestion: you need to be careful to do > > import matplotlib > matplotlib.use('Agg') > > *before* importing pylab, in case the default matplotlibrc setting has > a GUI backend (eg 'backend : GTKAgg') > > Thanks! > JDH |
|
From: Jeff P. <jef...@se...> - 2005-09-09 20:26:18
|
Hello, I'm using matplotlib 0.83.2 and I'm trying to get matplotlib to
work with py2exe. I am getting this error message in the *.exe.log file:
Traceback (most recent call last):
File "SPC.py", line 6, in ?
File "Frame1.pyc", line 10, in ?
File "Frame2.pyc", line 9, in ?
File "matplotlib\__init__.pyc", line 568, in ?
File "matplotlib\__init__.pyc", line 261, in wrapper
File "matplotlib\__init__.pyc", line 376, in _get_data_path
RuntimeError: Could not find the matplotlib data files
My setup.py is listed below:
#setup.py
from distutils.core import setup
import py2exe
# We need to import the glob module to search for all files.
import glob
# We need to exclude matplotlib backends not being used by this
executable. You may find
# that you need different excludes to create a working executable with
your chosen backend.
opts = {
'py2exe': { 'excludes': ['_gtkagg', '_tkagg'],
'dll_excludes': ['libgdk-win32-2.0-0.dll',
'libgobject-2.0-0.dll']
}
}
# Additional data files are required by matplotlib. Note that the
glob.glob routine
# doesn't seem to pick up the .matplotlib resource file, so I copy that
separately.
setup(
data_files = [('lib\matplotlibdata',
glob.glob(r'c:\python24\share\matplotlib\*')),
('lib\matplotlibdata',
['c:\python24\share\matplotlib\matplotlibrc'])],
name = 'demo',
description = 'MatPlotLib Demo Program',
windows = [{"script":"SPC.py", "icon_resources":[(0x001,
"mag.ico")]}]
)
there are also lots of files that are excluded these are:
The following modules appear to be missing
['_xlrdutils', 'cephes', 'numerix.ArrayType', 'numerix.Complex',
'numerix.Float'
, 'numerix.Float32', 'numerix.Float64', 'numerix.Int', 'numerix.Int16',
'numerix
.Int32', 'numerix.Matrix', 'numerix.UInt8', 'numerix.absolute',
'numerix.add', '
numerix.alltrue', 'numerix.arange', 'numerix.arctan2', 'numerix.argmin',
'numeri
x.argsort', 'numerix.array', 'numerix.asarray', 'numerix.asum',
'numerix.ceil',
'numerix.clip', 'numerix.compress', 'numerix.concatenate',
'numerix.conjugate',
'numerix.convolve', 'numerix.cos', 'numerix.cumsum', 'numerix.diagonal',
'numeri
x.divide', 'numerix.dot', 'numerix.equal', 'numerix.exp',
'numerix.fft.fft', 'nu
merix.fft.inverse_fft', 'numerix.floor', 'numerix.greater',
'numerix.indices', '
numerix.less', 'numerix.log', 'numerix.log10', 'numerix.logical_and',
'numerix.m
atrixmultiply', 'numerix.maximum', 'numerix.minimum',
'numerix.mlab.amax', 'nume
rix.mlab.amin', 'numerix.mlab.cov', 'numerix.mlab.diff',
'numerix.mlab.flipud',
'numerix.mlab.hanning', 'numerix.mlab.rand', 'numerix.mlab.std',
'numerix.mlab.s
vd', 'numerix.multiply', 'numerix.nonzero', 'numerix.nx',
'numerix.ones', 'numer
ix.pi', 'numerix.power', 'numerix.put', 'numerix.ravel',
'numerix.repeat', 'nume
rix.reshape', 'numerix.resize', 'numerix.searchsorted', 'numerix.shape',
'numeri
x.sin', 'numerix.size', 'numerix.sometrue', 'numerix.sort',
'numerix.sqrt', 'num
erix.take', 'numerix.tan', 'numerix.transpose', 'numerix.where',
'numerix.which'
, 'numerix.zeros', 'matplotlib.numerix.absolute',
'matplotlib.numerix.equal', 'm
atplotlib.numerix.sqrt', 'numarray.Complex', 'numarray.Complex32',
'numarray.Com
plex64', 'numarray.Float', 'numarray.Float32', 'numarray.Float64',
'numarray.Int
', 'numarray.Int16', 'numarray.Int32', 'numarray.Int8',
'numarray.NumArray', 'nu
marray.UInt16', 'numarray.UInt32', 'numarray.UInt8', 'numarray.asarray',
'numarr
ay.fromlist', 'numarray.shape', 'numarray.typecode', 'numarray.zeros']
any ideas how I can fix this thing so that it can work?
Thanks!
Jeff
_____
Jeffrey Thomas Peery
SeaMetrics, Inc.
Mechanical Engineer
Jef...@Se...
253.872.0285 (fax)
253.872.0284 (phone)
_____
|
|
From: John H. <jdh...@ac...> - 2005-09-09 18:16:29
|
>>>>> "Ken" == Ken McIvor <mc...@ii...> writes:
Ken> John, I just submitted a (lightly tested) patch to
Ken> sourceforge which tries to detect that wxPython.h is missing.
Ken> This situation is handled the same way a missing `wx-config'
Ken> is, in that the build is only killed when BUILD_WXAGG is True
Ken> (as opposed to just emitting a message when it's "auto").
OK, I just committed this. There was a minor correction
flags = getoutput(wxconfig + ' --cppflags').split()
^^^^^^^^
Checking in setupext.py;
/cvsroot/matplotlib/matplotlib/setupext.py,v <-- setupext.py
new revision: 1.88; previous revision: 1.87
'Thanks, Kevin'.replace('vi', '') <wink>
|
|
From: Samuel M. S. <sm...@sa...> - 2005-09-09 17:15:45
|
Thanks Robert. I made the changes to texmanager.py and it worked.
On 08 Sep, 2005, at 23:24, Robert Kern wrote:
> Samuel M.Smith wrote:
>
>
>> With usetex = true, a serif font is used. How to I get matplotlib to
>> use a sans serif font?
>> I assume I need to change the font.latex.package but I don't know
>> what
>> my choices are.
>>
>
> I don't think so. LaTeX font packages specify one each of serif,
> sans-serif, and typewriter faces[1]. The problem is that matplotlib's
> generated LaTeX doesn't seem to honor the font.family selection.
>
> You can add something like this at the top of
> TexManager.get_tex_command():
>
> fontcmd = {'sans-serif': r'{\sffamily %s}',
> 'monospace': r'{\ttfamily %s}'}.get(rcParams
> ['font.family'],
> r'{\rmfamily %s}')
> tex = fontcmd % tex
>
> [1] But to find which font packages you have installed, go to
> /usr/local/share/texmf/tex/latex/ (replace /usr/local with whatever
> the
> prefix is for your TeX installation; also "texmf" may be something
> similar like "texmf-dist" in DarwinPorts). Then
>
> $ ls */*.fd
>
> I think all of those directories that have .fd files in them are font
> packages. The package name will be the same as the directory name, I
> believe.
>
> --
> Robert Kern
> rk...@uc...
>
> "In the fields of hell where the grass grows high
> Are the graves of dreams allowed to die."
> -- Richard Harter
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle
> Practices
> Agile & Plan-Driven Development * Managing Projects & Teams *
> Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/
> bsce5sf
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
**********************************************************************
Samuel M. Smith Ph.D.
2966 Fort Hill Road
Eagle Mountain, Utah 84043
801-768-2768 voice
801-768-2769 fax
**********************************************************************
"The greatest source of failure and unhappiness in the world is
giving up what we want most for what we want at the moment"
**********************************************************************
|
|
From: Nicolas G. <nic...@ne...> - 2005-09-09 15:04:27
|
On Friday 09 September 2005 16:51, John Hunter wrote: > >>>>> "Nicolas" == Nicolas Girard <nic...@ne...> writes: > > Nicolas> Nope... see lib/matplotlib/contour.py, current cvs > Nicolas> version, line 627. > > Sometimes, nondeveloper CVS lags behind developer access. See revision > Oh, ok, I didn't know... Nicolas |
|
From: Samuel M. S. <sm...@sa...> - 2005-09-09 15:01:31
|
>>
>> However when I set usetex=True in my matplotlibrc file it does not
>> use tex. I have to manually call
>> rc('text',usetex=True) inside python, do you know why it does not
>> work from the rc file?
>>
>
> The only reason I can think of is that your rc file is stored where
> mpl can't
> find it, or, you have another rc file somewhere that is being read
> before the
> one you are editing.
>
>
When I switched from matplotlib 0.82 to 0.83.2 I had problems and had
to revert back to 0.82 until I found
a fix for the problems. Everytime I installed 0.83.2 it would move
my .matplotlibrc file into .matplotlib/matplotlibrc.
When I reinstalled 0.83.2 I had to manually move the rc file back out
of the .matplotlibrc directory. I made a backup
of .matplotlibrc and stupidly called it matplotlibrc. It appears that
0.83.2 will first look for matplotlibrc in your home directory and
then if it doesn't find it there look for matplotlibrc in
~/.matplotlib/matplotlibrc. Once I renamed the matplotlibrc in my
home folder the changes I made to select tex in the ~/.matplotlib/
matplotlib showed up.
Thanks.
|
|
From: John H. <jdh...@ac...> - 2005-09-09 14:52:29
|
>>>>> "Nicolas" == Nicolas Girard <nic...@ne...> writes:
Nicolas> On Friday 09 September 2005 16:37, Jeff Whitaker wrote:
>> Nicolas Girard wrote: >May I suggest that the documentation for
>> contour() contains fmt='%1.3f' >instead of fmt='1.3f' ?
>>
>> Someone beat me to it - it already reads that way in CVS.
Nicolas> Nope... see lib/matplotlib/contour.py, current cvs
Nicolas> version, line 627.
Sometimes, nondeveloper CVS lags behind developer access. See revision
Checking in lib/matplotlib/contour.py;
/cvsroot/matplotlib/matplotlib/lib/matplotlib/contour.py,v <-- contour.py
new revision: 1.13; previous revision: 1.12
JDH
|
|
From: Nicolas G. <nic...@ne...> - 2005-09-09 14:49:07
|
On Friday 09 September 2005 16:37, Jeff Whitaker wrote: > Nicolas Girard wrote: > >May I suggest that the documentation for contour() contains fmt='%1.3f' > >instead of fmt='1.3f' ? > > Someone beat me to it - it already reads that way in CVS. Nope... see lib/matplotlib/contour.py, current cvs version, line 627. Nicolas |
|
From: Jeff W. <js...@fa...> - 2005-09-09 14:37:23
|
Nicolas Girard wrote: >On Friday 09 September 2005 15:01, Jeff Whitaker wrote: > > >>Nicolas: I believe that should be fmt='%1.3f'. >> >> >> >Jeff, >once again, you were tight : thanks for your support ! > >May I suggest that the documentation for contour() contains fmt='%1.3f' >instead of fmt='1.3f' ? > >cheers, >Nicolas > > Someone beat me to it - it already reads that way in CVS. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/CDC R/CDC1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
|
From: John H. <jdh...@ac...> - 2005-09-09 14:07:58
|
>>>>> "Sascha" == Sascha <sas...@gm...> writes:
Message> For importing External Method in Zope, what is the module
Message> to
Sascha> import?
Sascha> Create a file (e.g. mpl.py) in INSTANCEHOME\Extensions.
Hey Sascha, thanks for this example. If you get some time, could you
add it to the matplotlib wiki at
http://www.scipy.org/wikis/topical_software/MatplotlibCookbook?
I have one suggestion: you need to be careful to do
import matplotlib
matplotlib.use('Agg')
*before* importing pylab, in case the default matplotlibrc setting has
a GUI backend (eg 'backend : GTKAgg')
Thanks!
JDH
|
|
From: John H. <jdh...@ac...> - 2005-09-09 14:05:09
|
>>>>> "Travis" == Travis Brady <td...@fa...> writes:
Travis> Anybody know how to update the Matplotlib distribution
Travis> contained within the Enthought Python distribution? There
Travis> seems to be no uninstaller for any of the packages and I'd
Travis> like to update to the latest mpl.
You can simply remove site-packages/matplotlib and then run the
installer from the matplotlib web site.
JDH
|
|
From: John H. <jdh...@ac...> - 2005-09-09 14:04:17
|
>>>>> "Martin" == Martin Richter <law...@gm...> writes:
Martin> Then I wondered 'Why is this so?' and figured out that the
Martin> plot()-command (in interactive mode) plots the previous
Martin> points all over again with each new point. Therefore
Martin> using setp(line, data=('old data + new point')) made
Martin> everything faster because now was only one object to
Martin> handle (which of course is getting complexer and
Martin> complexer). Up to this point it is exactly the same as
Martin> described in 'anim.py'.
Martin> My question is now: Is there a way just to add points to a
Martin> plot? Because even in the append-method MPL draws
This is one area of the code I have been actively developing in the
last few months -- the ability to selectively draw certain artists and
reblit just a region of the figure. For a tutorial introduction, see
http://www.scipy.org/wikis/topical_software/MatplotlibCookbook
I'll include an example script below. For each marker, an object is
created, but we only draw each marker once so it is much faster than
the typical case when you get an accumulation of independent objects
and all have to be redrawn. I realize the code is complex and not
suitable for use by your students. This was only meant to be a low
level API that we could then provide a user friendly wrapper around.
But since these features are very new (only in CVS and only for TKAgg,
GTKAgg and WXAgg) we haven't gotten to the stage of making it easy to
use. If you have some ideas on an API to make this more friendly,
please share them.
In the example code below on my system (GTKAgg, 3GHz P4, linux) I get
about 134 PPS (points per second) for both N=100 and N=10000 so it
scales fine. However, for 10000 points, 134 PPS is still pretty slow,
because it takes 74 seconds to finish. For large numbers of points,
you can speed it up significantly by only blitting when a certain
number of points have been drawn, eg replacing the blit code with
if update.cnt%50==0: ax.figure.canvas.blit(ax.bbox)
With this approach, I draw about 1000 PPS on my machine
Here is the example
import time
import matplotlib.numerix as nx
from matplotlib.patches import Circle
from matplotlib.transforms import identity_transform
from pylab import figure, show
N = 100
x = nx.arange(float(N))
y = nx.mlab.rand(N)
fig = figure()
ax = fig.add_subplot(111, autoscale_on=False)
ax.set_xlim(0,N)
ax.set_ylim(-.1, 1.1)
radius = 6/72.*ax.figure.dpi.get() # 6 points in pixels
def update(*args):
# we want to draw a circle at x,y in data coordinates but have the
# radius in pyhysical size (points). To accomplish this we use an
# identity transform and draw a circle at 0,0 with a radius in
# pixels. We apply an translation offset of x,y in data coords
if update.cnt==0:
update.start = time.time()
trans = identity_transform()
trans.set_offset( (x[update.cnt], y[update.cnt]), ax.transData)
circ = Circle( (0,0), radius=radius, transform=trans )
circ.set_clip_box(ax.bbox)
#selectively draw the artist with the draw_artist command
#and just reblit the axes bounding box
ax.draw_artist(circ)
ax.figure.canvas.blit(ax.bbox)
update.cnt+=1
if update.cnt==len(x):
print 'PPS', update.cnt/(time.time()-update.start)
return False
else: return True
update.cnt=0
# use any GUI timer or idle function you want
import gobject
gobject.idle_add(update)
show()
If you do want to blit every marker when it is created, you can reblit
just the small region that bounds the marker. The "get_window_extent"
call is a bbox that bounds the circle vertices, but you have to pad it
a little to account for the line width. The relevant update is
l,b,w,h = circ.get_window_extent().get_bounds()
pad = 3
bbox = lbwh_to_bbox(l-pad, b-pad, w+2*pad, h+2*pad)
...snip...
ax.figure.canvas.blit(bbox)
which gives me 777 PPS even when blitting every marker.
Here is the complete example
import time
import matplotlib.numerix as nx
from matplotlib.patches import Circle
from matplotlib.transforms import identity_transform, lbwh_to_bbox
from pylab import figure, show
N = 10000
x = nx.arange(float(N))
y = nx.mlab.rand(N)
fig = figure()
ax = fig.add_subplot(111, autoscale_on=False)
ax.set_xlim(0,N)
ax.set_ylim(-.1, 1.1)
radius = 6/72.*ax.figure.dpi.get() # 6 points in pixels
def update(*args):
if update.cnt==0:
update.start = time.time()
trans = identity_transform()
trans.set_offset( (x[update.cnt], y[update.cnt]), ax.transData)
circ = Circle( (0,0), radius=radius, transform=trans )
circ.set_clip_box(ax.bbox)
l,b,w,h = circ.get_window_extent().get_bounds()
pad = 3
bbox = lbwh_to_bbox(l-pad, b-pad, w+2*pad, h+2*pad)
ax.draw_artist(circ)
ax.figure.canvas.blit(bbox)
update.cnt+=1
if update.cnt==len(x):
print 'PPS', update.cnt/(time.time()-update.start)
return False
else: return True
update.cnt=0
import gobject
gobject.idle_add(update)
show()
|
|
From: Nicolas G. <nic...@ne...> - 2005-09-09 13:59:15
|
On Friday 09 September 2005 15:01, Jeff Whitaker wrote: > Nicolas: I believe that should be fmt='%1.3f'. > Jeff, once again, you were tight : thanks for your support ! May I suggest that the documentation for contour() contains fmt='%1.3f' instead of fmt='1.3f' ? cheers, Nicolas |
|
From: Martin R. <law...@gm...> - 2005-09-09 13:10:56
|
Hello everyone,
I have a question concerning a common task, to dynamically plot the results
of some (usually pretty fast) computation.
Approach 1: (Routine `do_it_point_by_point` below)
just call `plot` successively.
Here the update frequency gets slower and
slower the more points are added.
Approach 2: (Routine `do_it_point_by_point`)
Here one obtains a speed improvement, however the code is
more complicated (in particular for beginners!).
To get some speed improvements I figured out that it is better to open just
one plot and then append new data to this one. For large numbers of points
to draw this makes the plot faster.
Then I wondered 'Why is this so?' and figured out that the plot()-command
(in interactive mode) plots the previous points all over again with each new
point.
Therefore using setp(line, data=('old data + new point')) made everything
faster because now was only one object to handle (which of course is getting
complexer and complexer). Up to this point it is exactly the same as
described in 'anim.py'.
My question is now: Is there a way just to add points to a plot? Because
even in the append-method MPL draws everything again with each draw(). Only
this time MPL has to plot one thing - a circular arc instead of many many
points and is therefore faster.
Remarks:
- Of course this is only reasonable if autoscale_on=False.
- in this situation the z-ordering could not be obeyed
(which would be perfectly ok for this particular usage)
- No previous points have to be replotted (this is what I would want)
To play around with this idea I tried to use a modified plot routine,
which should just plot the newly added points/lines/...:
#------------------------------------------------------------------
def fastplot(*args, **kwargs):
b = ishold()
h = popd(kwargs, 'hold', None)
if h is not None:
hold(h)
try:
ret = gca().plot(*args, **kwargs)
renderer = gca().get_renderer_cache()
gc = renderer.new_gc() # new graphics context
for line in ret:
renderer.draw_line(gc, args[0][1],
args[0][1],args[1][0], args[1][1])
except:
hold(b)
raise
hold(b)
return ret
#------------------------------------------------------------------
However, this (mainly a copy of plot()) does not work (nothing appears on
the screen).
So what do you think:
Is there any possibilty to turn the 'draw everything again
with each plot()-command' off?
My suggestion is that propably the usage of the Renderer (like above)
directly (as described in user's manual) could help. But I'm not really able
to understand what MPL is doing there.
Is it possible to use the commands described there with existing axis to get
output on the screen? I.e. using something like
ax = gca()
renderer = ax.get_renderer_cache()
if some other thing has already been plotted? I tried to go on with the code
from
the user's manual:
gc = o.new_gc()
rec = o.draw_rectangle(gc,face,100,100,200,200)
You can see the rectangle, if interactive-mode is off. This is a drawback
because the issue mentioned at the beginning needs ion().
If something like this would be possible it would make things to new
students learning python and mpl much easier.
Thanks for your
help,
Martin
#---------------------------------------------------------------------------------
from pylab import *
import time # for profiling
def do_it_point_by_point(x1,y1):
print " plot every point seperately ..."
n = len(x1)
axis([-1,1,-1,1])
axis('scaled')
for i in xrange(n): # plot all data step by step
plot( [x1[i] ],[y1[i] ],'bo')
def do_it_by_append(x1,y1):
print " append data to existing plot ..."
n = len(x1)
points = plot(x1[0]*ones(2),y1[0]*ones(2),'ro')# draw the first point
axis([-1,1,-1,1])
axis('scaled')
if n>1:
x_help = list()
x_help.append(x1[0])
y_help = list()
y_help.append(y1[0])
for i in xrange(1,n-1):
x_help.append(x1[i])
y_help.append(y1[i]) # append the rest and ...
setp(points,data=(array(x_help),array(y_help))) # update data
n=80 # setting n=300 makes the
phi=2.0*pi*arange(n)/n # difference quite
obvious
x=cos(phi)
y=sin(phi)
ion()
print ""
figure(1)
subplot(111, autoscale_on=False)
tstart = time.time()
do_it_point_by_point(x,y)
tend = time.time()
t_old = tend - tstart
close(1)
figure(1)
tstart = time.time()
do_it_by_append(x,y)
tend = time.time()
t_new = tend - tstart
close(1)
ioff()
print ""
print " It took %6.2f s the point-by-point way,"%(t_old)
print " %6.2f s the append way."%(t_new)
--
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse für Mail, Message, More +++
|
|
From: Jeff W. <js...@fa...> - 2005-09-09 13:01:25
|
Nicolas Girard wrote: >Hi all, >I'm still trying to analyse my data using the contour directive. When adding >fmt='1.3f' to the arguments, here's what happens: > > Nicolas: I believe that should be fmt='%1.3f'. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449 325 Broadway Web : http://www.cdc.noaa.gov/~jsw Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124 |
|
From: Arnd B. <arn...@we...> - 2005-09-09 12:43:23
|
On Thu, 8 Sep 2005, Mark Bakker wrote:
> The axis('scaled') was a first quick-and-dirty implementation of getting the
> scale of a figure the same along both axes. When it was implemented in the
> previous version, John Hunter commented (correctly) that it didn't work for
> subplots. That is what triggered the clean implementation of axis('equal').
> I think axis('equal') works correctly. Except for the known problem that the
> back button on the toolbar doesn't restore the previous position. I will try
> to fix this in the next week or so.
> I left the axis('scaled') option in, mostly as a novelty, and because I like
> it. But it is only useful if you don't have subplots. Maybe we should just
> get rid of it, as it is not really needed anymore. I have no idea what
> 'scaled' and 'equal' do together.
>
> Regarding the autoscale_on attribute. I don't know what that was designed to
> do. Can anybody explain?
Let me give a try:
There are situations, where the data cover a large range and
one is interested only in a subregion.
Then one can use `axis` to specify the region and
set autoscale_on=False, so that subsequent plots don't change
the limits of the plot
(This is for example to gnuplot's
set xrange [0.0:10.0]
set yrange [0.0:10.0]
Gnuplot is more flexible here, as it allows to have autoscaling
on/off on either axis or either limits (uups, another hidden
feature request):
set xrange [0.0:]
set yrange [:]
)
> To summarize:
> 1. I will add the position to the history so that the backbutton works.
> 2. Let's remove the axis('scaled') option
Please don't!!! That seems to be the only option which leads
to the behaviour I need.
I am still confused about all the different options
and differing results, in particular when order is changed.
But if matplotlib wants to be compatable with
the behaviour of matplot wrt. `axis("equal")`, I will
stop complaining and just use `axis("scaled")`.... ;-)
Best,
Arnd
|
|
From: Nicolas G. <nic...@ne...> - 2005-09-09 10:49:50
|
Hi all,
I'm still trying to analyse my data using the contour directive. When adding
fmt='1.3f' to the arguments, here's what happens:
In [25]:contour(r[0:zmax],z[0:zmax],rho[0:zmax],30,fmt = '1.3f')
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most recent
call last)
/home/ngirard/.python/<console>
/usr/lib/python2.4/site-packages/matplotlib/pylab.py in contour(*args,
**kwargs)
1784 hold(h)
1785 try:
-> 1786 ret = gca().contour(*args, **kwargs)
1787 draw_if_interactive()
1788 except:
/usr/lib/python2.4/site-packages/matplotlib/axes.py in contour(self, *args,
**kwargs)
1251
1252 def contour(self, *args, **kwargs):
-> 1253 return self._contourHelper.contour(*args, **kwargs)
1254 contour.__doc__ = ContourSupport.contour.__doc__
1255
/usr/lib/python2.4/site-packages/matplotlib/contour.py in contour(self, *args,
**kwargs)
685 col.set_linestyle((0, (6.,6.)),)
686 #print "setting dashed"
--> 687 col.set_label(fmt%level)
688 self.ax.add_collection(col)
689 collections.append(col)
TypeError: not all arguments converted during string formatting
Any hint ?
Thanks in advance,
cheers,
Nicolas
|
|
From: Ken M. <mc...@ii...> - 2005-09-09 06:09:36
|
John, I just submitted a (lightly tested) patch to sourceforge which tries to detect that wxPython.h is missing. This situation is handled the same way a missing `wx-config' is, in that the build is only killed when BUILD_WXAGG is True (as opposed to just emitting a message when it's "auto"). Ken |
|
From: Robert K. <rk...@uc...> - 2005-09-09 05:24:58
|
Samuel M.Smith wrote:
> With usetex = true, a serif font is used. How to I get matplotlib to
> use a sans serif font?
> I assume I need to change the font.latex.package but I don't know what
> my choices are.
I don't think so. LaTeX font packages specify one each of serif,
sans-serif, and typewriter faces[1]. The problem is that matplotlib's
generated LaTeX doesn't seem to honor the font.family selection.
You can add something like this at the top of TexManager.get_tex_command():
fontcmd = {'sans-serif': r'{\sffamily %s}',
'monospace': r'{\ttfamily %s}'}.get(rcParams['font.family'],
r'{\rmfamily %s}')
tex = fontcmd % tex
[1] But to find which font packages you have installed, go to
/usr/local/share/texmf/tex/latex/ (replace /usr/local with whatever the
prefix is for your TeX installation; also "texmf" may be something
similar like "texmf-dist" in DarwinPorts). Then
$ ls */*.fd
I think all of those directories that have .fd files in them are font
packages. The package name will be the same as the directory name, I
believe.
--
Robert Kern
rk...@uc...
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
|
|
From: Darren D. <dd...@co...> - 2005-09-09 04:41:28
|
On Thursday 08 September 2005 11:58 pm, Samuel M.Smith wrote:
> > Yes. If you have LaTeX installed, and set
> >
> > rc('text', usetex=True)
> >
> > then saving to EPS and converting to PDF through any of the various
> > means works fine.
>
> I installed the latest version of TexShop and then tried it.
> It worked. Thanks!
>
> However when I set usetex=True in my matplotlibrc file it does not
> use tex. I have to manually call
> rc('text',usetex=True) inside python, do you know why it does not
> work from the rc file?
The only reason I can think of is that your rc file is stored where mpl can't
find it, or, you have another rc file somewhere that is being read before the
one you are editing.
> With usetex = true, a serif font is used. How to I get matplotlib to
> use a sans serif font?
> I assume I need to change the font.latex.package but I don't know
> what my choices are.
I'm afraid I'm going to have to defer you to the web for available font
packages. Maybe ask a tex newsgroup...
Darren
|
|
From: Samuel M. S. <sm...@sa...> - 2005-09-09 03:58:13
|
> Yes. If you have LaTeX installed, and set
>
> rc('text', usetex=True)
>
> then saving to EPS and converting to PDF through any of the various
> means works fine.
>
>
>
I installed the latest version of TexShop and then tried it.
It worked. Thanks!
However when I set usetex=True in my matplotlibrc file it does not
use tex. I have to manually call
rc('text',usetex=True) inside python, do you know why it does not
work from the rc file?
Do I need to delete my font cache? or is something else overriding it
in the rc file.
With usetex = true, a serif font is used. How to I get matplotlib to
use a sans serif font?
I assume I need to change the font.latex.package but I don't know
what my choices are.
this is my rc file section
ont.family : sans-serif
font.style : normal
font.variant : normal
font.weight : medium
font.stretch : normal
font.size : medium
font.serif : New Century Schoolbook, Century Schoolbook L,
Utopia, ITC Bookman, Bookman, Bitstream Vera Serif, Nimbus Roman No9
L, Times New Roman, Times, Palatino, Charter, serif
font.sans-serif : Lucida Grande, Verdana, Geneva, Lucida,
Bitstream Vera Sans, Arial, Helvetica, sans-serif
font.cursive : Apple Chancery, Textile, Zapf Chancery, Sand,
cursive
font.fantasy : Comic Sans MS, Chicago, Charcoal, Impact,
Western, fantasy
font.monospace : Andale Mono, Bitstream Vera Sans Mono, Nimbus
Mono L, Courier New, Courier, Fixed, Terminal, monospace
font.latex.package : type1cm # This must be an available LaTeX font
#package, like 'times' or 'pslatex' ; only applies if text.usetex is set
|
|
From: Christopher H. <chr...@gm...> - 2005-09-09 01:34:56
|
Hi, I recently made an entry at the matplotlib cookbook wiki: http://www.scipy.org/wikis/topical_software/InteractivePlotting """ I find it often quite useful to be able to identify points within a plot simply by clicking. This recipe provides a fairly simple functor that can be connected to any plot. I've used it with both scatter and standard plots. """ I thought I'd post a note here soliciting for comments and suggestions on how I might do this better and faster. Specifically when the number of points grows to tens of thousands things begin to crawl. I was wondering how I can refresh only the text markers rather than the whole plot? Also, is there a better way to identify the point closet to where a user clicked? axis.pick doesn't quite do the right thing because it returns whole collections - right? Thanks, Chris |