SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S





1
(5)
2
(6)
3
(4)
4
(9)
5
(7)
6
(16)
7
(5)
8
(10)
9
(2)
10
(3)
11
(9)
12
(1)
13
(13)
14
(1)
15
(13)
16
(5)
17
(3)
18
(14)
19
(17)
20
(14)
21
(15)
22
(6)
23
(6)
24
25
(4)
26
(4)
27
(4)
28
(11)
29
(7)
30
(1)

Showing results of 208

1 2 3 .. 9 > >> (Page 1 of 9)
From: Soumyaroop R. <roy...@gm...> - 2011年04月30日 05:34:21
Hi there:
I have an x-y plot and I want to draw a vertical marker (an x=c line) on the
plot on a mouse click.
How should I approach it?
regards,
Soumyaroop
From: Michael D. <md...@st...> - 2011年04月29日 14:00:41
You could use Python string formatting, like so:
ax.annotate('Time = %s' % Time, size=18, xy=(3, 1), xycoords='data',
 xytext=(0.8, 0.95), textcoords='axes fraction',
 horizontalalignment='right', verticalalignment='top',
 )
On 04/29/2011 06:54 AM, Pau wrote:
> Hello,
>
> I am trying to print in the plot the value of a time variable which I
> obtain like this
>
> Time = MBH_inst[0] # Column 1
>
> This should be placed on the top right part of the plot showing the current time
>
> Time = XXX yrs
>
> But I do not know how to pass this to ax.annotate:
>
> ax.annotate('Time = ', size=18, xy=(3, 1), xycoords='data',
> xytext=(0.8, 0.95), textcoords='axes fraction',
> horizontalalignment='right', verticalalignment='top',
> )
>
> Thanks,
>
> Pau
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: Thomas R. <tho...@gm...> - 2011年04月29日 13:05:54
Hi,
I've found a bug in imread which causes images in PNG and JPEG format to be flipped when using imshow. For example,
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1,2,1)
image = plt.imread('2mass_rgb.png')
ax.imshow(image, origin='upper', extent=[0.5,723.5,0.5,724.5])
ax = fig.add_subplot(1,2,2)
image = plt.imread('2mass_rgb.jpg')
ax.imshow(image, origin='upper', extent=[0.5,723.5,0.5,724.5])
fig.savefig('rgb.png')
The input and output files can be found at https://www.dropbox.com/s/96npxuglpkd7y1u
I have submitted a bug report at https://github.com/matplotlib/matplotlib/issues/101
Thanks for any help,
Cheers,
Tom
From: Pau <vim...@go...> - 2011年04月29日 10:55:04
Hello,
I am trying to print in the plot the value of a time variable which I
obtain like this
Time = MBH_inst[0] # Column 1
This should be placed on the top right part of the plot showing the current time
Time = XXX yrs
But I do not know how to pass this to ax.annotate:
ax.annotate('Time = ', size=18, xy=(3, 1), xycoords='data',
 xytext=(0.8, 0.95), textcoords='axes fraction',
 horizontalalignment='right', verticalalignment='top',
 )
Thanks,
Pau
From: Ian T. <ian...@gm...> - 2011年04月29日 08:50:58
On 28 April 2011 22:56, Luke <haz...@gm...> wrote:
> I am thinking that perhaps the approach I should be taking should
> involve contouring the real part of the eigenvalues which determine
> the stability, and then plot the zero-level curve. I'll have to think
> about that some more.
>
This sounds like a very sensible approach and is quick and easy to try out
using tricontour/tricontourf. You may have to use a very small positive
value for the contour level rather then zero to get what you want.
> Is it clear what I am trying to do? If so, do you think the Delaunay
> triangulation is the right way to go?
>
Yes, it is clear what you are trying to do. I think that you shouldn't be
concerned with the triangulation, Delaunay or not, as this is at too low a
level for what you are attempting. Stick to the high-level data analysis
and presentation functions like tricontour and ignore details of the
underlying triangulation. If you are having to manipulate a triangulation
then you are becoming a computational geometrist - it is a completely valid
and interesting thing to do but is probably taking your attention away from
your real work.
Ian
From: Jason G. <jas...@cr...> - 2011年04月29日 03:08:51
On 4/28/11 9:03 PM, gary ruben wrote:
> http://stackoverflow.com/questions/1920145/how-to-find-duplicate-elements-in-array-using-for-loop-in-python-like-c-c
> i.e.
> dups = [x for x in list_a if list_a.count(x)> 1]
That involves iterating through your list_a a number of times to look 
for elements. It probably would be much faster to use something like 
the Counter class to just get the items that occur once or more than once:
http://docs.python.org/library/collections.html#counter-objects
Thanks,
Jason
From: gary r. <gr...@bi...> - 2011年04月29日 02:03:31
If you generate a big list of all the edges from the triangle data,
you should get repeat entries only for all the internal edges. You
could then find all the duplicates using this recipe
http://stackoverflow.com/questions/1920145/how-to-find-duplicate-elements-in-array-using-for-loop-in-python-like-c-c
i.e.
dups = [x for x in list_a if list_a.count(x) > 1]
After removing all of these, you should be left with just the boundary edges.
Gary R.
On Fri, Apr 29, 2011 at 7:56 AM, Luke <haz...@gm...> wrote:
> Ian,
> Thanks for the response and the example code. I guess what I'm
> trying to do might be well defined. Here is a plot that should
> illustrate the data I'm working with:
>
> http://biosport.ucdavis.edu/blog/copy_of_steady_benchmark_tau.png
>
> The green and red regions are being displayed by plotting each and
> every point in my data set that is stable. So the set of points I was
> describing in my original message looks like these green and red
> regions.
>
> What I would like is just the boundary of the stable region, which
> maybe isn't a very well defined statement. The convex hull of these
> points would enclose a part of the x-y plane that isn't stable, so I
> don't want to include it in my plot.
>
> I am thinking that perhaps the approach I should be taking should
> involve contouring the real part of the eigenvalues which determine
> the stability, and then plot the zero-level curve. I'll have to think
> about that some more.
>
> Is it clear what I am trying to do? If so, do you think the Delaunay
> triangulation is the right way to go?
>
> ~Luke
>
> On Thu, Apr 28, 2011 at 2:14 PM, Ian Thomas <ian...@gm...> wrote:
>> On 28 April 2011 08:51, Luke <haz...@gm...> wrote:
>>>
>>> I have a set of unstructured (x,y) points which I would like to
>>> compute a boundary polygon for. I don't want the convex hull.
>>>
>>> I was able to use matplotlib.tri to get a Delaunay triangulation for
>>> my points by following the examples online, but I'm having trouble
>>> masking everything but the triangles with a boundary edge.
>>> Additionally, once I get this, I'm not clear on how to plot just the
>>> boundary.
>>>
>>> Here is what it seems like the mask should be, assume triang comes
>>> from matplotlib.tri.Triangulation().
>>>
>>> mask = np.where(np.where(triang.neighbors < 0, 0, 1).all(axis=1), 1, 0)
>>> triang.set_mask(mask)
>>>
>>> but, when I plot triang using plot.triplot(), or plt.plot() to plot
>>> the edges, I am getting a bunch of extra stuff that isn't just the
>>> boundary triangles/edges.
>>>
>>> Anybody have example code for properly masking and plotting only the
>>> boundary edges?
>>>
>>> ~Luke
>>
>> Luke,
>>
>> I am not entirely clear exactly what you want to do, but I'll try to help.
>>
>> Your masking of the triangulation masks the triangles not the edges, and so
>> your triplot call displays those triangles that include a boundary edge but
>> also the other edges of those triangles. As you say, this isn't what you
>> want.
>>
>> I've attached an example script that follows on from your idea of testing
>> triang.neighbors to determine the boundary edges, and displays just those
>> edges. However, this is the convex hull as, by definition, the boundary of
>> an unconstrained Delaunay triangulation is the convex hull. As you don't
>> want the convex hull, I am not clear what you want instead.
>>
>> If I have misunderstood your requirements and/or you have further questions,
>> please post your example code as it is much easier for others on the mailing
>> list to correct existing code than come up with their own freestanding
>> example.
>>
>> I hope some of this helps!
>> Ian Thomas
>>
>
>
>
> --
> "Those who would give up essential liberty to purchase a little
> temporary safety deserve neither liberty nor safety."
>
> -- Benjamin Franklin, Historical Review of Pennsylvania, 1759
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Luke <haz...@gm...> - 2011年04月28日 21:56:30
Ian,
 Thanks for the response and the example code. I guess what I'm
trying to do might be well defined. Here is a plot that should
illustrate the data I'm working with:
http://biosport.ucdavis.edu/blog/copy_of_steady_benchmark_tau.png
The green and red regions are being displayed by plotting each and
every point in my data set that is stable. So the set of points I was
describing in my original message looks like these green and red
regions.
What I would like is just the boundary of the stable region, which
maybe isn't a very well defined statement. The convex hull of these
points would enclose a part of the x-y plane that isn't stable, so I
don't want to include it in my plot.
I am thinking that perhaps the approach I should be taking should
involve contouring the real part of the eigenvalues which determine
the stability, and then plot the zero-level curve. I'll have to think
about that some more.
Is it clear what I am trying to do? If so, do you think the Delaunay
triangulation is the right way to go?
~Luke
On Thu, Apr 28, 2011 at 2:14 PM, Ian Thomas <ian...@gm...> wrote:
> On 28 April 2011 08:51, Luke <haz...@gm...> wrote:
>>
>> I have a set of unstructured (x,y) points which I would like to
>> compute a boundary polygon for. I don't want the convex hull.
>>
>> I was able to use matplotlib.tri to get a Delaunay triangulation for
>> my points by following the examples online, but I'm having trouble
>> masking everything but the triangles with a boundary edge.
>> Additionally, once I get this, I'm not clear on how to plot just the
>> boundary.
>>
>> Here is what it seems like the mask should be, assume triang comes
>> from matplotlib.tri.Triangulation().
>>
>> mask = np.where(np.where(triang.neighbors < 0, 0, 1).all(axis=1), 1, 0)
>> triang.set_mask(mask)
>>
>> but, when I plot triang using plot.triplot(), or plt.plot() to plot
>> the edges, I am getting a bunch of extra stuff that isn't just the
>> boundary triangles/edges.
>>
>> Anybody have example code for properly masking and plotting only the
>> boundary edges?
>>
>> ~Luke
>
> Luke,
>
> I am not entirely clear exactly what you want to do, but I'll try to help.
>
> Your masking of the triangulation masks the triangles not the edges, and so
> your triplot call displays those triangles that include a boundary edge but
> also the other edges of those triangles. As you say, this isn't what you
> want.
>
> I've attached an example script that follows on from your idea of testing
> triang.neighbors to determine the boundary edges, and displays just those
> edges. However, this is the convex hull as, by definition, the boundary of
> an unconstrained Delaunay triangulation is the convex hull. As you don't
> want the convex hull, I am not clear what you want instead.
>
> If I have misunderstood your requirements and/or you have further questions,
> please post your example code as it is much easier for others on the mailing
> list to correct existing code than come up with their own freestanding
> example.
>
> I hope some of this helps!
> Ian Thomas
>
-- 
"Those who would give up essential liberty to purchase a little
temporary safety deserve neither liberty nor safety."
-- Benjamin Franklin, Historical Review of Pennsylvania, 1759
From: Ian T. <ian...@gm...> - 2011年04月28日 21:14:46
Attachments: tri_boundaries.py
On 28 April 2011 08:51, Luke <haz...@gm...> wrote:
> I have a set of unstructured (x,y) points which I would like to
> compute a boundary polygon for. I don't want the convex hull.
>
> I was able to use matplotlib.tri to get a Delaunay triangulation for
> my points by following the examples online, but I'm having trouble
> masking everything but the triangles with a boundary edge.
> Additionally, once I get this, I'm not clear on how to plot just the
> boundary.
>
> Here is what it seems like the mask should be, assume triang comes
> from matplotlib.tri.Triangulation().
>
> mask = np.where(np.where(triang.neighbors < 0, 0, 1).all(axis=1), 1, 0)
> triang.set_mask(mask)
>
> but, when I plot triang using plot.triplot(), or plt.plot() to plot
> the edges, I am getting a bunch of extra stuff that isn't just the
> boundary triangles/edges.
>
> Anybody have example code for properly masking and plotting only the
> boundary edges?
>
> ~Luke
>
Luke,
I am not entirely clear exactly what you want to do, but I'll try to help.
Your masking of the triangulation masks the triangles not the edges, and so
your triplot call displays those triangles that include a boundary edge but
also the other edges of those triangles. As you say, this isn't what you
want.
I've attached an example script that follows on from your idea of testing
triang.neighbors to determine the boundary edges, and displays just those
edges. However, this is the convex hull as, by definition, the boundary of
an unconstrained Delaunay triangulation is the convex hull. As you don't
want the convex hull, I am not clear what you want instead.
If I have misunderstood your requirements and/or you have further questions,
please post your example code as it is much easier for others on the mailing
list to correct existing code than come up with their own freestanding
example.
I hope some of this helps!
Ian Thomas
From: Pau <vim...@go...> - 2011年04月28日 18:13:15
Hi,
I am trying to "grep" in 650 data files a row which has a particular
number on column 2, namely " 0.250000000000000E+00 ".
Alternatively, I could look for that row by searching for the first
column, which is " 1 ".
Unfortunately, this row changes position in the 650 files and looks like this:
-----------
.
.
.
 4224 0.249999993684469E-04 0.450621747970581E+01
-0.217168951034546E+01 0.798277109861374E-01 -0.598546504974365E+00
-0.947211563587189E+00 0.298483103513718E+00 0.694457411766052E+00
-0.135573709011078E+01 0.500285959243774E+01 0
 4225 0.249999993684469E-04 0.503941202163696E+01
-0.236623978614807E+01 -0.171467363834381E+00 -0.204598993062973E+00
-0.764434099197388E+00 0.354671090841293E+00 0.141895398497581E+00
-0.693929433822632E+00 0.556993389129639E+01 0
 4226 0.249999993684469E-04 0.403050041198730E+01
-0.215032029151917E+01 0.877652913331985E-01 -0.991083562374115E+00
0.611193120479584E+00 0.273028463125229E+00 0.364663577079773E+01
-0.221709823608398E+01 0.456908226013184E+01 0
 1 0.250000000000000E+00 0.417827463150024E+01
-0.208329892158508E+01 0.104015089571476E+00 0.154748081695288E-02
-0.619542039930820E-02 -0.361486850306392E-02 0.216096282005310E+01
-0.701378881931305E+00 0.467000341415405E+01 0
 4228 0.249999993684469E-04 -0.348412361145020E+02
-0.309311046600342E+02 -0.551393890380859E+01 -0.908447951078415E-01
-0.427876152098179E-01 -0.533953774720430E-02 0.295748591423035E+01
-0.196792855858803E-01 0.469153327941895E+02 0
 4229 0.249999993684469E-04 0.427954912185669E+01
-0.195016658306122E+01 0.785302296280861E-01 0.806781768798828E+00
-0.110497450828552E+01 -0.624167263507843E+00 0.235030865669250E+01
-0.216405773162842E+01 0.470360040664673E+01 0
 4230 0.249999993684469E-04 0.551125669479370E+01
-0.394835329055786E+01 0.588055849075317E+00 -0.504932820796967E+00
0.104279957711697E+00 -0.213553920388222E+00 0.198102459311485E+00
-0.341262459754944E+00 0.680509042739868E+01 0
.
.
.
-------------
The purpose is to identify the row and then plot the 3rd and 4th
columns once that row has been identified:
X_inst = FILE[????:, 2] # Column 3
Y_inst = FILE[????:, 3] # Column 4
My problem is how to define those ????
thanks a lot,
Pau
From: Wes M. <wes...@gm...> - 2011年04月28日 17:06:44
On Thu, Apr 28, 2011 at 1:01 PM, Wes McKinney <wes...@gm...> wrote:
> On Thu, Apr 28, 2011 at 12:55 PM, Pau <vim...@go...> wrote:
>> Hi,
>>
>> I am trying to use recursively a matplotlib script to create 650 plots.
>>
>> For this, I have defined
>>
>> cluster = loadtxt(sys.argv[1])
>> MBH   = loadtxt ('./TrajectoryMBH.asc')
>>
>> X_cl = cluster[:, 2] # Column 3
>> Y_cl = cluster[:, 3] # Column 4
>> Z_cl = cluster[:, 4] # Column 5
>>
>> X_mbh = MBH[:, 2] # Column 3
>> Y_mbh = MBH[:, 3] # Column 4
>> Z_mbh = MBH[:, 4] # Column 5
>>
>>
>> because "cluster" is the file that changes. TrajectoryMBH.asc is
>> always the same file for all 650 plots
>>
>> This way, I can run
>>
>> ./Hit_Cluster_MBH.py MYFILE_001.dat
>>
>> and the script takes MYFILE_001.dat as "cluster".
>>
>> Now, I would like matplotlib to produce the eps file automatically,
>> without any popup window.
>>
>> For this, I usually define
>>
>> import matplotlib
>> matplotlib.use('Agg')
>> import matplotlib.pyplot as plt
>>
>> and the, at the very bottom, instead of
>>
>> show()
>>
>> I have
>>
>> plt.savefig('MyEPS.eps')
>>
>> What I would like though is that matplotlib produces automatically
>>
>> MYFILE_001.eps
>> MYFILE_002.eps
>>
>> etc
>>
>> when running the python script within a shell script such as
>>
>> for file in $(ls *dat) ; do ; ./Hit_Cluster_MBH.py $file ; done
>>
>> but I do not know how to do this in the
>>
>> plt.savefig('MyEPS.eps')
>>
>> part...
>>
>> Obviously
>>
>> plt.savefig('$file.eps')
>>
>> does not work.
>>
>> Any hint will be appreciated.
>>
>> Thanks,
>>
>> Pau
>>
>> ------------------------------------------------------------------------------
>> WhatsUp Gold - Download Free Network Management Software
>> The most intuitive, comprehensive, and cost-effective network
>> management toolset available today. Delivers lowest initial
>> acquisition cost and overall TCO of any competing solution.
>> http://p.sf.net/sfu/whatsupgold-sd
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> How about something like:
>
> name, ext = sys.argv[1].split('.')
> plt.savefig('%s.eps' % name)
>
Also, if you do everything in Python instead of a shell script, the
whole process will take much less time. E.g.:
def generate_eps_file(pth):
 ...
 # generate your plot from specified file
 name, ext = pth.split('.')
 plt.savefig('%s.eps' % name)
import glob
files = glob.glob('*.dat')
for filepath in files:
 generate_eps_file(filepath)
From: Pau <vim...@go...> - 2011年04月28日 17:06:15
thanks!
On 28 April 2011 19:01, Wes McKinney <wes...@gm...> wrote:
> On Thu, Apr 28, 2011 at 12:55 PM, Pau <vim...@go...> wrote:
>> Hi,
>>
>> I am trying to use recursively a matplotlib script to create 650 plots.
>>
>> For this, I have defined
>>
>> cluster = loadtxt(sys.argv[1])
>> MBH   = loadtxt ('./TrajectoryMBH.asc')
>>
>> X_cl = cluster[:, 2] # Column 3
>> Y_cl = cluster[:, 3] # Column 4
>> Z_cl = cluster[:, 4] # Column 5
>>
>> X_mbh = MBH[:, 2] # Column 3
>> Y_mbh = MBH[:, 3] # Column 4
>> Z_mbh = MBH[:, 4] # Column 5
>>
>>
>> because "cluster" is the file that changes. TrajectoryMBH.asc is
>> always the same file for all 650 plots
>>
>> This way, I can run
>>
>> ./Hit_Cluster_MBH.py MYFILE_001.dat
>>
>> and the script takes MYFILE_001.dat as "cluster".
>>
>> Now, I would like matplotlib to produce the eps file automatically,
>> without any popup window.
>>
>> For this, I usually define
>>
>> import matplotlib
>> matplotlib.use('Agg')
>> import matplotlib.pyplot as plt
>>
>> and the, at the very bottom, instead of
>>
>> show()
>>
>> I have
>>
>> plt.savefig('MyEPS.eps')
>>
>> What I would like though is that matplotlib produces automatically
>>
>> MYFILE_001.eps
>> MYFILE_002.eps
>>
>> etc
>>
>> when running the python script within a shell script such as
>>
>> for file in $(ls *dat) ; do ; ./Hit_Cluster_MBH.py $file ; done
>>
>> but I do not know how to do this in the
>>
>> plt.savefig('MyEPS.eps')
>>
>> part...
>>
>> Obviously
>>
>> plt.savefig('$file.eps')
>>
>> does not work.
>>
>> Any hint will be appreciated.
>>
>> Thanks,
>>
>> Pau
>>
>> ------------------------------------------------------------------------------
>> WhatsUp Gold - Download Free Network Management Software
>> The most intuitive, comprehensive, and cost-effective network
>> management toolset available today. Delivers lowest initial
>> acquisition cost and overall TCO of any competing solution.
>> http://p.sf.net/sfu/whatsupgold-sd
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
> How about something like:
>
> name, ext = sys.argv[1].split('.')
> plt.savefig('%s.eps' % name)
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Wes M. <wes...@gm...> - 2011年04月28日 17:01:29
On Thu, Apr 28, 2011 at 12:55 PM, Pau <vim...@go...> wrote:
> Hi,
>
> I am trying to use recursively a matplotlib script to create 650 plots.
>
> For this, I have defined
>
> cluster = loadtxt(sys.argv[1])
> MBH   = loadtxt ('./TrajectoryMBH.asc')
>
> X_cl = cluster[:, 2] # Column 3
> Y_cl = cluster[:, 3] # Column 4
> Z_cl = cluster[:, 4] # Column 5
>
> X_mbh = MBH[:, 2] # Column 3
> Y_mbh = MBH[:, 3] # Column 4
> Z_mbh = MBH[:, 4] # Column 5
>
>
> because "cluster" is the file that changes. TrajectoryMBH.asc is
> always the same file for all 650 plots
>
> This way, I can run
>
> ./Hit_Cluster_MBH.py MYFILE_001.dat
>
> and the script takes MYFILE_001.dat as "cluster".
>
> Now, I would like matplotlib to produce the eps file automatically,
> without any popup window.
>
> For this, I usually define
>
> import matplotlib
> matplotlib.use('Agg')
> import matplotlib.pyplot as plt
>
> and the, at the very bottom, instead of
>
> show()
>
> I have
>
> plt.savefig('MyEPS.eps')
>
> What I would like though is that matplotlib produces automatically
>
> MYFILE_001.eps
> MYFILE_002.eps
>
> etc
>
> when running the python script within a shell script such as
>
> for file in $(ls *dat) ; do ; ./Hit_Cluster_MBH.py $file ; done
>
> but I do not know how to do this in the
>
> plt.savefig('MyEPS.eps')
>
> part...
>
> Obviously
>
> plt.savefig('$file.eps')
>
> does not work.
>
> Any hint will be appreciated.
>
> Thanks,
>
> Pau
>
> ------------------------------------------------------------------------------
> WhatsUp Gold - Download Free Network Management Software
> The most intuitive, comprehensive, and cost-effective network
> management toolset available today. Delivers lowest initial
> acquisition cost and overall TCO of any competing solution.
> http://p.sf.net/sfu/whatsupgold-sd
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
How about something like:
name, ext = sys.argv[1].split('.')
plt.savefig('%s.eps' % name)
From: Pau <vim...@go...> - 2011年04月28日 16:55:17
Hi,
I am trying to use recursively a matplotlib script to create 650 plots.
For this, I have defined
cluster = loadtxt(sys.argv[1])
MBH = loadtxt ('./TrajectoryMBH.asc')
X_cl = cluster[:, 2] # Column 3
Y_cl = cluster[:, 3] # Column 4
Z_cl = cluster[:, 4] # Column 5
X_mbh = MBH[:, 2] # Column 3
Y_mbh = MBH[:, 3] # Column 4
Z_mbh = MBH[:, 4] # Column 5
because "cluster" is the file that changes. TrajectoryMBH.asc is
always the same file for all 650 plots
This way, I can run
./Hit_Cluster_MBH.py MYFILE_001.dat
and the script takes MYFILE_001.dat as "cluster".
Now, I would like matplotlib to produce the eps file automatically,
without any popup window.
For this, I usually define
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
and the, at the very bottom, instead of
show()
I have
plt.savefig('MyEPS.eps')
What I would like though is that matplotlib produces automatically
MYFILE_001.eps
MYFILE_002.eps
etc
when running the python script within a shell script such as
for file in $(ls *dat) ; do ; ./Hit_Cluster_MBH.py $file ; done
but I do not know how to do this in the
plt.savefig('MyEPS.eps')
part...
Obviously
plt.savefig('$file.eps')
does not work.
Any hint will be appreciated.
Thanks,
Pau
From: Luke <haz...@gm...> - 2011年04月28日 07:51:55
I have a set of unstructured (x,y) points which I would like to
compute a boundary polygon for. I don't want the convex hull.
I was able to use matplotlib.tri to get a Delaunay triangulation for
my points by following the examples online, but I'm having trouble
masking everything but the triangles with a boundary edge.
Additionally, once I get this, I'm not clear on how to plot just the
boundary.
Here is what it seems like the mask should be, assume triang comes
from matplotlib.tri.Triangulation().
mask = np.where(np.where(triang.neighbors < 0, 0, 1).all(axis=1), 1, 0)
triang.set_mask(mask)
but, when I plot triang using plot.triplot(), or plt.plot() to plot
the edges, I am getting a bunch of extra stuff that isn't just the
boundary triangles/edges.
Anybody have example code for properly masking and plotting only the
boundary edges?
~Luke
-- 
"Those who would give up essential liberty to purchase a little
temporary safety deserve neither liberty nor safety."
-- Benjamin Franklin, Historical Review of Pennsylvania, 1759
From: briant100 <btr...@ho...> - 2011年04月28日 06:16:38
that should work
many thanks
butterw wrote:
> 
> given a recarray r, r.dtype.names contains a tuple with the column names.
> 
> It should be easy to do what you want using a loop.
> 
> 
> briant100 wrote:
>> 
>> Hey John - currently using matplotlib.mlab import csv2rec functionality
>> in a script.
>> 
>> Is there a tool or way to automate plotting of multiple y series
>> contained in a csv data file (data in columns, header is first row, x
>> axis is time, several y series) with varying column header names and
>> varying numbers of columns depending on the individual data file?
>> I particularly want to avoid manually typing individual series names -as
>> this information is contained in the header row for each column of data
>> it seems inefficient to have to type series names for plotting, only to
>> have to retype series names for the next csv file which contains
>> different column header names 
>> 
>> Plotfile came close, but doesnt seem to automatically label individual
>> series by column header 
>> eg file formats (varying headers, and numbers of columns):
>> 
>> file 1
>> elapsedtime,AS2data,AS45data,SE34data,VB56data
>> 
>> file 2
>> elapsedtime,AS09data,VB24data
>> 
> 
> 
-- 
View this message in context: http://old.nabble.com/record-array-and-date-support-tp11011990p31493748.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2011年04月28日 05:23:20
Attachments: testet0.py
The Axes class of the axisartist toolkit uses very different way to
handle ticks and tick labels. Thus most of the tick-related commands
of original matplotlib do not work!
Unfortunately, there is no easy way to support a logarithmic scale.
To utilize the full functionality, you need to create a transform
object and provide an appropriate tick locator. The first part is easy
but the second part is not. You can use origial mapltolib's tick
locator, but it has a limitation that minor ticks are not well
supported.
The easiest way is to convert your data to log scale and use a fixed
locator with a custom formatter. An example script is attached.
The better approach is to create your own locator and formatter.
Regards,
-JJ
On Fri, Apr 22, 2011 at 1:49 AM, Junghun Shin
<jh...@ef...> wrote:
> Hi, everyone.
>
> Let me explain what I wanted to do: First, I wanted to make a polar
> plot with angles from 0 to 90. I could do it by adopting the
> curvelinear grid demo ( http://goo.gl/kruXf ). And then I wanted to
> present the radius in log10 scale. But setting the plot command to
> semilogy or trying to set 'set_rscale('log')' all failed. Below I
> pasted the code that works for radius in linear scale.
>
> [Code]
> #!/usr/bin/env python
> import matplotlib.pyplot as plt
> import numpy as np
>
> #Modified from http://matplotlib.sourceforge.net/plot_directive/mpl_toolkits/axes_grid/examples/demo_floating_axis.py
>
> #def curvelinear_test2(fig, lp_r, lp_t):
> def curvelinear_test2(fig, lp_t, lp_r, rLower, rUpper):
>  rmin = np.min(lp_r)
>  rmax = np.max(lp_r)
>  print 'rm: ', rmin, 'rM: ', rmax,'rL: ', rLower, 'rU: ', rUpper
>  """
>  polar projection, but in a rectangular box.
>  """
>  global ax1
>  import mpl_toolkits.axisartist.angle_helper as angle_helper
>  from matplotlib.projections import PolarAxes
>  from matplotlib.transforms import Affine2D
>
>  from mpl_toolkits.axisartist import SubplotHost, ParasiteAxesAuxTrans
>
>  from mpl_toolkits.axisartist import GridHelperCurveLinear
>
>  from mpl_toolkits.axisartist.grid_helper_curvelinear import
> GridHelperCurveLinear
>
>
>  # see demo_curvelinear_grid.py for details
>  tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform()
>
>  extreme_finder = angle_helper.ExtremeFinderCycle(20, 20,
>                           lon_cycle = 360,
>                           lat_cycle = None,
>                           lon_minmax = (0, 360),
>                           lat_minmax =
> (-np.inf, np.inf),
>                           #lat_minmax =
> (rmin, np.inf),
>                           )
>
>  grid_locator1 = angle_helper.LocatorDMS(12)
>
>  tick_formatter1 = angle_helper.FormatterDMS()
>
>  grid_helper = GridHelperCurveLinear(tr,
>                    extreme_finder=extreme_finder,
>                    grid_locator1=grid_locator1,
>                    tick_formatter1=tick_formatter1
>                    )
>
>
>  ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper)
>
>  fig.add_subplot(ax1)
>
>  # make ticklabels of all axis visible.
>  ax1.axis[:].major_ticklabels.set_visible(True)
>  #ax1.axis["top"].major_ticklabels.set_visible(True)
>  #ax1.axis["left"].major_ticklabels.set_visible(True)
>  #ax1.axis["bottom"].major_ticklabels.set_visible(True)
>
>  # show angle (0) at right and top
>  ax1.axis["right"].get_helper().nth_coord_ticks=0
>  ax1.axis["top"].get_helper().nth_coord_ticks=0
>
>  # show radius (1) at left and bottom
>  ax1.axis["left"].get_helper().nth_coord_ticks=1
>  ax1.axis["bottom"].get_helper().nth_coord_ticks=1
>
>  # set labels
>  ax1.axis["left"].label.set_text(r'ylabel')
>  ax1.axis["bottom"].label.set_text(r'xlabel')
>  ax1.axis["bottom"].major_ticklabels.set_rotation(-30)
>
>  ax1.set_aspect(1.)
>  ax1.set_xlim(rLower, rUpper)
>  ax1.set_ylim(rLower, rUpper)
>  #ax1.rscale('log')
>
>  # A parasite axes with given transform
>  ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal")
>  # note that ax2.transData == tr + ax1.transData
>  # Anthing you draw in ax2 will match the ticks and grids of ax1.
>  ax1.parasites.append(ax2)
>
>  ax2.plot(lp_t, lp_r, 'o-')
>  #ax2.semilogy(lp_t, lp_r, 'o-')
>  #ax2.set_rscale('log')
>  #ax1.set_xscale('log')
>  #ax1.set_yscale('log')
>
>  ax1.grid(True)
>
> if __name__ == "__main__":
>
>  fig = plt.figure(1, figsize=(5, 5))
>  fig.clf()
>
>  rmin = 1e-1
>  rmax = 1e2
>  lp_t = np.linspace(0., 90., 5)
>  lp_r = np.linspace(rmin, rmax/10, 5)*5
>
>  print "lp_t: ", lp_t
>  print "lp_r: ", lp_r
>  print "log10(lp_r): ", np.log10(lp_r)
>
>  curvelinear_test2(fig, lp_t, lp_r, rmin, rmax)
>  #curvelinear_test2(fig, lp_t, np.log10(lp_r), np.log10(rmin), np.log(rmax))
>
>  plt.show()
>
> [/Code]
>
> I'm using Enthought Python Distribution Version: 7.0-2 (32-bit) Python
> 2.7.1 on win32
> and matplotlib.__version__ is '1.0.1'.
>
> Thanks,
> Junghun Shin
> --
> Division of Electrical, Electronic and Information Engineering,
> Graduate School of Engineering, Osaka University,
> 2-6 Yamada-oka, Suita-shi, Osaka, 565-0871, JAPAN
> Tel / Fax: +81-6-6879-8755
> E-mail: jh...@ef...
> Group Homepage: http://www.eie.eng.osaka-u.ac.jp/ef/
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: jfortiv <jf...@gm...> - 2011年04月28日 04:32:08
This worked. Thank you very much! For some reason I had commented out
ax.fmt_xdata = ...
This is exactly what I needed. 
James
Goyo wrote:
> 
> 2011年4月23日 jfortiv <jf...@gm...>:
>>
>> Hi,
>>
>> This actually did not work for me. Can you show me the full code that
>> you
>> used to successfully produce the time-format x-axis labels?
> 
> See attached files.
> 
> Goyo
> 
> 
> 
> ------------------------------------------------------------------------------
> Fulfilling the Lean Software Promise
> Lean software platforms are now widely adopted and the benefits have been 
> demonstrated beyond question. Learn why your peers are replacing JEE 
> containers with lightweight application servers - and what you can gain 
> from the move. http://p.sf.net/sfu/vmware-sfemails
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Date-format-the-x-axis-of-a-barh%28%29-plot--tp31420395p31493421.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Oren G. <or...@fu...> - 2011年04月27日 07:57:59
Thanks, Mike, for responding to my question!
I've pulled the latest HEAD from github (1.1.0) and test it withe the latest
wx (2.8.12 from few days ago) and added your patch from pull 89. I'm afraid
the leak is still the same. I also tried to use "your" version from github,
which already has the patch, but it didn't effect the leak. The problem
occures on all PCs I checked, some with winXP and one or two running Win7
OS.
I was somewhat inaccurate in a previous email. I did add a single axes to
the original script in the line:
 self._price_ax = self.fig.add_subplot(111)
But now replaced it with the line:
 self.fig.add_axes([0.075,0.1,0.75,0.85])
from the original script and the problem remains. Basically redrawing a
canvas with a single axes and nothing more on it grows the memory by more
than 100k per second.
Any ideas on what else can I check? workaround?
I'll appreciate it if anyone else can try and reproduce it.
Oren
 Re: [Matplotlib-users] Memory leakage in matplotlib 1.0.1 with wx 2.8.11.0
>
> Michael Droettboom
> 2011年4月21日 09:58:10 -0700
> The repository is now on github, so if you want the very latest, you should
> get it from here:
>
> https://github.com/matplotlib/matplotlib
>
> (We haven't done a terribly good job of advertising that change).
>
> I'm not seeing any leak myself with your script with matplotlib HEAD plus
> this pull request:
>
> https://github.com/matplotlib/matplotlib/pull/89
>
> so we may be getting to the bottom of this type of leak.
>
> Mike
>
> On 04/20/2011 05:18 PM, Oren Gampel wrote:
>
> I have now tested this with version 1.1.0svn from the trunk of the dev repository.
> I believe this version contains Michael Droettboo's patch for pyCXX. (
> https://sourceforge.net/tracker/index.php?func=detail&aid=3115633&group_id=3180&atid=103180
> <
> https://sourceforge.net/tracker/index.php?func=detail&aid=3115633&group_id=3180&atid=103180>
> ) Unfortunately the leak is still evident in the small script I've attached.
> Again, please note that this script has no axes, plots, or drawn
> components, only an empty canvas that is being redrawn and causes the
> memory growth.
>
> Any ideas how to resolve this or further debug this?
>
> Thanks for your help,
> Oren
>
> On Mon, Apr 11, 2011 at 6:37 PM, Oren Gampel <o...@futuretech.co.il <
> mailto:o...@futuretech.co.il <o...@futuretech.co.il>>> wrote:
>
> I'm having a memory leakage using matplotlib 1.0.1 with wx
> 2.8.11.0, on windows XP.
>
> To reproduce, I used the sample from here:
>
> http://matplotlib.sourceforge.net/examples/animation/dynamic_image_wxagg2.html
> and deleted most of the significant lines (see below). I only
> create a canvas but I don't create any axes, nor plot any data.
> The only thing I do is draw() on a timer event. This makes my
> process grow about 6Mbyte per minute.
>
> Is this reproduced in other environments? Any ideas on how to
> resolve this?
>
> Thanks,
> Oren
>
>
> """
> Copyright (C) 2003-2005 Jeremy O'Donoghue and others
>
> License: This work is licensed under the PSF. A copy should be
> included
> with this source code, and is also available at
> http://www.python.org/psf/license.html
>
> """
> import sys, time, os, gc
>
> import matplotlib
> matplotlib.use('WXAgg')
>
> from matplotlib import rcParams
> import numpy as npy
>
> import matplotlib.cm <http://matplotlib.cm> as cm
>
> from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg
> from matplotlib.backends.backend_wx import NavigationToolbar2Wx
>
> from matplotlib.figure import Figure
> from wx import *
>
>
> TIMER_ID = NewId()
>
> class PlotFigure(Frame):
>
> def __init__(self):
> Frame.__init__(self, None, -1, "Test embedded wxFigure")
>
> self.fig = Figure((1,1), 50, facecolor='.95')
> self.canvas = FigureCanvasWxAgg(self, -1, self.fig)
> # Now put all into a sizer
> sizer = wx.BoxSizer(wx.VERTICAL)
> # This way of adding to sizer allows resizing
> sizer.Add(self.canvas, 1, wx.LEFT|wx.TOP|wx.GROW)
> self.SetSizer(sizer)
> self.Fit()
>
> self._price_ax = self.fig.add_subplot(111)
>
>
> wx.EVT_TIMER(self, TIMER_ID, self.onTimer)
> self.t = wx.Timer(self, TIMER_ID)
> self.t.Start(1000)
>
> def onTimer(self, evt):
> self.canvas.draw()
>
>
> if __name__ == '__main__':
> app = PySimpleApp()
> frame = PlotFigure()
> # Initialise the timer - wxPython requires this to be connected to
> # the receiving event handler
> t = Timer(frame, TIMER_ID)
> t.Start(100)
>
> frame.Show()
> app.MainLoop()
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX - 2011年04月27日 05:23:24
Hi,
I'm using the FigureCanvasGtkAgg as my canvas for graphs, but I notice
that the background colour of the canvas does not match that for the
rest of my application, and neither does the font. Is there a simple
way to get my graphs to respect the user selected GTK theme?
I'm using
Debian Squeeze/Wheezy/Sid
Python: 2.6.5
Matplotlib: SVN r8988
GTK: 2.20.1
PyGTK: 2.17.0
— Jason
From: butterw <bu...@gm...> - 2011年04月27日 04:09:35
given a recarray r, r.dtype.names contains a tuple with the column names.
It should be easy to do what you want using a loop.
briant100 wrote:
> 
> Hey John - currently using matplotlib.mlab import csv2rec functionality in
> a script.
> 
> Is there a tool or way to automate plotting of multiple y series contained
> in a csv data file (data in columns, header is first row, x axis is time,
> several y series) with varying column header names and varying numbers of
> columns depending on the individual data file?
> I particularly want to avoid manually typing individual series names -as
> this information is contained in the header row for each column of data it
> seems inefficient to have to type series names for plotting, only to have
> to retype series names for the next csv file which contains different
> column header names 
> 
> Plotfile came close, but doesnt seem to automatically label individual
> series by column header 
> eg file formats (varying headers, and numbers of columns):
> 
> file 1
> elapsedtime,AS2data,AS45data,SE34data,VB56data
> 
> file 2
> elapsedtime,AS09data,VB24data
> 
-- 
View this message in context: http://old.nabble.com/record-array-and-date-support-tp11011990p31483894.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: briant100 <btr...@ho...> - 2011年04月27日 02:10:08
Hey John - currently using matplotlib.mlab import csv2rec functionality in a
script.
Is there a tool or way to automate plotting of multiple y series contained
in a csv data file (data in columns, header is first row, x axis is time,
several y series) with varying column header names and varying numbers of
columns depending on the individual data file?
I particularly want to avoid manually typing individual series names -as
this information is contained in the header row for each column of data it
seems inefficient to have to type series names for plotting, only to have to
retype series names for the next csv file which contains different column
header names 
Plotfile came close, but doesnt seem to automatically label individual
series by column header 
eg file formats (varying headers, and numbers of columns):
file 1
elapsedtime,AS2data,AS45data,SE34data,VB56data
file 2
elapsedtime,AS09data,VB24data
 
John Hunter-4 wrote:
> 
> <<support for native plotting of python date and datetime
> objects <<support for loading CSV files (or general space/tab/comma
> delimited
> files) into numpy record arrays, and the type conversions (int, float,
> date, etc...) >><<The function assumes there is a
> header row, and these strings will be munged to give valid python
> attribute names. It inspects the first checkrows lines after the
> header to try and infer the datatype and set the appropriate
> conversion function. >>
> Here is an example (svn only)
> 
> from matplotlib.mlab import csv2rec
> from pylab import figure, show
> 
> a = csv2rec('data/msft.csv')
> fig = figure()
> ax = fig.add_subplot(111)
> ax.plot(a.date, a.adj_close, '-')
> fig.autofmt_xdate()
> show()
> 
> The autofmt_xdate is optional, but is a new function that does a few
> things you usually want in date plots: turns off tick labels in the
> upper subplots if any, rotates the tick labels on the lowest axes and
> right aligns them, and increases the bottom of the subplots adjust to
> make room for the rotated tick labels.
> 
> Here is what the dtype looks like from the example above.
> 
> In [3]: !head -3 data/msft.csv
> Date,Open,High,Low,Close,Volume,Adj. Close*
> 19-Sep-03,29.76,29.97,29.52,29.96,92433800,29.79
> 18-Sep-03,28.49,29.51,28.42,29.50,67268096,29.34
> 
> In [4]: a = csv2rec('data/msft.csv')
> 
> In [5]: a.dtype
> Out[5]: dtype([('date', '|O4'), ('open', '<f8'), ('high', '<f8'),
> ('low', '<f8'), ('close', '<f8'), ('volume', '<i4'), ('adj_close',
> '<f8')])
> 
> In [6]: a.date[:2]
> Out[6]: array([2003年09月19日 00:00:00, 2003年09月18日 00:00:00], dtype=object)
> 
> I'll probably add a few performance features to the csv2rec function,
> mainly to let you skip columns and supply conversion functions where
> desired because the autodate parser is pretty slow if you want to
> parse date strings, but this is enough to make it useful. Another
> useful feature will be able to support customizable type dependent
> NULL value conversion (eg convert to numpy.nan for floats,
> '0000-00-00' for dates, etc...)
> 
> Record arrays are your friend; have fun!
> JDH
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/record-array-and-date-support-tp11011990p31483567.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2011年04月26日 20:02:19
On 04/26/2011 09:36 AM, bu...@gm... wrote:
> I believe this feature, which has been requested a number of times, but
> is still missing from matplotlib is genuinely useful for interactive
> plotting. Moreover, I've heard matlab has it...
>
> Here's a potential solution to cover my simple plotting needs. The goal
> is not to support all the weird and wonderful matplotlib features, if
> you need those you probably work only from script anyway. My approach is
> based on figureoptions.py in matplotlib.backends.qt4_editor (or the more
> recent version in spyder):
>
> 1) Save figure file:
> . get xy data for each plot object
> . get object styles (color of plots, linestyle, etc.)
> . save to auto-generated python script
>
> Later...
>
> 2) Open figure file:
> The script will open a new figure, recreate all objects and then apply
> styles to each object.
> >> You have full control over the figure and its contents again for editing
>
> Using this approach backwards compatibility should not be a issue (as
> demonstrated by figureoptions). On the other hand not all matplotlib
> objects/options will be supported.
>
> Any comments or suggestions ?
Implementing anything like this will immediately lead to a stream of 
complaints that it doesn't support "all the weird and wonderful 
matplotlib features".
The vector backends are actually doing something like this, but saving 
in their respective graphics languages instead of in python. Presumably 
some sort of "matplotlib_script" backend could be written, using the pdf 
or svg backend as a template.
Better practice is to use something like the ipython logging facility to 
save one's interactive commands, and then manually to edit that down to 
a script that creates the desired figure. That way one retains full 
control, reproducibility, and documentation of what went into a figure.
Eric
>
>
From: <bu...@gm...> - 2011年04月26日 19:37:03
I believe this feature, which has been requested a number of times, but is 
still missing from matplotlib is genuinely useful for interactive plotting. 
Moreover, I've heard matlab has it...
Here's a potential solution to cover my simple plotting needs. The goal is 
not to support all the weird and wonderful matplotlib features, if you need 
those you probably work only from script anyway. My approach is based on 
figureoptions.py in matplotlib.backends.qt4_editor (or the more recent 
version in spyder):
1) Save figure file:
. get xy data for each plot object
. get object styles (color of plots, linestyle, etc.)
. save to auto-generated python script
Later...
2) Open figure file:
The script will open a new figure, recreate all objects and then apply 
styles to each object.
>> You have full control over the figure and its contents again for editing
Using this approach backwards compatibility should not be a issue (as 
demonstrated by figureoptions). On the other hand not all matplotlib 
objects/options will be supported.
Any comments or suggestions ?
From: _olivier_ <ol...@gm...> - 2011年04月26日 14:32:32
Indeed setting aspect = 'auto' in matshow solved my problem.
Thanks a lot !
Goyo wrote:
> 
> 2011年4月23日 _olivier_ <ol...@gm...>:
>> [...]
> 
>> I have got a matrix 6x500 (so one size is much biggger than the other
>> one)
>> and I try to expand the shorter axe so that the labels on it are well
>> displayed (not overlapped.
> 
> Use the aspect kwarg in matshow.
> 
> Goyo
> 
> ------------------------------------------------------------------------------
> Fulfilling the Lean Software Promise
> Lean software platforms are now widely adopted and the benefits have been 
> demonstrated beyond question. Learn why your peers are replacing JEE 
> containers with lightweight application servers - and what you can gain 
> from the move. http://p.sf.net/sfu/vmware-sfemails
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
-- 
View this message in context: http://old.nabble.com/Try-to-have-none-overlapping-labels-in-one-axe-using-matshow-tp31456159p31478955.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
7 messages has been excluded from this view by a project administrator.

Showing results of 208

1 2 3 .. 9 > >> (Page 1 of 9)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /