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
(20)
2
(16)
3
(9)
4
(12)
5
(14)
6
(22)
7
(17)
8
(33)
9
(26)
10
(32)
11
(47)
12
(26)
13
(7)
14
(24)
15
(44)
16
(42)
17
(22)
18
(31)
19
(8)
20
(4)
21
(15)
22
(27)
23
(41)
24
(33)
25
(31)
26
(24)
27
(10)
28
(20)






Showing results of 29

1 2 > >> (Page 1 of 2)
From: K L <kl...@gm...> - 2010年02月10日 23:31:28
Whoop, the "evil' mathwork even doesn't allow me to refer to a picture
on the site. ok, here's the effect I need (semilogy plotting with more
detailed grid)
http://i47.tinypic.com/95zihi.gif
Sorry for any inconvenience!
From: K L <kl...@gm...> - 2010年02月10日 23:18:33
Hi,
I want a more "detailed" grid for my logarithmic plotting. The following code:
from pylab import *
semilogy(range(100000))
grid(True)
show()
will produce output like this: http://i49.tinypic.com/2dpd3r.png
Notice that the grid uniformly slices the image. And some ticks on the
y-axis doesn't have grid lines. This is not want I want.
Conversely, something like this is preferred:
http://www.mathworks.com/access/helpdesk/help/toolbox/comm/ug/bert_mat_explot1.gif
Thanks!
From: Christopher B. <Chr...@no...> - 2010年02月10日 19:58:18
Wayne Watson wrote:
> See Subject.
not really. Try:
http://www.scipy.org/doc/api_docs/SciPy.ndimage.html
for that. I think there are other IP libs wrapped for python use, too.
-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: John H. <jd...@gm...> - 2010年02月10日 19:11:32
On Wed, Feb 10, 2010 at 12:39 PM, John Jameson
<jja...@al...> wrote:
> Hi -
> I am wondering how to animate using blit and patches.
> The code below was modified from one of the examples.
> You will see that it shows (and moves) the rectangle just fine, but
> the circle never shows up.
Artists must be added to the axes -- when you do line, = ax.plot(...)
the Line2D object is added t the Axes. But you never add the circle
to the axes. So do
 cir = CirclePolygon((x_cir, 1), 0.3, animated=True, resolution=6, lw=2)
 ax.add_patch(cir)
and then call
 ax.draw_artist(cir)
when you want to draw it.
JDH
> best,
> Jaron
>
>
>
> import gtk, gobject
> import matplotlib
> matplotlib.use('GTKAgg') #Agg rendering to a GTK canvas (requires PyGTK)
> import numpy as np
> import matplotlib.pyplot as plt
> from pylab import *
> from matplotlib.patches import CirclePolygon
>
> fig = plt.figure(figsize=(14,10))
> ax = fig.add_subplot(111, autoscale_on=False )
> canvas = fig.canvas
>
> x_start = array([1.0, 2, 2, 1, 1])
> y_start = array([1.0, 1, 2, 2, 1])
>
> plt.axis([-1, 7, -0.5, 2.2])
>
> def update_line():
>  global x, y
>  print update_line.cnt
>  if update_line.background is None:
>    update_line.background = canvas.copy_from_bbox(ax.bbox)
>  canvas.restore_region(update_line.background)
>
>  x = x_start + 0.012 * update_line.cnt
>  y = y_start + 0.0001 * update_line.cnt
>  line, = ax.plot(x, y, animated=True, lw=2)
>  ax.draw_artist(line)
>
>  x_cir = 1.0 + 0.001*update_line.cnt
>  cir = CirclePolygon((x_cir, 1), 0.3, animated=True, resolution=6, lw=2
> )
>  ax.draw_artist(cir)
>
>  canvas.blit(ax.bbox)
>
>  if update_line.cnt == 10000:
>    gtk.mainquit()
>    raise SystemExit
>  update_line.cnt += 1
>  return True
>
> update_line.cnt = 0
> update_line.background = None
>
> def start_anim(event):
>  gobject.idle_add(update_line)
>  canvas.mpl_disconnect(start_anim.cid)
>
> start_anim.cid = canvas.mpl_connect('draw_event', start_anim)
>
> plt.show()
>
>
>
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: John J. <jja...@al...> - 2010年02月10日 19:06:51
Hi - 
I am wondering how to animate using blit and patches. 
The code below was modified from one of the examples.
You will see that it shows (and moves) the rectangle just fine, but 
the circle never shows up.
best,
Jaron
import gtk, gobject
import matplotlib
matplotlib.use('GTKAgg') #Agg rendering to a GTK canvas (requires PyGTK)
import numpy as np
import matplotlib.pyplot as plt
from pylab import *
from matplotlib.patches import CirclePolygon
fig = plt.figure(figsize=(14,10))
ax = fig.add_subplot(111, autoscale_on=False )
canvas = fig.canvas
x_start = array([1.0, 2, 2, 1, 1])
y_start = array([1.0, 1, 2, 2, 1])
plt.axis([-1, 7, -0.5, 2.2])
def update_line():
 global x, y
 print update_line.cnt
 if update_line.background is None:
 update_line.background = canvas.copy_from_bbox(ax.bbox)
 canvas.restore_region(update_line.background)
 
 x = x_start + 0.012 * update_line.cnt 
 y = y_start + 0.0001 * update_line.cnt 
 line, = ax.plot(x, y, animated=True, lw=2)
 ax.draw_artist(line)
 
 x_cir = 1.0 + 0.001*update_line.cnt 
 cir = CirclePolygon((x_cir, 1), 0.3, animated=True, resolution=6, lw=2
)
 ax.draw_artist(cir)
 canvas.blit(ax.bbox)
 if update_line.cnt == 10000:
 gtk.mainquit()
 raise SystemExit
 update_line.cnt += 1
 return True
update_line.cnt = 0
update_line.background = None
def start_anim(event):
 gobject.idle_add(update_line)
 canvas.mpl_disconnect(start_anim.cid)
start_anim.cid = canvas.mpl_connect('draw_event', start_anim)
plt.show()
From: John H. <jd...@gm...> - 2010年02月10日 19:06:05
On Wed, Feb 10, 2010 at 12:44 PM, Ben Axelrod <BAx...@co...> wrote:
> Really cool plot.
>
> Speaking of the 1.0 release, is there a target date set? And if there is going to be another bug-fix release before 1.0, is there a target date for that?
No target date yet, it has been on my wish list for a while. I need
to get my OSX build environment going again after my powerbook died,
and then we need to work through the bugs on the sf site. Once I get
the first part done, I can quickly do a bugfix release on the 99
branch, and then turn my attention to closing bugs on the HEAD.
Actively recruiting OSX release managers, so if someone wants to take
a crack at it see if you can build the binaries from svn HEAD using
release/osx/Makefile (and see README in same directory)
JDH
From: Wayne W. <sie...@sb...> - 2010年02月10日 19:02:13
See Subject. I see some fairly minimal IP in a image tutorial. I'm 
thinkig of things like a dark subtract.
-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW
From: Ben A. <BAx...@co...> - 2010年02月10日 18:45:04
Really cool plot.
Speaking of the 1.0 release, is there a target date set? And if there is going to be another bug-fix release before 1.0, is there a target date for that?
Thanks,
-Ben 
-----Original Message-----
From: John Hunter [mailto:jd...@gm...] 
Sent: Wednesday, February 10, 2010 10:55 AM
To: Yannick Copin
Cc: mat...@li...
Subject: Re: [Matplotlib-users] Sankey diagram
2010年2月9日 Yannick Copin <yan...@la...>:
> Hi List,
>
> I made a script to draw very simple (single-direction single-input 
> single-sided single-everything) Sankey diagrams (attached). I think I 
> could share, if it can be of any use...
Great -- I had never heard of a Sankey diagram but just took a look on wikipedia. Very nice -- I contributed this to examples/api and it will show up on the web site and gallery after the mpl 1.0 release.
Thanks for sending it!
JDH
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
On 2/10/2010 1:17 PM, Oz Nahum wrote:
> This is really crazy ploting so many data point, after all the human
> eye can't separate all the data.
Following up on Oz's point ...
let's suppose that is 5M points for each of the 6 lines,
and that you will try to place them on a 5 inch wide axis.
That is 1M plotted points per horizontal inch.
Here is a list of typical monitor pixel densities:
http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density
Alan Isaac
From: Jeffrey B. <je...@MI...> - 2010年02月10日 18:34:17
Ah, I didn't know there was a section of the rc file for legends. Adding
mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['legend.fontsize'] = 'medium'
fixed things right up.
Thanks,
Jeff
On Feb 10, 2010, at 1:01 PM, <PH...@ge...> wrote:
> Jeff,
>
> I send all of my figures through LaTeX and don't have this problem. 
> The only thing I can think of is to check your matplotlibrc file 
> and make sure you've set the legend font to be the same size as the 
> other fonts.
>
> HTH,
> -paul h.
>
>> -----Original Message-----
>> From: Jeffrey Blackburne [mailto:je...@MI...]
>> Sent: Wednesday, February 10, 2010 9:45 AM
>> To: mat...@li...
>> Subject: [Matplotlib-users] LateX Legend (again)
>>
>> Hi everyone,
>>
>> This has been brought up before, but not completely addressed. Is it
>> possible to get the text in a Legend to match the rest of the text
>> when using LateX? Here is an example of the problem:
>>
>> import matplotlib as mpl
>> mpl.rcParams['text.usetex'] = True
>> import matplotlib.pyplot as plt
>>
>> fig = plt.figure()
>> ax = fig.add_subplot(111)
>> ax.plot([1,5,2,3]) # random data
>> plt.figlegend(ax.lines,[r'$\rm{label}$ label'],loc='upper left')
>> plt.show()
>>
>> The first word is at least in a roman font, but the font size is
>> wrong. I am using svn revision 8005 with gtkagg backend on linux, and
>> confirm the behavior with 0.99.0 with tkagg on OS X.
>>
>> Thanks,
>> Jeff
>>
>>
>> --------------------------------------------------------------------- 
>> ----
>> -----
>> SOLARIS 10 is the OS for Data Centers - provides features such as 
>> DTrace,
>> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
>> http://p.sf.net/sfu/solaris-dev2dev
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Oz Nahum wrote:
> Here's a quick and dirty solution how to sample every nth element in a
> vector - there's probably a faster way, with out loops,
there sure is:
In [8]: orig
Out[8]:
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
 17, 18, 19])
In [9]: orig[0:-1:4] # every 4th element
Out[9]: array([ 0, 4, 8, 12, 16])
-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...
Hello Krishna,
This is really crazy ploting so many data point, after all the human
eye can't separate all the data.
Try sampling the vector of the data point - to a smaller extent.
Here's a quick and dirty solution how to sample every nth element in a
vector - there's probably a faster way, with out loops, but this works
for now
$ python
Python 2.5.5 (r255:77872, Feb 1 2010, 19:53:42)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from nupmy import arange
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: No module named nupmy
>>> from numpy import arange
>>> a=arange(1,15)
>>> a
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
>>> from numpy import zeros
>>> a_sampled=zeros(5)
>>> a_sampled
array([ 0., 0., 0., 0., 0.])
>>> range(0,15,5)
[0, 5, 10]
>>> range(0,15,3)
[0, 3, 6, 9, 12]
>>> fileter_indecies=range(0,15,3)
>>> for i in range(len(a_sampled)):
... a_sampled[i]=a[fileter_indecies[i]]
...
>>> a_sampled
array([ 1., 4., 7., 10., 13.])
I hope it helps
-- 
Oz Nahum
Graduate Student
Zentrum für Angewandte Geologie
Universität Tübingen
---
Imagine there's no countries
it isn't hard to do
Nothing to kill or die for
And no religion too
Imagine all the people
Living life in peace
From: <PH...@Ge...> - 2010年02月10日 18:01:48
Jeff,
I send all of my figures through LaTeX and don't have this problem. The only thing I can think of is to check your matplotlibrc file and make sure you've set the legend font to be the same size as the other fonts.
HTH,
-paul h.
> -----Original Message-----
> From: Jeffrey Blackburne [mailto:je...@MI...]
> Sent: Wednesday, February 10, 2010 9:45 AM
> To: mat...@li...
> Subject: [Matplotlib-users] LateX Legend (again)
> 
> Hi everyone,
> 
> This has been brought up before, but not completely addressed. Is it
> possible to get the text in a Legend to match the rest of the text
> when using LateX? Here is an example of the problem:
> 
> import matplotlib as mpl
> mpl.rcParams['text.usetex'] = True
> import matplotlib.pyplot as plt
> 
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.plot([1,5,2,3]) # random data
> plt.figlegend(ax.lines,[r'$\rm{label}$ label'],loc='upper left')
> plt.show()
> 
> The first word is at least in a roman font, but the font size is
> wrong. I am using svn revision 8005 with gtkagg backend on linux, and
> confirm the behavior with 0.99.0 with tkagg on OS X.
> 
> Thanks,
> Jeff
> 
> 
> -------------------------------------------------------------------------
> -----
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Jeffrey B. <je...@MI...> - 2010年02月10日 17:42:38
Hi everyone,
This has been brought up before, but not completely addressed. Is it 
possible to get the text in a Legend to match the rest of the text 
when using LateX? Here is an example of the problem:
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1,5,2,3]) # random data
plt.figlegend(ax.lines,[r'$\rm{label}$ label'],loc='upper left')
plt.show()
The first word is at least in a roman font, but the font size is 
wrong. I am using svn revision 8005 with gtkagg backend on linux, and 
confirm the behavior with 0.99.0 with tkagg on OS X.
Thanks,
Jeff
From: Bror J. <bro...@gm...> - 2010年02月10日 17:41:11
Dear all,
This is probably a silly question based on my bias from matlab, but I have tried for two days without luck. I need to make pcolor plots in several figures, and the go back and add a scatter on each. This procedure is necessary due to how I read the data. My problem is that I can't figure out how update the colorbar in the end. 
An example is as follows:
#=====
import random
import pylab as pl
import numpy as	np
from numpy.random import rand
def pcl(fig,val):
 pl.figure(fig)
 pl.clf()
 pl.pcolor(val)
 pl.colorbar()
def sct(fig,xvec,yvec,cvec):
 pl.figure(fig)
 pl.scatter(xvec,yvec,40,cvec)
 pl.xlim(0,10)
 pl.ylim(0,10)
 pl.colorbar(orientation='horizontal')
pcl(1, rand(20,20)*10)
pcl(2, rand(20,20)*10)
pcl(3, rand(20,20)*10)
sct(1,rand(10)*10,rand(10)*10,rand(10)*40)
sct(2,rand(10)*10,rand(10)*10,rand(10)*40)
sct(3,rand(10)*10,rand(10)*10,rand(10)*40)
#=====
I would like the pcolor image and the colorbar to have the same clim extents as the scatter in the end. Is this in any way possible?
Many thanks for any help!
:-)Bror
From: Filipe P. A. F. <oc...@gm...> - 2010年02月10日 17:32:49
Hello again, I managed to produce a nice stickplot, thanks to all again.
Here is the script in case anyone is interested.
http://dl.dropbox.com/u/4411725/plt-surf-flx.html
Best, Filipe
On Mon, Feb 8, 2010 at 9:57 AM, Filipe Pires Alvarenga Fernandes <
oc...@gm...> wrote:
> Thanks, that worked perfectly.
>
> Best, Filipe
>
>
> On Mon, Feb 8, 2010 at 8:39 AM, Stephane Raynaud <
> ste...@gm...> wrote:
>
>> Hi Filipe,
>>
>> you can fist use the quiver() function in the classic way for stick plots,
>> then use gca().xaxis_date().
>>
>> Here is a simple example :
>>
>> import pylab as P
>> # t may be generated using date2num()
>> t = P.arange(100,110,.1)
>> u = P.sin(t)
>> v = P.cos(t)
>> P.quiver([t],[[0]*len(t)],u,v)
>> P.gca().xaxis_date()
>> P.show()
>>
>>
>> On Sun, Feb 7, 2010 at 6:11 PM, Filipe Pires Alvarenga Fernandes <
>> oc...@gm...> wrote:
>>
>>> Hello list,
>>>
>>> I'm trying to create a stick-plot figure using the quiver function from
>>> matplotlib. However, I'm failing miserably to plot dates in the x-axis. Has
>>> anyone done this before? Also, is there an effort to create a stickplot
>>> function?
>>>
>>> Thanks, Filipe
>>>
>>> *****************************************************
>>> Filipe Pires Alvarenga Fernandes
>>>
>>> University of Massachusetts Dartmouth
>>> 200 Mill Road - Fairhaven, MA
>>> Tel: (508) 910-6381
>>> Email: fal...@um...
>>> oc...@ya...
>>> oc...@gm...
>>>
>>> http://ocefpaf.tiddlyspot.com/
>>> *****************************************************
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> The Planet: dedicated and managed hosting, cloud storage, colocation
>>> Stay online with enterprise data centers and the best network in the
>>> business
>>> Choose flexible plans and management services without long-term contracts
>>> Personal 24x7 support from experience hosting pros just a phone call
>>> away.
>>> http://p.sf.net/sfu/theplanet-com
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>>
>>
>>
>> --
>> Stephane Raynaud
>>
>
>
From: Bror J. <bro...@gm...> - 2010年02月10日 17:32:43
Dear all,
This is probably a silly question based on my bias from matlab, but I have tried for two days without luck. I need to make pcolor plots in several figures, and the go back and add a scatter on each. This procedure is necessary due to how I read the data. My problem is that I can't figure out how update the colorbar in the end. 
An example is as follows:
#=====
import random
import pylab as pl
import numpy as	np
from numpy.random import rand
def pcl(fig,val):
 pl.figure(fig)
 pl.clf()
 pl.pcolor(val)
 pl.colorbar()
def sct(fig,xvec,yvec,cvec):
 pl.figure(fig)
 pl.scatter(xvec,yvec,40,cvec)
 pl.xlim(0,10)
 pl.ylim(0,10)
 pl.colorbar(orientation='horizontal')
pcl(1, rand(20,20)*10)
pcl(2, rand(20,20)*10)
pcl(3, rand(20,20)*10)
sct(1,rand(10)*10,rand(10)*10,rand(10)*40)
sct(2,rand(10)*10,rand(10)*10,rand(10)*40)
sct(3,rand(10)*10,rand(10)*10,rand(10)*40)
#=====
I would like the pcolor image and the colorbar to have the same clim extents as the scatter in the end. Is this in any way possible?
Many thanks for any help!
:-)Bror
Hi,
 I am a beginner with matplotlib.
I am trying to analyze huge dataset, the plot would have multiple lines. I
am getting memory error (it fails maxing out ~2.5GB on my system). I am
assuming there are probably ways to simplify the data, I came across
something 'simplify' for 'path', not sure how to use that in my case. My
code looks something as shown below (there are 2 ways I tried), as can be
seen I am using lists, would converting them to numpy arrays significantly
improve things? I am yet to try that. Simplifying function would be best I
guess.
The values on x-axis are cumulative measures (of memory of each element,
element being some basic component in our system) and the y-axis shows
percentage (obtained by
some-count-of-the-element_times_memory-of-the-element/Sum of these for all
elements). If this doesn't make sense, that's ok, the idea is the graph is
expected to not contain sudden crests or troughs.
Method1:
xy_pairs = [x1_vals, y1_vals, x2_vals, y2_vals...]
plt.plot(**xy_pairs)
Method1:
for each_xy_pair:
 plt.plot(x_vals, y_vals)
Both of the above methods don't work.
Thanks,
Krishna.
From: John H. <jd...@gm...> - 2010年02月10日 15:55:22
2010年2月9日 Yannick Copin <yan...@la...>:
> Hi List,
>
> I made a script to draw very simple (single-direction single-input
> single-sided single-everything) Sankey diagrams (attached). I think I could
> share, if it can be of any use...
Great -- I had never heard of a Sankey diagram but just took a look on
wikipedia. Very nice -- I contributed this to examples/api and it
will show up on the web site and gallery after the mpl 1.0 release.
Thanks for sending it!
JDH
From: John H. <jd...@gm...> - 2010年02月10日 15:42:43
On Wed, Feb 10, 2010 at 4:43 AM, Nils Wagner
<nw...@ia...> wrote:
> Hi all,
>
> How can I combine onpick events with annotate ?
> Any pointer would be appreciated.
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> fig = plt.figure()
> ax = fig.add_subplot(111)
> ax.set_title('click on points')
>
> line, = ax.plot(np.random.rand(100), 'o', picker=5) # 5
> points tolerance
>
> def onpick(event):
>   thisline = event.artist
>   xdata = thisline.get_xdata()
>   ydata = thisline.get_ydata()
>   ind = event.ind
>   print 'onpick points:', zip(xdata[ind], ydata[ind]),
> ind
>   ax.annotate('Test',xy=(ind,
> ydata[ind]),horizontalalignment='left',verticalalignment='top')
> #  ax.redraw_in_frame()
You need to call fig.canvas.draw() at the end of onpick.
JDH
>
> fig.canvas.mpl_connect('pick_event', onpick)
>
> plt.show()
>
>
>
> Thanks in advance.
>
>             Nils
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Lee B. <Bog...@ca...> - 2010年02月10日 14:21:20
Thanks for all your suggestions Christoph. Launching the Tk Python Shell 
instead of PythonWin seems to work consistently - I get the correct plot 
figure and the correct log_plot.png file created everytime I run the 
script. I never did install Ipython, but I'll consider that for a future 
upgrade.
Lee
Christoph Gohlke <cg...@uc...> 
02/09/2010 04:35 PM
To
matplotlib-users <mat...@li...>
cc
Subject
Re: [Matplotlib-users] Runtime Error - Need Advice
Caterpillar: Confidential Green Retain Until: 03/11/2010 
I can now reproduce this. It seems the same old problem that PythonWin
can not reliably run matplotlib because successive runs of the script
use the same interpreter. Ipython should work. Append pylab.close() to
your script; at least it will not crash on the second run.
-- Christoph
On 2/9/2010 10:44 AM, Lee Boger wrote:
> 
> Although, if I close the figure then re-run the script, a new figure
> pops up but it doesn't have any data plotted. Interpreter is now locked
> up. I'm still not fixing it completely. There is also no figure stored
> as a file log_plot.
> 
> Lee
> 
> 
> *Christoph Gohlke <cg...@uc...>*
> 
> 02/09/2010 01:23 PM
> 
> 
> To
> Lee Boger <Bog...@ca...>
> cc
> 
> Subject
> Re: [Matplotlib-users] Runtime Error - Need Advice
> 
> 
> 
> 
> 
> Caterpillar: Confidential Green Retain Until: 03/11/2010 
> 
> 
> 
> 
> Change the last line to pylab.show() and it should work.
> 
> Anyway, this example should not crash the interpreter. I can reproduce
> the crash on Python 2.4, 2.5, and 2.6 (32 and 64 bit) on Windows with
> mpl 0.99.1 but not on Ubuntu 9.1 with mpl 0.99.0.
> 
> The shortest example that crashes is:
> 
> python -c "import pylab;pylab.subplot(111).figure.show()"
> 
> or on the interactive prompt:
> 
>>>> import pylab
>>>> pylab.subplot(111).figure.show()
>>>> exit()
> Fatal Python error: PyEval_RestoreThread: NULL tstate
> 
> This application has requested the Runtime to terminate it in an unusual
> way.
> Please contact the application's support team for more information.
> 
> 
> -- Christoph
> 
> On 2/9/2010 7:57 AM, Lee Boger wrote:
>>
>> Windows XP Professional with Python 2.5 installed (pywin32 build 210) -
>> came with dSPACE software package
>>
>> Downloaded and installed matplotlib-0.99.1.win32-py2.5.exe from
>> sourceforge.net
>>
>> Downloaded and installed numpy-1.4.0-win32-superpack-python2.5.exe from
>> sourceforge.net
>>
>> Executing the following simple "log plot" script within PythonWin:
>>
>> *from* matplotlib *import* pylab
>>
>> # Create some artificial data.
>> test_frequency = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 
16,
>> 17, 18, 19, 20]
>> test_results = [-0.2, -0.7, -1.0, -1.5, -2.0, -2.5, -3.0, -3.5, -4, -5,
>> -6, -7.1, -8, -9, -10, -11, -12, -15, -20, -25]
>> spec_frequency = [6, 8]
>> spec_results = [-3.0, -3.0]
>>
>> # Plot
>> figure = pylab.subplot(111)
>> figure.semilogx()
>> figure.scatter(test_frequency, test_results, s=20, c='b', marker='s',
>> edgecolors='none')
>> figure.scatter(spec_frequency, spec_results, s=40, c='g', marker='s',
>> edgecolors='none')
>> figure.grid(True)
>> figure.set_xlabel(r"Frequency (Hz)", fontsize = 12)
>> figure.set_ylabel(r"Actuator Response (db)", fontsize = 12)
>>
>> figure.figure.savefig('log_plot')
>> figure.figure.show()
>>
>>
>> Plots a figure on the screen that looks correct, then the following
>> error (when I click OK, PythonWin closes)
>>
>>
>>
>> Any advice would be appreciated. Maybe it's an installation or setup
>> issue, but I'm pretty knew to Python programming and don't know how to
>> debug this.
>>
>> Lee Boger
>>
>>
>>
>> 
------------------------------------------------------------------------------
>> The Planet: dedicated and managed hosting, cloud storage, colocation
>> Stay online with enterprise data centers and the best network in the
> business
>> Choose flexible plans and management services without long-term 
contracts
>> Personal 24x7 support from experience hosting pros just a phone call 
away.
>> http://p.sf.net/sfu/theplanet-com
>>
>>
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Tomasz K. <t.k...@ci...> - 2010年02月10日 11:43:38
I noticed that the hatching looks wrong only when viewed i the OS X 
'preview' software or for example inside of a Lyx document. But, when 
compiled into a DVI or PDF it looks fine. If I have a spare moment at 
some point I will give it a closer look.
Tomek
On 9 Feb 2010, at 23:56, Michiel de Hoon wrote:
> I wasn't able to replicate this problem with the Mac OS X backend 
> with matplotlib 0.99.1.1. Both the on-screen figure and the ps 
> output look fine.
>
> --Michiel.
>
From: Nils W. <nw...@ia...> - 2010年02月10日 11:21:21
Hi all,
How can I combine onpick events with annotate ?
Any pointer would be appreciated.
import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.set_title('click on points')
line, = ax.plot(np.random.rand(100), 'o', picker=5) # 5 
points tolerance
def onpick(event):
 thisline = event.artist
 xdata = thisline.get_xdata()
 ydata = thisline.get_ydata()
 ind = event.ind
 print 'onpick points:', zip(xdata[ind], ydata[ind]), 
ind
 ax.annotate('Test',xy=(ind, 
ydata[ind]),horizontalalignment='left',verticalalignment='top')
# ax.redraw_in_frame()
fig.canvas.mpl_connect('pick_event', onpick)
plt.show()
Thanks in advance.
 Nils
From: Brendan B. <bre...@br...> - 2010年02月10日 08:31:51
	I'm trying to do an animation which plots a large number of items on 
two dimensions, and then animates their positions over time. I have 
set up the plot with my dimensions on the axes and am using 
canvas.blit (as shown in one of the examples) to update my plot. I'm 
using text as the markers --- that is, I use the text function to 
display the label of each item (not just a point) at its location on 
the graph.
	The problem is that I have a large amount of data. There are over 
100,000 "steps" in my time sequence (i.e., places where I might need 
to update the display because some item moved), and even though not 
all of those actually result in a change in the positions, there are 
still several thousand distinct items that need to be plotted and 
moved around. I'm currently buffering this a bit so that I only 
update on every Nth data point, but it's still rather slow.
	I can see one obvious, issue, but I'm not sure how to work around it. 
 The thing is that a large number of the items don't actually move 
around very much over time, and even if one does move around 
relatively frequently, there may be long stretches where it doesn't. 
Yet, on every display update, I am redrawing all 1000+ artists. I 
feel like there should be some way to move only the points that need 
to be moved, but I'm not sure how to do it. My idea for how to 
improve it is that, for each display update, I would look at which 
bits of text actually do need to move, look at where they currently 
are, calculate which other texts overlap with those moving, then blit 
a blank rectangle onto the "old" positions of the moving items, and 
redraw only the moving items and those that were partially erased by 
the blank. This way items that were nowhere near any change wouldn't 
need to be redrawn.
	Is this feasible? Is there a standard way to go about this? Is 
there any way to figure out which artists overlap without looping over 
the list of all artists and checking the bbox bounds? Any other 
suggestions on how to do it?
Thanks,
-- 
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is 
no path, and leave a trail."
 --author unknown
From: Gökhan S. <gok...@gm...> - 2010年02月10日 06:33:15
On Tue, Feb 9, 2010 at 8:15 PM, Wayne Watson
<sie...@sb...>wrote:
> Subject is the question.
>
> As I see it, it's useful to know MatLab. A simple query with matplotlib
> tutorial shows a number of hits. The first, reference to v0.99.a
> documentation barely qualifies. Examples galore and a pretty minimal
> introduction. In the first 10 or so hits ther's a blog and mention of a
> video. The blog may appeal to some, but it seems unelementary. The video
> basically asks to sign in. Who knows where that goes? I've seen a few
> videos for MPL, but they all look tied into $$.
>
> I've made some reasonable progress on MPL, but am still far short of
> being confident of using it. Too much try this and see.
>
> I know of exactly one book on MPL ( for scientists. sounds interesting).
> It was published recently by a foreign author. It is not yet widely
> distributed.
>
> Your turn. Comments?
> --
> "Crime is way down. War is declining. And that's far from the good
> news." -- Steven Pinker (and other sources) Why is this true, but yet
> the media says otherwise? The media knows very well how to manipulate us
> (see limbic, emotion, $$). -- WTW
>
>
> ------------------------------------------------------------------------------
> SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
> Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
> http://p.sf.net/sfu/solaris-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
For me best way to learn is to use it actually :) Especially on homework and
projects. Mailing lists are also very helpful as you are already doing.
Try with ipython --pylab option.
Also check SciPy09 (http://conference.scipy.org/SciPy2009/) videos. There
are one introductory and advanced tutorials that you can see online (without
registering) or downloading to your computer.
-- 
Gökhan
3 messages has been excluded from this view by a project administrator.

Showing results of 29

1 2 > >> (Page 1 of 2)
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 によって変換されたページ (->オリジナル) /