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
(5) |
2
(4) |
|
3
|
4
(9) |
5
(4) |
6
(9) |
7
(13) |
8
(11) |
9
(7) |
|
10
(7) |
11
(22) |
12
(19) |
13
(11) |
14
(20) |
15
(21) |
16
(1) |
|
17
(1) |
18
(8) |
19
(3) |
20
(5) |
21
(5) |
22
(9) |
23
(3) |
|
24
(3) |
25
(14) |
26
(12) |
27
(29) |
28
(18) |
29
(11) |
30
(2) |
|
From: <Fer...@co...> - 2005-04-27 23:32:49
|
Quoting John Hunter <jdh...@ni...>: > >>>>> "ravi" == ravi <ra...@gm...> writes: > > ravi> Hi, I just upgraded to 0.80 from 0.73.1 on a Fedora Core 3 > ravi> machine. I am (and have been) using ipython 0.6.13 as my > ravi> shell. After the upgrade, plots from scripts are no longer > ravi> interactive - I need an explicit call to pylab.show() to > ravi> show the plots. > > ravi> Do I need to update some settings? I am using the GTKAgg > ravi> backend with all default parameters (no user-specific > ravi> .matplotlibrc) and I compiled matplotlib from sources. Here > ravi> is a simple script that no longer updates 100 times but just > ravi> shows once: > > Fernando and I made a conscious choice to turn off interactive mode > when running scripts from ipython, since this is usually what people > want and has better performance. To override this, to need to > explicitly turn on/and off interactive mode where desired, and > possibly explicitly call draw in the animation loop where you want the > figure to be refreshed. > > import scipy > import matplotlib > from matplotlib import pylab > > pylab.ion() # turn on interactive mode > for x in scipy.arange(100): > pylab.plot(scipy.randn(1000)+x) > > pylab.show() A small note to clarify why we did this: we wanted to make sure that a script which works correctly under ipython's %run will work equally well outside of ipython. That's why I removed the automagic calling of show() by ipython, to force users to write valid matplotlib scripts regardless of where they want to run them. You only need to use ion/ioff if you want to have fine control over how matplotlib updates its plots. I personally never use those, and I simply make sure that all my mpl scripts have a show() call on their last line. Regards, f |
|
From: <Fer...@co...> - 2005-04-27 23:24:40
|
Quoting John Hunter <jdh...@ni...>: > >>>>> "steve" == steve schmerler <el...@gm...> writes: > steve> 2.) When I start my Python shell (IPython, WinXP) and use > steve> MPL the 1st time in the session > > steve> from pylab import * plot(...); show() > > steve> the plot window appears but I'm not able to type anything > steve> in the shell. I close the plot window and > steve> plot(...); show() > > steve> again. From now on I'm able to type in the shell. What's > steve> up? > > You need to start ipython with -pylab option, and then 1) you do not > need to import pylab and 2) you do not need to call show. ipytohn > will read your rc file and do the right thing. See Just to clarify, if you are running a script via ipython's %run, you do need to call show() at the end. That's precisely the conscious change John referred to recently in another thread. Best, f |
|
From: Jeffrey O. <Jef...@ve...> - 2005-04-27 19:15:27
|
Bingo. The two plots are identical after this fix. Thanks for the help
and additional clarifications on the 'use' directive and canvases.
-----Original Message-----
From: John Hunter [mailto:jdh...@ac...]
Sent: Wednesday, April 27, 2005 1:07 PM
To: Jeffrey Orrey
Cc: mat...@li...
Subject: Re: [Matplotlib-users] plot resolution discrepancy with
embeddingin gtk
>>>>> "John" == John Hunter <jdh...@ac...> writes:
John> No: from matplotlib.backends.backend_gtkagg import
John> FigureCanvasGTK as FigureCanvas
John> Yes: from matplotlib.backends.backend_gtkagg import
John> FigureCanvasGTKAgg as FigureCanvas
To which I should add a bit of clarification.
You called
import pygtk
pygtk.require("2.0")
import os, gtk
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.backends.backend_gtkagg import FigureCanvasGTK as
FigureCanvas
from matplotlib.figure import Figure
The problem (aside from the fact that you need and not
FigureCanvasGTK) is that the 'use' directive is a pylab only construct.
It is used by the override the rc file backend setting that the pylab
module normally reads. It is irrelevant to the API (and hence was
ignored), where you can use an many different types of FigureCanvases as
make sense in your environment. Ie, there is no concept of a default or
current backend in the API, and the canvases you import and create are
the ones that will be used.
JDH
|
|
From: John H. <jdh...@ac...> - 2005-04-27 19:06:56
|
>>>>> "John" == John Hunter <jdh...@ac...> writes:
John> No: from matplotlib.backends.backend_gtkagg import
John> FigureCanvasGTK as FigureCanvas
John> Yes: from matplotlib.backends.backend_gtkagg import
John> FigureCanvasGTKAgg as FigureCanvas
To which I should add a bit of clarification.
You called
import pygtk
pygtk.require("2.0")
import os, gtk
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.backends.backend_gtkagg import FigureCanvasGTK as FigureCanvas
from matplotlib.figure import Figure
The problem (aside from the fact that you need and not
FigureCanvasGTK) is that the 'use' directive is a pylab only
construct. It is used by the override the rc file backend setting
that the pylab module normally reads. It is irrelevant to the API
(and hence was ignored), where you can use an many different types of
FigureCanvases as make sense in your environment. Ie, there is no
concept of a default or current backend in the API, and the canvases
you import and create are the ones that will be used.
JDH
|
|
From: John H. <jdh...@ac...> - 2005-04-27 18:58:37
|
>>>>> "Jeffrey" == Jeffrey Orrey <Jef...@ve...> writes:
Jeffrey> Please note that my original posting was to
Jeffrey> matplotlib-users-admin by mistake, so not everyone saw
Jeffrey> the first part of this (below).
Jeffrey> Based on John's suggestions, I checked figsize and dpi
Jeffrey> settings and still find a difference in the plot quality
Jeffrey> between using pylab.figure and using
Jeffrey> matplotlib.figure.Figure.
Jeffrey> As a simple test, I modified the example
Jeffrey> pythonic_matplotlib.py to plot in a gtk window and use
Jeffrey> Figure as follows:
No:
from matplotlib.backends.backend_gtkagg import FigureCanvasGTK as FigureCanvas
Yes:
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
|
|
From: Jeffrey O. <Jef...@ve...> - 2005-04-27 18:44:48
|
Please note that my original posting was to matplotlib-users-admin by
mistake, so not everyone saw the first part of this (below).
Based on John's suggestions, I checked figsize and dpi settings and
still find a difference in the plot quality between using pylab.figure
and using matplotlib.figure.Figure.
As a simple test, I modified the example pythonic_matplotlib.py to plot
in a gtk window and use Figure as follows:
----------
from pylab import figure, close, axes, subplot, show
from matplotlib.numerix import arange, sin, pi
import pygtk
pygtk.require("2.0")
import os, gtk
import matplotlib
matplotlib.use('GTKAgg')
from matplotlib.backends.backend_gtkagg import FigureCanvasGTK as
FigureCanvas
from matplotlib.figure import Figure
t = arange(0.0, 1.0, 0.01)
#fig = figure(1)
fig = Figure(dpi=100)
ax1 = fig.add_subplot(211)
ax1.plot(t, sin(2*pi*t),antialiased=True,linewidth=0.5)
ax1.grid(True)
ax1.set_ylim( (-2,2) )
ax1.set_ylabel('1 Hz')
ax1.set_title('A sine wave or two')
for label in ax1.get_xticklabels():
label.set_color('r')
ax2 = fig.add_subplot(212)
ax2.plot(t, sin(2*2*pi*t),antialiased=True,linewidth=0.5)
ax2.grid(True)
ax2.set_ylim( (-2,2) )
l = ax2.set_xlabel('Hi mom')
l.set_color('g')
l.set_fontsize('large')
win = gtk.Window()
win.set_default_size(800,600)
win.set_title("Plotting in a GTK Window")
win.connect("destroy", lambda x: gtk.main_quit())
vbox = gtk.VBox()
canvas = FigureCanvas(fig)
vbox.pack_start(canvas)
win.add(vbox)
win.show_all()
gtk.main()
#show()
-------------
With dpi=100 (the value in my .matplotlibrc),
win.set_default_size(800,600) makes the size consistent with
'figure.figsize : 8, 6 ' in my .matplotlibrc and the plots are indeed
the same size. Note I also explicitly set antialiased=True and
linewidth=0.5 in the plot method calls to be consistent with my rc file.
Compared to the original example, with embedding the sine waves plot
jaggy, the border around the plot is not as bold, and the text is
(slightly) bigger. Am I hallucinating or is there something else
affecting the plot attributes? Thanks for any feedback.
Jeff Orrey
-----Original Message-----
From: John Hunter [mailto:jdh...@ac...]
Sent: Tuesday, April 26, 2005 9:21 AM
To: Jeffrey Orrey
Cc: Jeff Whitaker; mat...@li...
Subject: Re: plot resolution discrepancy when embedding basemap in gtk
>>>>> "Jeffrey" == Jeffrey Orrey <Jef...@ve...> writes:
Jeffrey> Hi all, I'm embedding a map in a gtk window using Jeff
Jeffrey> Whitaker's nice Basemap package. The map is not as crisp
Jeffrey> when embedding it as it is when simply rendering into a
Jeffrey> figure() using the matplotlib gtkagg backend. It appears
Jeffrey> as if a discretization problem is making lines,
Jeffrey> especially fine dotted ones, much coarser in the gtk
Jeffrey> window.
Jeffrey> Has anyone encountered such a resolution discrepancy when
Jeffrey> plotting in a gtk window versus simply using figure()?
Jeffrey> I'm using matplotlib 0.80 and basemap 0.3.1 on Linux with
Jeffrey> Python 2.3.4.
All figure does in the gtkagg backend is embed the agg image in a gtk
window, just as you are doing. The only possible cause for the problem
you report is that figure respects the figsize and dpi rc settings and
so may be making the figure bigger, eg higher resolution.
Try tweaking the Figure dpi and figsize settings, and make sure you
choose win.set_default_size intelligently. Here is how the gtk figure
manager does it
w = int (self.canvas.figure.bbox.width())
h = int (self.canvas.figure.bbox.height())
self.window.set_default_size (w, h)
Note also, there is an error here
from pylab import figure
from matplotlib.backends.backend_gtkagg import FigureCanvasGTK as
FigureCanvas
Do not import pylab if you are using the object interface. Use
matplotlib.figure.Figure instead of pylab.figure.
Don't do this either:
from pylab import *
See http://matplotlib.sourceforge.net/faq.html#OO
Hope this helps,
JDH
|
|
From: Jeffrey J. <Jef...@gs...> - 2005-04-27 18:07:35
|
I installed matplotlib on Mac OS X using fink. I get a warning message every time I run one of the examples: `GtkTextSearchFlags' is not an enum type Other than that the examples appear to work. Did I miss something, or is there a problem with the fink installation? Jeff Jones |
|
From: Darren D. <dd...@co...> - 2005-04-27 18:01:58
|
Hi Steve, On Wednesday 27 April 2005 1:39 pm, steve schmerler wrote: > Hi > > I like MPL very much since I'm used to MATLAB and it's fantastic plotting > features but I have 3 little issues (most likely newbie stuff :) to solve. > > 1.) > To change the backend interactively the MPL homepage suggests something > like > > import matplotlib > from pylab import * > matplotlib.use(<backend-name-string>) > plot(...); show() > > But I found that whatever backend I tell MPL to use, it always uses the one > defined in my .matplotlibrc. > If you saw this on the website, it is an error. (I could not find it myself.) You need to do import matplotlib matplotlib.use(<backend-name-string>) from pylab import * plot(...); show() > > 2.) > When I start my Python shell (IPython, WinXP) and use MPL the 1st time in > the session > > from pylab import * > plot(...); show() > > the plot window appears but I'm not able to type anything in the shell. I > close the plot window and > > plot(...); show() > > again. From now on I'm able to type in the shell. What's up? This is due to the interactive nature of MPL. By default, interactive mode is off, to improve performance in scripts. Have you looked into IPython as an alternative to the interactive python interpretter? (Its not really a shell, by the way.) If you dont want to use IPython, try this before you import pylab import matplotlib matplotlib.interactive(True) from pylab import * > > > 3.) > I tried to plot a data set with 1024 points (shape(x) = shape(y) = > (1024,)). > > plot(x,y) > > which takes about 4 seconds to build up the plot (at least with the TkAgg > backend). This is far to slow for me. What can I do? I'll have to defer to the MPL overlords on this one, I dont know enough to answer well. -- Darren S. Dale Bard Hall Department of Materials Science and Engineering Cornell University Ithaca, NY. 14850 dd...@co... |
|
From: John H. <jdh...@ac...> - 2005-04-27 17:57:44
|
>>>>> "steve" == steve schmerler <el...@gm...> writes:
steve> Hi I like MPL very much since I'm used to MATLAB and it's
steve> fantastic plotting features but I have 3 little issues
steve> (most likely newbie stuff :) to solve.
steve> 1.) To change the backend interactively the MPL homepage
steve> suggests something like
steve> import matplotlib from pylab import *
steve> matplotlib.use(<backend-name-string>) plot(...); show()
First, you need to assess whether you really need to change the
backend interactively. Eg, if you are using tkagg and call
savefig('myfile.eps') # uses ps
savefig('myfile.svg) # uses svg
Ie, matplotlib will do the backend switching for you in the most
common use cases.
Now if you really do need to change the default backend interactively,
use the experimental pylab function switch_backend
http://matplotlib.sf.net/matplotlib.pylab.html#-switch_backend
steve> But I found that whatever backend I tell MPL to use, it
steve> always uses the one defined in my .matplotlibrc.
matplotlib.use must be called before the pylab import, and will have
no effect after the import.
steve> 2.) When I start my Python shell (IPython, WinXP) and use
steve> MPL the 1st time in the session
steve> from pylab import * plot(...); show()
steve> the plot window appears but I'm not able to type anything
steve> in the shell. I close the plot window and
steve> plot(...); show()
steve> again. From now on I'm able to type in the shell. What's
steve> up?
You need to start ipython with -pylab option, and then 1) you do not
need to import pylab and 2) you do not need to call show. ipytohn
will read your rc file and do the right thing. See
http://matplotlib.sourceforge.net/interactive.html
and
http://matplotlib.sourceforge.net/faq.html#SHOW
and the ipython manual.
steve> 3.) I tried to plot a data set with 1024 points (shape(x)
steve> = shape(y) = (1024,)).
steve> plot(x,y)
steve> which takes about 4 seconds to build up the plot (at least
steve> with the TkAgg backend). This is far to slow for me. What
steve> can I do?
Are you running on a 486? :-) Are you properly measuring the plot
times versus startup times for python, etc? Maybe the fact that you
are mixing up interactive and non-interactive commands above is
causing you some problems? On my system, to plot 1024 circles takes
0.07 seconds for gtkagg and 0.18 seconds for tkagg. This time
includes creating the new x and y arrays on each iteration as well as
plotting them.
Here is the script I measured these times with , which I ran from
ipython using 'run myscript.py'
import pylab
import time
pylab.ion()
start = time.time()
fig = pylab.figure()
N = 20
for i in range(20):
fig.clear()
ax = fig.add_subplot(111)
x = pylab.rand(1024)
y = pylab.rand(1024)
ax.plot(x, y, 'o')
pylab.draw()
print (time.time() - start)/N
pylab.show()
I'm running on a 3GHz Pentium 4 under linux.
JDH
|
|
From: steve s. <el...@gm...> - 2005-04-27 17:39:51
|
Hi I like MPL very much since I'm used to MATLAB and it's fantastic plotting features but I have 3 little issues (most likely newbie stuff :) to solve. 1.) To change the backend interactively the MPL homepage suggests something like import matplotlib from pylab import * matplotlib.use(<backend-name-string>) plot(...); show() But I found that whatever backend I tell MPL to use, it always uses the one defined in my .matplotlibrc. 2.) When I start my Python shell (IPython, WinXP) and use MPL the 1st time in the session from pylab import * plot(...); show() the plot window appears but I'm not able to type anything in the shell. I close the plot window and plot(...); show() again. From now on I'm able to type in the shell. What's up? 3.) I tried to plot a data set with 1024 points (shape(x) = shape(y) = (1024,)). plot(x,y) which takes about 4 seconds to build up the plot (at least with the TkAgg backend). This is far to slow for me. What can I do? Cheers, Steve -- Man is the best computer we can put aboard a spacecraft ... and the only one that can be mass produced with unskilled labor. - Wernher von Braun |
|
From: John H. <jdh...@ac...> - 2005-04-27 16:48:18
|
>>>>> "Ted" == Ted Drain <ted...@jp...> writes:
Ted> I just had a user ask me if the matlab function datetick
Ted> exists in MPL. I don't believe that it does so I was
Ted> wondering if anyone had written their own implementation of
Ted> it?
Ted> Here's the help text from the matlab web site:
Ted> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/datetick.html
As far as I know, it does not exist and would be useful. The
tick locators and formatters are cumbersome for many users, and if a
simple function encapsulated their function that would be helpful.
Fire when ready.
JDH
|
|
From: Stephen W. <ste...@cs...> - 2005-04-27 16:47:48
|
Ted Drain wrote: > I just had a user ask me if the matlab function datetick exists in MPL. Check out plot_date(). Far more flexible than datetick(), IMHO. There are four date_demo*.py files in matplotlib/examples. See also section 5.4 of the on line manual. For the non-MPL users, datetick() actually changes the labeling on an axis from MATLAB numerical dates to various date formats. |
|
From: John H. <jdh...@ac...> - 2005-04-27 16:44:43
|
>>>>> "Perry" == Perry Greenfield <pe...@st...> writes:
Perry> One of the questions to be answered is how we handle 3-d
Perry> axes and their labeling. I doubt (John may differ on this)
Perry> that we want to go into fancy 3-d character sets and such,
Perry> but it may be possible to do simple transforms on fonts to
Perry> make them look like they lay on the appropriate plane.
Now that we can get the glyph vertices from agg/freetype, transforming
them with a 4x4 matrix should be easy enough.....
We've spent a lot of time talking about how to implement 3D (vtk,
opengl, do the work ourselves in software and render it in 2D) but I
am beginning to think this is the wrong discussion. We should just
provide the front-end infrastructure which holds the data and
transformations (Axes3D, Line3D, Poly3D, etc) and then let different
3D engines/backends handle the rendering, just as we do for 2D. Of
course, one nuance is that the 3D renderer must render into the canvas
which may also have 2D stuff in it, but I think this could be done via
a bitmap transfer as Randy did for his proof-of-concept VTK/Agg demo,
with an acceptable performance cost for most uses. The basic idea is
that I don't think we need to commit to a 3D engine, we just need to
set up the frontend API correctly.
We should probably write up a semi-official pep for discussion, just
to make sure the ideas are solid. Andrew has started on such a beast
but has yet to let anyone see it :-)
One open question is do we define new primitive types (Line3D, Poly3D,
Text3D)? Doing so has the advantage of leaving the tried and true 2D
stuff alone and does not impose extra memory or performance costs on
the 2D side. But it creates multiple points of maintenance, etc...
Another question: would it suffice to simply add a few new methods to
the backend renderer, draw_line3d to complement draw_line,
draw_polygon3d to complement draw_polygon, and so on. One might be
able to then create mixin renderers, composing agg with say pyopengl
to provide the 2D and 3D rendering respectively. Somehow this seems
too easy, so it must be a stupid idea.
JDH
|
|
From: John H. <jdh...@ac...> - 2005-04-27 15:33:20
|
>>>>> "Werner" == Werner Pessenhofer <w.p...@tu...> writes:
Werner> If my thoughts are right, this would return to beginning
Werner> of colors if the last one is arrived.
The code in the original example already does that
plot(x,y,'-'+colors[ind % len(colors)])
Note that ind % len(colors) never reaches len(colors), but cycles
>>> N = 5
>>> for i in range(12): print i%N
...
0
1
2
3
4
0
1
2
3
4
0
JDH
|
|
From: Tim L. <ti...@cs...> - 2005-04-27 15:18:07
|
On Wed, 27 Apr 2005, ra...@gm... <ra...@gm...> wrote... > > You can turn interactive mode on and off where desired with pylab.ion > > and pylab.ioff (to suppress draws for a sequence of figure updates) > > and explicitly draw where desired with pylab.draw. > > Now that explicit control is necessary with draw(), could we go one step > further and ask for just one figure/subplot to be updated with the pythonic > API? Perhaps something along the lines of the following: > > myFigure = pylab.figure() > myPlot1 = myfigure.add_subplot(2,1,1) > myPlot2 = myfigure.add_subplot(2,1,2) > doSetup() > for x in arange(y): > z = doSomething() > myPlot1.plot(...) > myPlot1.drawNow() # New API > if hokeyRareCondition: > myPlot2.plot(...) > myPlot2.drawNow() # New API > > I see that there is a function in the figure API for drawing to a renderer but > I do not know how to use it to get the drawNow() effect. Could I +1 this as a request. I had a look into trying to do this myself but got down to the level of renderers and decided to leave it alone, since it's not really critical to me, just a nice feature if it existed. Cheers, Tim > > Regards, > Ravi > > > ------------------------------------------------------- > SF.Net email is sponsored by: Tell us your software development plans! > Take this survey and enter to win a one-year sub to SourceForge.net > Plus IDC's 2005 look-ahead and a copy of this survey > Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > `- |
|
From: Perry G. <pe...@st...> - 2005-04-27 15:10:52
|
On Apr 27, 2005, at 9:58 AM, John Hunter wrote: > The plotting part for a 2D hist would be fairly easy (as a pcolor or > image). Is there no Nd histogram function in scipy or numarray? > Turns out that given a 1-d histogram function, it's pretty straightforward to write a reasonably efficient n-d function in Python using it in a few lines of code. I thought numarray had one (perhaps in the image stuff) but I'll have to check, scipy I thought did as well. Perry |
|
From: <ra...@gm...> - 2005-04-27 15:07:16
|
On Tuesday 26 April 2005 05:26 pm, John Hunter wrote:
> Fernando and I made a conscious choice to turn off interactive mode
Fair enough, but the change needs to be documented as such either in the
ipython manual or in the matplotlib changelog.
> You can turn interactive mode on and off where desired with pylab.ion
> and pylab.ioff (to suppress draws for a sequence of figure updates)
> and explicitly draw where desired with pylab.draw.
Now that explicit control is necessary with draw(), could we go one step
further and ask for just one figure/subplot to be updated with the pythonic
API? Perhaps something along the lines of the following:
myFigure = pylab.figure()
myPlot1 = myfigure.add_subplot(2,1,1)
myPlot2 = myfigure.add_subplot(2,1,2)
doSetup()
for x in arange(y):
z = doSomething()
myPlot1.plot(...)
myPlot1.drawNow() # New API
if hokeyRareCondition:
myPlot2.plot(...)
myPlot2.drawNow() # New API
I see that there is a function in the figure API for drawing to a renderer but
I do not know how to use it to get the drawNow() effect.
Regards,
Ravi
|
|
From: John H. <jdh...@ac...> - 2005-04-27 14:59:48
|
>>>>> "Eric" == Eric Emsellem <ems...@ob...> writes:
Eric> Hi, I found an odd problem with "legend". I get the right
Eric> labels/text but not the "small colour bars" associated to
Eric> them. There is something I must do wrong..
Eric> Here is a fake example:
Eric> Thanks for any input on this!
There are two problems with your example
pa1 = hist(arange(1,100,1), bins=arange(0,100,10))
pa2 = hist(arange(1,100,1), bins=arange(0,100,10))
clf()
matplotlib provides a "no plot" hist function in matplotlib.mlab. So
rather than calling the pylab hist (which plots) and then clearing the
figure with clf (you forgot the parentheses of clf, btw), call
matplotlib.mlab.hist which computes the histogram but doesn't plot.
width = 5 # the width of the bars
p1 = bar(pa1[1], pa1[0], width, color='r')
p2 = bar(pa2[1]+width, pa2[0], width, color='y')
The above code is OK.
legend([pa1[0], pa2[0]], ["$r_e/5$", "$r_e/2.5$"], shadow=True)
This is the second problem. pa1 and pa2 in your example are the
return values from pylab hist, which is (n, bins, patches). You need
to pass the patches returned by the bar command, eg p1[0], p2[0]
Here is the recommended way:
from pylab import *
import matplotlib.mlab # provides hist w/o plot
n1, bins1 = matplotlib.mlab.hist(arange(1,100,1), bins=arange(0,100,10))
n2, bins1 = matplotlib.mlab.hist(arange(1,100,1), bins=arange(0,100,10))
width = 5 # the width of the bars
p1 = bar(bins1, n1, width, color='r')
p2 = bar(bins1+width, n2, width, color='y')
legend([p1[0], p2[0]], ["$r_e/5$", "$r_e/2.5$"], shadow=True)
show()
Should help!
JDH
|
|
From: Ted D. <ted...@jp...> - 2005-04-27 14:49:49
|
I just had a user ask me if the matlab function datetick exists in MPL. I don't believe that it does so I was wondering if anyone had written their own implementation of it? Here's the help text from the matlab web site: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/datetick.html --------------- datetick Label tick lines using dates Syntax datetick(tickaxis) datetick(tickaxis,dateform) datetick(...,'keeplimits') datetick(...,'keepticks') datetick(axes_handle,...) Description datetick(tickaxis) labels the tick lines of an axis using dates, replacing the default numeric labels. tickaxis is the string 'x', 'y', or 'z'. The default is 'x'. datetick selects a label format based on the minimum and maximum limits of the specified axis. [...] --------------- If no one has an existing implementation we'll probably write one ourselves. Thanks, Ted Ted Drain Jet Propulsion Laboratory ted...@jp... |
|
From: Eric E. <ems...@ob...> - 2005-04-27 14:06:57
|
Hi, I found an odd problem with "legend". I get the right labels/text but not the "small colour bars" associated to them. There is something I must do wrong.. Here is a fake example: =========== pa1 = hist(arange(1,100,1), bins=arange(0,100,10)) pa2 = hist(arange(1,100,1), bins=arange(0,100,10)) clf width = 5 # the width of the bars p1 = bar(pa1[1], pa1[0], width, color='r') p2 = bar(pa2[1]+width, pa2[0], width, color='y') legend([pa1[0], pa2[0]], ["$r_e/5$", "$r_e/2.5$"], shadow=True) ============ Thanks for any input on this! Eric -- =============================================================== Observatoire de Lyon ems...@ob... 9 av. Charles-Andre tel: +33 4 78 86 83 84 69561 Saint-Genis Laval Cedex fax: +33 4 78 86 83 86 France http://www-obs.univ-lyon1.fr/eric.emsellem =============================================================== |
|
From: Perry G. <pe...@st...> - 2005-04-27 14:00:00
|
Hi Eric, We've been talking about doing such things with John over the past few months but with no specific plans at the moment. I think the current fallback is to refer people to using VTK or one of the Python toolsets built on VTK for 3d plotting. Since VTK is such a big package we do understand the need for adding more basic 3d tools to matplotlib (though it naturally raises the question of where to draw the line; we don't want to re-implement VTK or any substantial fraction of it!). This includes surface and scatter plots (though I hadn't considered 2-d histograms--but these are essentially variants of surface plots). I'm not sure what you have in mind for higher dimensionality histograms. One of the questions to be answered is how we handle 3-d axes and their labeling. I doubt (John may differ on this) that we want to go into fancy 3-d character sets and such, but it may be possible to do simple transforms on fonts to make them look like they lay on the appropriate plane. On Apr 27, 2005, at 2:55 AM, Eric Emsellem wrote: > Hi, > I recently sent a mail to matplotlib-users regarding the availability > of 3 axes plots and histograms in 2/N D and got no feedback. > I understand this may not be a very exciting issue but if anybody has > any input there (see below), it would be welcome. Thanks in advance!! > > cheers > > Eric > ============================================= > 3 axes plot > ======== > The more I am using matplotlib, the more I like it. But using it more > means I more often hit the limits of the code, so I was wondering if > there is any plan for a routine to plot data points w.r.t 3 axes (so a > perspective scatter plot with x,y,z, data and a viewing angle). Of > course another (maybe more difficult) goal would be to be able to draw > surfaces, but already a simple scatter plot in 3D would help > tremendously there (I realize the concept of "axis" has then to be > revised, but well I have no idea how much effort this is). > > (if there is no - coming - plan for this, is there any way around it?) > > histograms > ======== > I would like to produce histograms in N dimensions, the minimum being > in 2D. > Here is an example of what I wish to do: > > I have a set of P particles with x and y positions. > I have a rectangular grid, defined by e.g. a sampling in x and a > sampling in y, (e.g. samp_x=arange(-15,31,1) ..), and I wish to know > how many particles are in each "pixel". > > I can do that in many different ways (using searchsorted from > numarray, or abruptly using loops, etc) but I am now looking for a > simple (fewer lines) and efficient way (as I am treating large sets of > particles) to do this so that I would be able to use a function like: > > histogram_2D(x,y, samp_x, samp_y) would return a matrix with the > number of particles in each corresponding pixel. > > and > > showhistogram_2D(x,y, samp_x, samp_y) would display it > [using e.g. imshow or matshow] > > Any hint there (I realize this is more a numarray question but I > thought of first asking your community first since someone may have > done it already)? And maybe also of how to generalize this in N > dimensions? (for 1D matplotlib has the hist function..) > |
|
From: John H. <jdh...@ac...> - 2005-04-27 13:58:34
|
>>>>> "Eric" == Eric Emsellem <ems...@ob...> writes:
Eric> Hi, I recently sent a mail to matplotlib-users regarding the
Eric> availability of 3 axes plots and histograms in 2/N D and got
Eric> no feedback. I understand this may not be a very exciting
Eric> issue but if anybody has any input there (see below), it
Eric> would be welcome. Thanks in advance!!
I was out of the country and my mail server died, so I missed some
messages...
Eric> Eric ============================================= 3 axes
Eric> plot ======== The more I am using matplotlib, the more I
Eric> like it. But using it more means I more often hit the limits
Eric> of the code, so I was wondering if there is any plan for a
Eric> routine to plot data points w.r.t 3 axes (so a perspective
Eric> scatter plot with x,y,z, data and a viewing angle). Of
Eric> course another (maybe more difficult) goal would be to be
Eric> able to draw surfaces, but already a simple scatter plot in
Eric> 3D would help tremendously there (I realize the concept of
Eric> "axis" has then to be revised, but well I have no idea how
Eric> much effort this is).
Eric> (if there is no - coming - plan for this, is there any way
Eric> around it?)
There is a lot of interest in this -- at least three of the developers
besides me have expressed interest in working on this, so hopefully we
can get something going. Maybe sometime this summer...
Eric> Any hint there (I realize this is more a numarray question
Eric> but I thought of first asking your community first since
Eric> someone may have done it already)? And maybe also of how to
Eric> generalize this in N dimensions? (for 1D matplotlib has the
Eric> hist function..)
The plotting part for a 2D hist would be fairly easy (as a pcolor or
image). Is there no Nd histogram function in scipy or numarray?
JDH
|
|
From: John H. <jdh...@ac...> - 2005-04-27 13:45:46
|
>>>>> "Darren" == Darren Dale <dd...@co...> writes:
>> With savefig("Spektren-CuP.ps",orientation="landscape"), the
>> diagram do not fill the whole a4 page. I think, this is related
>> to some configuration values, cause the resulting figure is not
>> an a4 page but a BBox. Any hints where to change that ?
Darren> In your Spektren-CuP.ps, try adding "%%DocumentPaperSizes:
Darren> A4" after the line that says "%%Orientation: landscape",
Darren> hopefully that can get you by while I work on a real
Darren> solution.
You will also need to change the default paper size in backend ps
before using it
import matplotlib.backends.backend_ps as ps
ps.defaultPaperSize = 8.26771, 11.69291 # A4 width and height in inches
import pylab
...and now make your plot...
Darren and I were discussing making this an rc parameter, so hopefully
this will be easier in the next release.
JDH
|
|
From: Dr. W. P. <w.p...@tu...> - 2005-04-27 13:12:55
|
Thanks for the idea !
Meanwhile I've improved it somewhat:
ylen =3D shape(Ximport)[1]
colors =3D ["r", "g", "b", "k", "y", "c", "m"] # And Others
counter =3D 0
ind =3D 1
for ind in range(1, ylen, 2):
Y =3D take(X,(0,ind), 1)
x =3D Y[:,0]
y =3D Y[:,1]
plot(x,y,colors[counter]+'-')
if counter < 5:
counter =3D counter + 1
else:
counter =3D 0
If my thoughts are right, this would return to beginning of colors if the=
=20
last one is arrived.
Regards
Werner
On Wed, 27 Apr 2005 14:50:49 +0200, <and...@ti...> wrote:
> Hello Werner,
>
>> The first problem is, that all curves have the same color. Is there a
>
>> possibility to "rotate" the colors in the loop ?
>
>> while ind < 18:
>> Y =3D take(X,(0,ind), 1)
>> x =3D Y[:,0]
>> y =3D Y[:,1]
>> plot(x,y,'-')
>> ind =3D ind + 2
>>
>
> You could try something like:
>
> colors =3D ["r", "g", "b", "k", "y", "c", "m"] # And Others
>
> counter =3D 0
>
> while ind < 18:
> Y =3D take(X,(0,ind), 1)
> x =3D Y[:,0]
> y =3D Y[:,1]
> plot(x,y,colors[counter] + '-')
> counter =3D counter + 1
> ind =3D ind + 2
>
>
> Sorry, don't know for the second one...
>
> HTH.
>
> Andrea.
>
--=20
DI Dr. Werner Pessenhofer
CPA - Computer Process Automation
Pl=FCddemanngasse 33
8010 Graz
Tel.: +43 (0) 676 346 70 08
FAX: +43 (0) 316 873 8772
|
|
From: Darren D. <dd...@co...> - 2005-04-27 11:44:39
|
Hi Dr. Pessenhofer,
On Wednesday 27 April 2005 4:12 am, Dr. Werner Pessenhofer wrote:
> ____________________________________________________
>
> #!/usr/bin/python
> #-*- coding: UTF-8 -*-
>
> =A0from pylab import *
>
> X =3D load('Spektren-CuP-conv.dat',comments=3D'#')
>
> hold(True)
>
> xlabel(r'$\rm{Wellenl\"ange / nm}$')
> ylabel('Extinktion')
> title('Spektren CuP')
>
> ind =3D 1
> while ind < 18:
> =A0 =A0 =A0Y =3D take(X,(0,ind), 1)
> =A0 =A0 =A0x =3D Y[:,0]
> =A0 =A0 =A0y =3D Y[:,1]
> =A0 =A0 =A0plot(x,y,'-')
> =A0 =A0 =A0ind =3D ind + 2
>
> savefig("Spektren-CuP.ps",orientation=3D"landscape")
>
> show()
> ________________________________________________________
>
> The first problem is, that all curves have the same color. Is there a
> possibility to "rotate" the colors in the loop ?
You could change plot(x,y,'-') to =A0plot(x,y). It will default to the '-'=
=20
linestyle, and matplotlib will cycle the colors for you. Also, the examples=
=20
include a script called line_styles.py with this suggestion:
colors =3D ('b', 'g', 'r', 'c', 'm', 'y', 'k')
ind =3D 1
while ind < 18:
Y =3D take(X,(0,ind), 1)
x =3D Y[:,0]
y =3D Y[:,1]
plot(x,y,'-'+colors[ind % len(colors)])
ind =3D ind + 2
>
> Second question:
>
> With savefig("Spektren-CuP.ps",orientation=3D"landscape"), the diagram do
> not fill the whole a4 page. I think, this is related to some configuration
> values, cause the resulting figure is not an a4 page but a BBox. Any hints
> where to change that ?
In your Spektren-CuP.ps, try adding "%%DocumentPaperSizes: A4" after the li=
ne=20
that says "%%Orientation: landscape", hopefully that can get you by while I=
=20
work on a real solution.
=2D-=20
Darren S. Dale
Bard Hall
Department of Materials Science and Engineering
Cornell University
Ithaca, NY. 14850
dd...@co...
|