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
(13) |
2
(11) |
3
(2) |
|
4
(4) |
5
(28) |
6
(17) |
7
(28) |
8
(6) |
9
(6) |
10
|
|
11
|
12
(9) |
13
(13) |
14
(21) |
15
(16) |
16
(6) |
17
(3) |
|
18
(3) |
19
(8) |
20
(15) |
21
(33) |
22
(10) |
23
(17) |
24
(2) |
|
25
(5) |
26
(23) |
27
(18) |
28
(6) |
|
|
|
|
From: Eric F. <ef...@ha...> - 2007-02-12 19:57:14
|
Jouni K. Seppänen wrote:
> "Mika Orajärvi" <mik...@gm...> writes:
>
>> This code does seem to draw some kind of histogram but it would be
>> much more usefull to have at least the y-scale as logarithmic. But I
>> haven't found a way to make the scale logarithmic.
>
> According to the docstring of hist you can give it a keyword argument
> of log=True to make the y axis logarithmic. However there is a slight
> bug in that zero-height histogram bars like you have in your example
> cause log(0) to be computed. Here's a quick fix:
>
> ------------------------------------------------------------------------
> from pylab import *
> x=0.000925,0.000879,0.000926,0.00088,0.001016,0.000931,0.000927,0.00088,\
> 0.000926,0.000926,0.000879,0.0009
> n, bins = mlab.hist(x, 1000)
> width = 0.9 * (bins[1]-bins[0])
> nz = nonzero(n)
> bar(bins[nz], n[nz], width=width, log=True)
> grid(True)
> show()
> ------------------------------------------------------------------------
>
> If the devs agree that this is a bug in hist, I can fix it in svn.
>
I think it is already fixed. This works (drawing a sensible bar plot
with a log scale despite bins with zero):
In [3]:hist(rand(10), log=True)
Out[3]:
(array([1, 0, 3, 1, 0, 1, 2, 1, 0, 1]),
array([ 0.00863515, 0.10200932, 0.19538349, 0.28875767, 0.38213184,
0.47550601, 0.56888018, 0.66225435, 0.75562852, 0.84900269]),
<a list of 10 Patch objects>)
Eric
|
|
From: John H. <jd...@gm...> - 2007-02-12 16:30:29
|
On 2/12/07, Matthias Michler <Mat...@gm...> wrote: > I'm trying something interactive using matplotlib with several subplots. > My problem is that when using 'ax.plot' more than one 'draw()' command is > needed to redraw the whole figure. > So my question is: What are the differences in using 'plot' and 'ax.plot'? The pylab.plot command is a simple wrapper of the ax.plot command with a small difference. It forces a draw if you have turned interactive mode on. JDH |
|
From: <jk...@ik...> - 2007-02-12 15:11:31
|
"Mika Orajärvi" <mik...@gm...> writes: > This code does seem to draw some kind of histogram but it would be > much more usefull to have at least the y-scale as logarithmic. But I > haven't found a way to make the scale logarithmic. According to the docstring of hist you can give it a keyword argument of log=True to make the y axis logarithmic. However there is a slight bug in that zero-height histogram bars like you have in your example cause log(0) to be computed. Here's a quick fix: ------------------------------------------------------------------------ from pylab import * x=0.000925,0.000879,0.000926,0.00088,0.001016,0.000931,0.000927,0.00088,\ 0.000926,0.000926,0.000879,0.0009 n, bins = mlab.hist(x, 1000) width = 0.9 * (bins[1]-bins[0]) nz = nonzero(n) bar(bins[nz], n[nz], width=width, log=True) grid(True) show() ------------------------------------------------------------------------ If the devs agree that this is a bug in hist, I can fix it in svn. -- Jouni K. Seppänen http://www.iki.fi/jks |
|
From: Matthias M. <Mat...@gm...> - 2007-02-12 12:16:14
|
Hi Mika,=20
Hi everybody,
I'm not sure I really understand your problem, but I attached my proposal /=
=20
solution, so you can think about it or maybe describe your problem once mor=
e.
Much success,
Matthias Michler
>--------------------------------------------------------------------------=
=2D-----------------------
from pylab import figure, subplot, grid, close, show,\
hist, plot, semilogy, nonzero
x =3D 0.000925, 0.000879, 0.000926, 0.00088, 0.001016, 0.000931, 0.000927, \
0.00088, 0.000926, 0.000926, 0.000879, 0.0009
figure(0) # make histogram in figure 0
n, bins, patches =3D hist(x, 1000, align=3D'center')
close(0) # close figure to delete plot
# instance of hist
index =3D nonzero(n) # to solve problems mit zero
# values in log scale
figure(1)
ax =3D subplot(111)
ax.set_yscale('log')
l1 =3D plot(bins[index], n[index], ls=3D'',marker =3D'x', ms=3D15, mew=3D3,=
c=3D'r')
grid(True)
figure(2)
l2 =3D semilogy(bins[index], n[index], ls=3D'',marker =3D'x', ms=3D15, mew=
=3D3, c=3D'r')
grid(True)
show()
>--------------------------------------------------------------------------=
=2D------------------------
On Tuesday 06 February 2007 15:33, Mika Oraj=E4rvi wrote:
> Hi!
> I'm trying to generate some kind of "distribution" view / histogram
> of decimal numbers, i.e. i want the graph to indicate exactly how many
> times any given decimal number occurs in "x". As an example, i've set the
> values to tuple "x" as seen in the code snipplet below. In reality there
> will be at least couple of thousand decimal values or more in the tuple (x
> in this example) and values will be retrieved from file etc. This code do=
es
> seem to draw some kind of histogram but it would be much more usefull to
> have at least the y-scale as logarithmic. But I haven't found a way to ma=
ke
> the scale logarithmic. I've tried to use semilogy/semilogx/loglog but with
> no success.
>
> ---------------
> x=3D0.000925,0.000879,0.000926,0.00088,0.001016,0.000931,0.000927,0.00088,
> 0.000926,0.000926,0.000879,0.0009
> n, bins, patches =3D hist(x, 1000)
> l =3D plot(bins, n, 'r--')
> grid(True)
> show()
> ----------------
>
> regards, Mika
|
|
From: Derek H. <DH...@cs...> - 2007-02-12 10:25:50
|
Sture Did you look in the mail archive - there is a thread titled: " x-axis Label in hh:mm:ss format" which addresses this. Derek >>> Sture Lygren <st...@ro...> 2007/02/12 12:14:26 PM >>> Hi, Been reading the docs but couldn't find an easy solution for this one ... I've got a dataset containing dates and measurement (['2006-12-26 00:00:10','2006-12-26 00:00:20',...], [10.1722,7.99665,...]). Converting dates using time.strptime, datetime and date2num I end up with this dataset ([732671.000116,732671.000231,...],[10.1722,7.99665,...]) Question now is - how can I plot this set with x-axis ticks showing '00:00:00','00:00:10' and so on? The dataset spans 24 hours of measurements - how, if at all possible, do I specify major ticks for every 6 hour? Help is much appreciated! regards, Sture ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- This message is subject to the CSIR's copyright, terms and conditions and e-mail legal notice. Views expressed herein do not necessarily represent the views of the CSIR. CSIR E-mail Legal Notice http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html CSIR Copyright, Terms and Conditions http://mail.csir.co.za/CSIR_Copyright.html For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR Legal Notice send a blank message with REQUEST LEGAL in the subject line to Cal...@cs.... This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. |
|
From: Sture L. <st...@ro...> - 2007-02-12 10:14:31
|
Hi, Been reading the docs but couldn't find an easy solution for this one ... I've got a dataset containing dates and measurement (['2006-12-26 00:00:10','2006-12-26 00:00:20',...], [10.1722,7.99665,...]). Converting dates using time.strptime, datetime and date2num I end up with this dataset ([732671.000116,732671.000231,...],[10.1722,7.99665,...]) Question now is - how can I plot this set with x-axis ticks showing '00:00:00','00:00:10' and so on? The dataset spans 24 hours of measurements - how, if at all possible, do I specify major ticks for every 6 hour? Help is much appreciated! regards, Sture |
|
From: Matthias M. <Mat...@gm...> - 2007-02-12 09:50:24
|
Hello everybody,
I'm trying something interactive using matplotlib with several subplots.
My problem is that when using 'ax.plot' more than one 'draw()' command is
needed to redraw the whole figure.
So my question is: What are the differences in using 'plot' and 'ax.plot'?
>---------------------------------------------------------------------------------------------------
import pylab as P
x = P.linspace(0, 1, 100)
P.ion()
P.figure()
ax = P.subplot(111)
ax.plot(x, P.sqrt(x), label = r"$f(x) = \sqrt x$")
P.plot(x, x, label = r"$f(x) = x$")
> everything before here is shown after the draw() below
ax.plot(x, x**2, label = r"$f(x) = x^2$")
ax.legend(loc = 'best')
P.draw()
#P.draw()
> the second draw lets the remaining graphs and the legend
> before the raw_input occur
raw_input(" <return>")
P.ioff()
P.show()
>----------------------------------------------------------------------------------------------------------
Thanks in advance,
Matthias Michler
|
|
From: Anand P. <an...@so...> - 2007-02-12 02:23:07
|
Hi all, When using CocoaAgg, I get this error message, Python hangs up, and no figure appears: In [1]: from pylab import * In [2]: A=zeros(10) In [3]: plot(A) Out[3]: [<matplotlib.lines.Line2D instance at 0x3fb48a0>] In [4]: show() 2007-02-11 18:16:49.244 Python[1833] *** NSThread: ignoring exception '*** -[NSKeyedUnarchiver decodeObjectForKey:]: missing class information for object' that raised during delayed perform of target 0x400f950 and selector 'startWithBundle:' I'm using Python 2.4.3 on OS X 10.4, PPC. Thanks in advance for any help, Anand Patil |
|
From: Eric F. <ef...@ha...> - 2007-02-09 19:01:59
|
Claas Teichmann wrote: > Hi Eric, > > Great that it works!! This is what I was looking for! > > There is one thing left, which is that the tick labels are not exactly > at the boundary between the colors. (It is no problem for me, but I am > interested where it comes from). The script below shows that the > colorswitch is not exactly at an "even" number. The values > -0.022000001 and -0.022 are colored with the same color, whereas > -0.02200001 has a different color. I don't know whether this is the > reason for the ticks not beeing exactly at the intersection..? When I run the script below I don't see what you are describing above; but I may not be looking in the right place, and it would not surprise me if there are little anomalies like this, because we are dealing with floating point arithmetic. I do see (and had noticed before) that the colorbar ticks look a tiny bit high. I don't know whether this is a bug or whether it is a consequence of the fact that colors are assigned to ranges that include the lower limit but not the upper limit, and/or floating point arithmetic, and/or the resolution of the display. Or it may be because of some floating point fudge factors that I put into the colorbar code. Maybe these could be improved. Eric |
|
From: Giorgio G. <gi...@gi...> - 2007-02-09 18:26:16
|
Dear matplotlib users, I am a new enthusiastic member of the matplotlib community. I'll start up my frequentation in the ml with two questions for which I couldn't find an answer; the first one is relatively tricky while the second one should be quite straigthforward. Both are, I believe, of general interest. 1) I use matplotlib and the wxmpl library to wrap the graphs in a notebook page of a wxpython application. My canvas is a wxmpl.PlotPanel which is a derivation of FigureCanvasWxAgg.Everything works just great, I love it. Thing is that while most graphs have contained size, certain graphs can be actually composed of several subplots and therefore I would like them to be plotted on bigger canvas. I can create a big canvas in a scrolledwindow with big virualsize and this works just fine. What I cannot do is to dinamically resize the canvas after it has been create, ie. Create a smaller canvas and then increase its size only if needed. One more thing is that if I put the canvas in a sizer and then set the scrolledwindow to fit the sizer than the canvas changes its dimension accortding to the dimension of the frame (meaning if I maximize the whole frame I seem to get a bigger canvas. Here some graphic examples: This is what I have now Class MyNoteBookpage(wx.panel): def _init_ ... #In the notebook page self, create scrolledwindow self.virtualw = wx.ScrolledWindow(self) self.virtualw.SetVirtualSize((1000,1000)) self.virtualw.SetScrollRate(20,20) #Create Canvas, child of the scrolledwindow self.canvas1 = MyCanvas(self.virtualw) #now arrange the sizer self.cs = wx.BoxSizer() self.cs.Add (self.canvas1, 1, wx.GROW|wx.ALL, 1) self.virtualw.SetSizer(self.cs) This code will result in this: http://zipp.it/u/Q687P Note that in the panel I also have a grid and a textbox and some buttons, all arranged within a sizer. If I resize the figure using fig.set_size_inches((10,10)) I get this: http://zipp.it/u/Z466Y 2) Is it possible to include in my subplot a custom drawing? I would like to have a half filled rectangle below the x axis, like the one you see on panel b of the figure: http://zipp.it/u/L963V Thanks a lot, Giorgio -- gi...@gi... http://www.cafelamarck.it |
|
From: Claas T. <cla...@gm...> - 2007-02-09 13:11:03
|
Hi Eric,
Great that it works!! This is what I was looking for!
There is one thing left, which is that the tick labels are not exactly
at the boundary between the colors. (It is no problem for me, but I am
interested where it comes from). The script below shows that the
colorswitch is not exactly at an "even" number. The values
-0.022000001 and -0.022 are colored with the same color, whereas
-0.02200001 has a different color. I don't know whether this is the
reason for the ticks not beeing exactly at the intersection..?
I used the newest matplotlib version from the svn-repository.
I would use a script in the following way:
from pylab import *
from matplotlib import ticker
delta = 0.01
x = arange(-3.0, 3.0, delta)
y = arange(-3.0, 3.0, delta)
X,Y = meshgrid(x, y)
Z1 = bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = Z2 - Z1 # difference of Gaussians
Z[20,20]=-0.022
Z[20,25]=-0.022000001
Z[20,30]=-0.02200001
Z[20,35]=-0.0220001
Z[20,40]=-0.022001
Z[20,45]=-0.02201
cmap = cm.get_cmap('jet', 10) # 10 discrete colors
#### Set vmin and vmax beforehand
im = imshow(Z, cmap=cmap, vmin=-0.15, vmax=0.17, interpolation='nearest')
colorbar(ticks=linspace(im.norm.vmin, im.norm.vmax, 11)) # 11 tick labels
Thanks!
Claas :-)
|
|
From: Krzysztof M. <ma...@pi...> - 2007-02-09 11:29:19
|
Hello, I have problem with generate charts with matplotlib under zope. I use the code based on http://www.scipy.org/Cookbook/Matplotlib/Matplotlib_and_Zope Problem appears when the server is overloaded (even a little oveloaded) and generally after starting zope. The image charts sometimes don't draw completely, sometimes part of first chart draw on the second image. Description: Web client generates two http requests. The requests are served by external functions, functions use matplotlib. Results of functions are returning two image in png format. Images are sending to client who shows it in a web browser. First case: Return image sometimes isn't completely. Image have labels, axises but havent't chart. Second case: First return image isn't completely. The part which hasn't draw on the fisrt image is drawing on the second image. This looks like something is not synchronized or doesn't correctly use resources. Why return external function image when the process isn't completely. Why can function draw on locally buffer allocated in another function? How resolve the problem? I searched event.log in zope and nothing had been saved. Use: Zope 2.9.5, python 2.4.3, matplotlib 0.87.7, numpy-1.0.1, Plone 2.5, Debian (i686, 2 processors). Thanks, Chris. |
|
From: Nils W. <nw...@ia...> - 2007-02-09 09:36:55
|
John Hunter wrote:
> On 2/8/07, Nils Wagner <nw...@ia...> wrote:
>
>> Is there a way to add the coordinates in text form to each plus in the
>> attached figure ?
>> ERach plus in the plot is generated by
>> plot([data[-1].real],[data[-1].imag],'k+')
>>
>> For example the rightmost plus (in the upper right half plane) should
>> have a text (1.049+0.692j)
>> Can I use text for this purpose ?
>
> You can use text, but I suggest you use the brand-spanking-new
> annotate function, which is designed to annotate data points with
> text. It has support for arrows, and offsets from the annotated point
> in a variety of coordinate systems.
>
> Here is an example that shows annotations in a variety of contexts
>
> """
> Some examples of how to annotate points in figures. You specify an
> annotation point xy=(x,y) and a text point xytext=(x,y) for the
> annotated points and text location, respectively. Optionally, you can
> specify the coordinate system of xy and xytext with one of the
> following strings for xycoords and textcoords (default is 'data')
>
>
> 'figure points' : points from the lower left corner of the figure
> 'figure pixels' : pixels from the lower left corner of the figure
> 'figure fraction' : 0,0 is lower left of figure and 1,1 is upper, right
> 'axes points' : points from lower left corner of axes
> 'axes pixels' : pixels from lower left corner of axes
> 'axes fraction' : 0,1 is lower left of axes and 1,1 is upper right
> 'data' : use the axes data coordinate system
>
> Optionally, you can specify arrow properties which draws and arrow
> from the text to the annotated point by giving a dictionary of arrow
> properties
>
> Valid keys are
>
> width : the width of the arrow in points
> frac : the fraction of the arrow length occupied by the head
> headwidth : the width of the base of the arrow head in points
> shrink : move the tip and base some percent away from the
> annotated point and text
> any key for matplotlib.patches.polygon (eg facecolor)
>
> For physical coordinate systems (points or pixels) the origin is the
> (bottom, left) of the figure or axes. If the value is negative,
> however, the origin is from the (right, top) of the figure or axes,
> analogous to negative indexing of sequences.
> """
>
>
> from pylab import figure, show, nx
> from matplotlib.patches import Ellipse
>
> if 1:
> # if only one location is given, the text and xypoint being
> # annotated are assumed to be the same
> fig = figure()
> ax = fig.add_subplot(111, autoscale_on=False, xlim=(-1,5),
> ylim=(-3,5))
>
> t = nx.arange(0.0, 5.0, 0.01)
> s = nx.cos(2*nx.pi*t)
> line, = ax.plot(t, s, lw=3, color='purple')
>
> ax.annotate('axes center', xy=(.5, .5), xycoords='axes fraction',
> horizontalalignment='center', verticalalignment='center')
>
> ax.annotate('pixels', xy=(20, 20), xycoords='figure pixels')
>
> ax.annotate('points', xy=(100, 300), xycoords='figure points')
>
> ax.annotate('local max', xy=(3, 1), xycoords='data',
> xytext=(0.8, 0.95), textcoords='axes fraction',
> arrowprops=dict(facecolor='black', shrink=0.05),
> horizontalalignment='right', verticalalignment='top',
> )
>
> ax.annotate('a fractional title', xy=(.025, .975),
> xycoords='figure fraction',
> horizontalalignment='left', verticalalignment='top',
> fontsize=20)
>
> # use negative points or pixels to specify from right, top -10, 10
> # is 10 points to the left of the right side of the axes and 10
> # points above the bottom
> ax.annotate('bottom right (points)', xy=(-10, 10),
> xycoords='axes points',
> horizontalalignment='right', verticalalignment='bottom',
> fontsize=20)
>
> fig.savefig('annotation_coords')
>
> if 1:
> # you can specify the xypoint and the xytext in different
> # positions and coordinate systems, and optionally turn on a
> # connecting line and mark the point with a marker. Annotations
> # work on polar axes too. In the example below, the xy point is
> # in native coordinates (xycoords defaults to 'data'). For a
> # polar axes, this is in (theta, radius) space. The text in this
> # example is placed in the fractional figure coordinate system.
> # Text keyword args like horizontal and vertical alignment are
> # respected
> fig = figure()
> ax = fig.add_subplot(111, polar=True)
> r = nx.arange(0,1,0.001)
> theta = 2*2*nx.pi*r
> line, = ax.plot(theta, r, color='#ee8d18', lw=3)
>
> ind = 800
> thisr, thistheta = r[ind], theta[ind]
> ax.plot([thistheta], [thisr], 'o')
> ax.annotate('a polar annotation',
> xy=(thistheta, thisr), # theta, radius
> xytext=(0.05, 0.05), # fraction, fraction
> textcoords='figure fraction',
> arrowprops=dict(facecolor='black', shrink=0.05),
> horizontalalignment='left',
> verticalalignment='bottom',
> )
> #fig.savefig('annotation_polar')
>
> if 1:
> # You can also use polar notation on a cartesian axes. Here the
> # native coordinate system ('data') is cartesian, so you need to
> # specify the xycoords and textcoords as 'polar' if you want to
> # use (theta, radius)
>
> el = Ellipse((0,0), 10, 20, facecolor='r', alpha=0.5)
>
> fig = figure()
> ax = fig.add_subplot(111, aspect='equal')
> ax.add_artist(el)
> el.set_clip_box(ax.bbox)
> ax.annotate('the top',
> xy=(nx.pi/2., 10.), # theta, radius
> xytext=(nx.pi/3, 20.), # theta, radius
> xycoords='polar',
> textcoords='polar',
> arrowprops=dict(facecolor='black', shrink=0.05),
> horizontalalignment='left',
> verticalalignment='bottom',
> )
>
> ax.set_xlim(-20, 20)
> ax.set_ylim(-20, 20)
> #fig.savefig('annotation_ellipse')
>
>
>
> fig.savefig('annotation_demo.png')
> show()
Hi John,
Thank you very much for your note !
How can I control the number of digits in the output (image.png) ?
I would like to have four digits for the real part and four digits for
the imaginary part.
And how can I suppress small numbers ?
plot([data[-1].real],[data[-1].imag],'k+')
annotate(str(data[-1]),xy=(data[-1].real,data[-1].imag),xycoords='data')
Nils
|
|
From: <bh...@de...> - 2007-02-08 18:04:09
|
"John Hunter" <jd...@gm...> writes: >> But this fails to plot the first rectange in the resulting plot. The >> second, red rectangle is painted correctly in the resulting plot, but >> the first one is totaly missing in the plot, leaving only a line in >> the plot. Is there some kind of internal status that has to be >> resettet in the actors? > > When you add an artist to the Axes, it checks to see if you have set a > transformation. If you haven't, it will set the default axes > transformation. If you have, it leaves the transformation unchanged. > This is why you are seeing the problems you see. > > Before adding them to the second axes, you need to reset the > transformation for each line, text, etc.... > > > for artist in ax.get_child_artists(): > artist.set_transform(ax2.transData) > if isinstance(artist, Line2D): > ax2.add_line(artist) > elif .... > > should work.... It does. It helps me a lot, thank you. Regards Berthold --=20 ber...@xn... / <http://h=C3=B6llmanns.de/> bh...@we... / <http://starship.python.net/crew/bhoel/> |
|
From: Matthew B. <mat...@gm...> - 2007-02-08 17:01:13
|
Hi, > > I want to import binary files generated from C/FORTRAN into matplotlib for > > plotting. > > Can this be done using 'load'? > > If you are using SciPy, scipy.io has a few functions which may > help. scipy.io.fromfile, for example. Ah - just to be clear, for scipy 0.5.2, scipy.io.fromfile is in fact numpy.fromfile - that was just a goofy import error on my part when writing the matlab file loading routines. For clarity, I think it is best to pull this from the scipy.io namespace for the next release, so please use numpy.fromfile for this. Best, Matthew |
|
From: Nils W. <nw...@ia...> - 2007-02-08 16:28:18
|
Hi all,
Is there a way to add the coordinates in text form to each plus in the
attached figure ?
ERach plus in the plot is generated by
plot([data[-1].real],[data[-1].imag],'k+')
For example the rightmost plus (in the upper right half plane) should
have a text (1.049+0.692j)
Can I use text for this purpose ?
Any pointer would be appreciated.
Thanks in advance
Nils
|
|
From: Mark B. <ma...@gm...> - 2007-02-08 09:07:45
|
Does anybody understand why CXX extensions don't pickle? I have the same problem with my own CXX extensions, which I make with SWIG. On the other hand, FORTRAN extensions using f2py pickle fine! Mark From: "John Hunter" <jd...@gm...> > Subject: Re: [Matplotlib-users] Native file format > To: "Edin Salkovic" <edi...@gm...> > Cc: Jan Strube <cur...@gm...>, > mat...@li..., Eric Firing > <ef...@ha...> > Message-ID: > <88e...@ma...> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 2/7/07, Edin Salkovic <edi...@gm...> wrote: > > > Why can't mpl's figures be pickled? > > The main thing is we need to add pickle support for all of mpl's extension > code > > http://docs.python.org/lib/node321.html > > In earlier attempts people got stuck with trying to pickle the > CXX extension code, which was causing some problems, but these > problems may be fixed in more recent versions of CXX. Todd Miller was > the last person to look at this in some detail, I think. > > Other hinderances may come from the GUI layer, since figures store > pointers to their canvases which in some cases come from GUI extension > code that may not support pickling. But we can fairly easy decouple > the figure from the canvas at pickle time and deal with pure mpl, > numpy and python objects. The main work is to add pickle > serialization to the mpl extension code. > |
|
From: Eric F. <ef...@ha...> - 2007-02-08 07:43:46
|
Angus McMorland wrote: > Hi all, > > Did any progress get made beyond this discussion below? I'm trying to > get contourf3D working, using latest svn, and it still seems to be > out-of-order. Contour3D works, but I get exactly the same errors (and > went exactly the same route trying to fix them) as Matthew. > > On 13/01/07, Eric Firing <ef...@ha...> wrote: >> I don't know if everything 3D works, but the first error you note below > > Which one is supposed to be the 'first' error mentioned here? In my > latest svn checkout, the line: > > levels, colls = self.contourf(X, Y, Z, 20) > > still appears to be present. > >> is fixed in svn, and I suspect in 0.87.7, the last release. 0.87.5 is >> rather old--quite a bit has changed between minor releases. Aha! What is fixed is the corresponding error in contour3D--but strangely, the same error in contourf3D was never fixed. I took a stab at it just now but failed--there is more wrong with it than this simple error--so I made it raise NotImplementedError. I don't know whether contourf3D ever *did* work. Nor am I sure exactly what it should do if it worked. The problem is that no one has taken on the maintenance of the 3D plotting. Eric |
|
From: Angus M. <am...@gm...> - 2007-02-08 03:28:35
|
Hi all, Did any progress get made beyond this discussion below? I'm trying to get contourf3D working, using latest svn, and it still seems to be out-of-order. Contour3D works, but I get exactly the same errors (and went exactly the same route trying to fix them) as Matthew. On 13/01/07, Eric Firing <ef...@ha...> wrote: > I don't know if everything 3D works, but the first error you note below Which one is supposed to be the 'first' error mentioned here? In my latest svn checkout, the line: levels, colls = self.contourf(X, Y, Z, 20) still appears to be present. > is fixed in svn, and I suspect in 0.87.7, the last release. 0.87.5 is > rather old--quite a bit has changed between minor releases. > > Eric > > Matthew Koichi Grimes wrote: > > contourf3D and contour3D seem to be broken in my copy of matplotlib > > 0.87.5 that I installed from ubuntu edgy's repositories. Is this a known > > problem? I started going through axes3d.py etc and fixing the reported > > errors, but the error trail seems to go pretty deep across multiple > > files. Now I'm wondering if maybe this is something major that has > > already been fixed by more experienced hands in SVN or something. > > > > In the off chance that this is an unknown problem, I've enumerated the > > errors below. These all happened while attempting to run the example > > code in http://www.scipy.org/Cookbook/Matplotlib/mplot3D > > > > If it's fixed in SVN, I'll try installing that, but I haven't seen this > > bug mentioned in matplotlib's bug list on sourceforge.net. > > > > -- Matt > > > > When I called contourf3D the first time, I got the following error: > > > > <snip> > > File "/usr/lib/python2.4/site-packages/matplotlib/axes3d.py", line 596, > > in contourf3D > > levels, colls = self.contourf(X, Y, Z, 20) > > TypeError: unpack non-sequence > > </snip> > > > > As suggested in the examples page above, I went into contourf3D's > > function definition in axes3d.py and replaced: > > > > levels, colls = self.contourf(X, Y, Z, 20) > > > > with > > > > C = self.contourf(X, Y, Z, *args, **kwargs) > > levels, colls = (C.levels, C.collections) > > > > I then got a new error when calling contourf3D: > > > > <snip> > > exceptions.NameError Traceback (most > > recent call last) > > > > /home/mkg/Desktop/<ipython console> > > > > /usr/lib/python2.4/site-packages/matplotlib/axes3d.py in > > contourf3D(self, X, Y, Z, *args, **kwargs) > > 604 zs = [z1] * (len(linec._verts[0])/2) > > 605 zs += [z2] * (len(linec._verts[0])/2) > > --> 606 art3d.wrap_patch(linec, zs, fn=draw_polyc) > > 607 self.auto_scale_xyz(X,Y,Z, had_data) > > 608 return levels,colls > > > > NameError: global name 'draw_polyc' is not defined > > </snip> > > > > After changing draw_polyc to art3d.draw_polyc, it complained that > > art3d.wrap_patch in fact only takes two arguments. So I changed > > > > art3d.wrap_patch(linec, zs, fn=draw_polyc) > > > > to > > > > art3d.wrap_patch(linec, zs) > > > > Which led to the latest error message: > > > > <snip> > > Traceback (most recent call last): > > File > > "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py", > > line 284, in expose_event > > self._render_figure(self._pixmap, w, h) > > File > > "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py", > > line 73, in _render_figure > > FigureCanvasAgg.draw(self) > > File > > "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py", > > line 391, in draw > > self.figure.draw(renderer) > > File "/usr/lib/python2.4/site-packages/matplotlib/figure.py", line > > 538, in draw > > for a in self.axes: a.draw(renderer) > > File "/usr/lib/python2.4/site-packages/matplotlib/axes3d.py", line > > 172, in draw > > Axes.draw(self, renderer) > > File "/usr/lib/python2.4/site-packages/matplotlib/axes.py", line 1057, > > in draw > > a.draw(renderer) > > File "/usr/lib/python2.4/site-packages/matplotlib/art3d.py", line 56, > > in call_draw3d > > self.draw3d(renderer) > > File "/usr/lib/python2.4/site-packages/matplotlib/art3d.py", line 184, > > in draw3d > > xs,ys = zip(*self._offsets) > > TypeError: zip() argument after * must be a sequence > > </snip> > > > > Contour3D (not contourf3D) does work in that it successfully displays a > > plot, but when I mouseover this plot, my python console fills with the > > following error message (one repetition for each mouse event): > > > > <snip> > > /usr/lib/python2.4/site-packages/matplotlib/backends/backend_gtk.py in > > motion_notify_event(self, widget, event) > > 178 # flipy so y=0 is bottom of canvas > > 179 y = self.allocation.height - y > > --> 180 FigureCanvasBase.motion_notify_event(self, x, y) > > 181 return False # finish event propagation? > > 182 > > > > /usr/lib/python2.4/site-packages/matplotlib/backend_bases.py in > > motion_notify_event(self, x, y, guiEvent) > > 885 event = MouseEvent('motion_notify_event', self, x, y, > > self._button, self._key, guiEvent=guiEvent) > > 886 for func in self.callbacks.get('motion_notify_event', > > {}).values(): > > --> 887 func(event) > > 888 > > 889 def draw(self, *args, **kwargs): > > > > /usr/lib/python2.4/site-packages/matplotlib/axes3d.py in on_move(self, > > event) > > 396 """ > > 397 #NOTE - this shouldn't be called before the graph has > > been drawn for the first time! > > --> 398 if event.inaxes != self or not self.M: > > 399 return > > 400 # > > > > ValueError: The truth value of an array with more than one element is > > ambiguous. Use a.any() or a.all() > > </snip> -- AJC McMorland, PhD Student Physiology, University of Auckland |
|
From: John H. <jd...@gm...> - 2007-02-07 22:25:38
|
> But this fails to plot the first rectange in the resulting plot. The
> second, red rectangle is painted correctly in the resulting plot, but
> the first one is totaly missing in the plot, leaving only a line in
> the plot. Is there some kind of internal status that has to be
> resettet in the actors?
When you add an artist to the Axes, it checks to see if you have set a
transformation. If you haven't, it will set the default axes
transformation. If you have, it leaves the transformation unchanged.
This is why you are seeing the problems you see.
Before adding them to the second axes, you need to reset the
transformation for each line, text, etc....
for artist in ax.get_child_artists():
artist.set_transform(ax2.transData)
if isinstance(artist, Line2D):
ax2.add_line(artist)
elif ....
should work....
JDH
|
|
From: <bh...@de...> - 2007-02-07 20:46:06
|
I try to take artists from one subplot instance and add them to
another:
-------------------------
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.patches import Patch, Rectangle
from matplotlib.lines import Line2D
fig =3D Figure()
canvas =3D FigureCanvas(fig)
ax =3D fig.add_subplot(111)
ax.add_patch(Rectangle((.5, 1.5), 1, .2))
fig2 =3D Figure()
canvas2 =3D FigureCanvas(fig2)
ax2 =3D fig2.add_subplot(111)
for artist in ax.get_child_artists():
if isinstance(artist, Line2D):
ax2.add_line(artist)
elif isinstance(artist, Patch):
ax2.add_patch(artist)
ax2.add_patch(Rectangle((1.5, 2.5), 1, .2, facecolor=3D'r'))
ax2.set_aspect("equal")
ax2.autoscale_view()
w, h =3D fig2.get_size_inches()
xmin, xmax =3D ax2.get_xlim()
ymin, ymax =3D ax2.get_ylim()
xext =3D xmax - xmin
yext =3D ymax - ymin
if xext < yext:
w =3D h * xext/yext
else:
h =3D w * yext/xext
=20=20=20=20
size =3D fig2.set_size_inches(w, h)
canvas2.print_figure('copy2.eps')
-------------------------
But this fails to plot the first rectange in the resulting plot. The
second, red rectangle is painted correctly in the resulting plot, but
the first one is totaly missing in the plot, leaving only a line in
the plot. Is there some kind of internal status that has to be
resettet in the actors?
Kind regards
Berthold
--=20
ber...@xn... / <http://h=C3=B6llmanns.de/>
bh...@we... / <http://starship.python.net/crew/bhoel/>
|
|
From: George N. <gn...@go...> - 2007-02-07 19:08:30
|
On 07/02/07, Michael Lerner <mgl...@gm...> wrote: > That works for me. Thanks. I was trying to muck around with _lut > directly and make a sentinel version of LinearSegmentedColormap. As I > didn't really know what I was doing, I was having some strange > results. Also, in case other folks don't realize this, you can > initialize this with a Colormap, LinearSegmentedColormap, etc. > > I'd be happy to update the SciPy wiki. Please do. I believe the original code was written by Andrew Straw; at least he put it up on the wiki. A word of warning: because the code replaces various Normalize methods, it's not guaranteed to work with future mpl releases. It would be nice if something like this, but perhaps more efficient, was included in matplotlib. It's a useful thing to be able to do. Regards, George. |
|
From: Koontz, J. \(IMS\) <Ko...@im...> - 2007-02-07 18:39:56
|
I've just installed matplotlib on a 64 bit server running Suse Linux
Enterprise Server 9. I followed the instructions on the Installing
section from the webpage and everything seemed to install fine using the
defaults. I installed the latest version of Numpy, 1.0.1, then
proceeded to install matplotlib. (I had the devel packages of freetype,
libpng, and zlib installed.) I don't need a GUI Backend so I wasn't
worried about getting them installed properly. Everything seems fine, I
can import numpy and matplotlib into python. However, I run into this
problem when trying to do an import. Here's the sample code:
#!/usr/bin/env python
import os
import tempfile
import matplotlib
matplotlib.use('Agg') # force the antigrain backend
from matplotlib import rc
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.figure import Figure
from matplotlib.cbook import iterable
import matplotlib.numerix as nx
***snip***
And here is the output:
$ python test_matlib.py
The import of the numpy version of the _image module,
_ns_image, failed. This is is either because numpy was
unavailable when matplotlib was compiled, because a dependency of
_ns_image could not be satisfied, or because the build flag for
this module was turned off in setup.py. If it appears that
_ns_image was not built, make sure you have a working copy of
numpy and then re-install matplotlib. Otherwise, the following
traceback gives more details:
Traceback (most recent call last):
File "test_matlib.py", line 7, in ?
from matplotlib.backends.backend_agg import FigureCanvasAgg
File
"/usr/local/lib/python2.3/site-packages/matplotlib/backends/backend_agg.
py", line 77, in ?
from matplotlib._image import fromarray
File "/usr/local/lib/python2.3/site-packages/matplotlib/_image.py",
line 17, in ?
from matplotlib._ns_image import *
ImportError:
/usr/local/lib/python2.3/site-packages/matplotlib/_ns_image.so:
undefined symbol: _ZNSs4_Rep20_S_empty_rep_storageE
$
It seems like it's something very simple, but I can't seem to find what
went wrong. Anybody have any ideas??
Thanks
Josh
=20
=20
--------------------------------------------------------
Information in this e-mail may be confidential. It is intended only for =
the addressee(s) identified above. If you are not the addressee(s), or =
an employee or agent of the addressee(s), please note that any =
dissemination, distribution, or copying of this communication is =
strictly prohibited. If you have received this e-mail in error, please =
notify the sender of the error.
|
|
From: Christopher B. <Chr...@no...> - 2007-02-07 17:32:11
|
Rob Hetland wrote: > The MPL Qt backend requires PyQt (or, better, Qt4 and PyQt4). PyQt does > compile against the Qt Library, and also takes quite a while to > complete. I guess I wasn't clear -- does the MPL QT back-end compile against QT? Or can you just install PyQt after MPL, and have it work? I'm on a quest to get as complete as possible a MPL binary for OS-X, so I need to know if I need to have PyQt all working to build an MPL binary that supports it. > PyQt does not use setuptools, and I am not sure how to make a > generally usable binary distribution from it. Does it build with distutils? If so, then, in theory, you can use bdist_mpkg to build a binary package. bdist_mpkg comes with Py2app. I say "in theory" because PyQt is pretty complex, so it may not s work out of the box. However, there was some work done a while back adapting py2app to support it, so it just may work. If it doesn't the folks on pythonmac list can probably help. > I would say that installation is quite easy (although time consuming) -- > perhaps just a good set of directions on the MPL site? That would certainly be a start -- though shouldn't such directions be on a QT or MacPython site. The pythonmac Wiki has had troubles lately, I'm afraid, though it seems to be up at the moment: http://www.pythonmac.org/wiki -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
|
From: Todd M. <jm...@st...> - 2007-02-07 16:43:27
|
Perry Greenfield wrote: > On Feb 7, 2007, at 10:21 AM, John Hunter wrote: > > >> On 2/7/07, Edin Salkovic <edi...@gm...> wrote: >> >> >>> Why can't mpl's figures be pickled? >>> >> The main thing is we need to add pickle support for all of mpl's >> extension code >> >> http://docs.python.org/lib/node321.html >> >> In earlier attempts people got stuck with trying to pickle the >> CXX extension code, which was causing some problems, but these >> problems may be fixed in more recent versions of CXX. Todd Miller was >> the last person to look at this in some detail, I think. >> >> > I think Todd did get it to work, but I'll copy him on this just to make > sure. > I looked at this in the context of numarray session saving and restoring. In that context, I believed there was a general problem with extension types not being picklable as a matter of developer expediency: first order, pickling support often doesn't get done. So my approach was to fudge a little and create "proxy" objects for things which wouldn't pickle rather than "fix all extension types." Where I left off CXX still didn't support pickling but a Python session with matplotlib and numarray could be saved; numarray arrays would be preserved, matplotlib objects would be "proxied" but unfortunately the proxies don't work in that case. Todd >> Other hinderances may come from the GUI layer, since figures store >> pointers to their canvases which in some cases come from GUI extension >> code that may not support pickling. But we can fairly easy decouple >> the figure from the canvas at pickle time and deal with pure mpl, >> numpy and python objects. The main work is to add pickle >> serialization to the mpl extension code. >> >> ---------------------------------------------------------------------- >> --- >> Using Tomcat but need to do more? Need to support web services, >> security? >> Get stuff done quickly with pre-integrated technology to make your >> job easier. >> Download IBM WebSphere Application Server v.1.0.1 based on Apache >> Geronimo >> http://sel.as-us.falkag.net/sel? >> cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |