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
3
(3)
4
(16)
5
(8)
6
(22)
7
(10)
8
(18)
9
(11)
10
(7)
11
(16)
12
(1)
13
(10)
14
(14)
15
(2)
16
(3)
17
(19)
18
(24)
19
(35)
20
(38)
21
(27)
22
(1)
23
(9)
24
(6)
25
(24)
26
(9)
27
(7)
28
(5)
29
(9)
30
(4)






Showing 9 results of 9

From: Cohen-Tanugi J. <co...@lp...> - 2008年11月23日 23:23:06
> hi, I tried your script, commenting/uncommenting the backend line, but 
> I still get:
> [cohen@jarrett ~]$ ipython -pylab MACROS/animation.py
> --------------------------------------------------------------------------- 
>
> AttributeError Traceback (most recent call 
> last)
>
> /home/cohen/MACROS/animation.py in <module>()
> 274 p.show()
> 275
> --> 276 t = test()
> 277
> 278
>
> /home/cohen/MACROS/animation.py in __init__(self)
> 270
> 271 # cid = p.gcf().canvas.mpl_connect('idle_event', 
> self.update)
> --> 272 wx.GetApp().Bind(wx.EVT_IDLE, self.update)
> 273
> 274 p.show()
>
> AttributeError: 'NoneType' object has no attribute 'Bind'
> WARNING: Failure executing file: <MACROS/animation.py>
>
> I am using MPL revision 6440.
> cheers,
> Johann
>
> Eric Bruning wrote:
>> Hi Eric,
>> 
>>> On Fri, Nov 21, 2008 at 11:19 AM, Eric Jonas <jo...@mi...> wrote:
>>> 
>>>> I've looked through the latest examples as well as google and the list
>>>> archives, and am still at a loss -- can anyone point me to an 
>>>> example of
>>>> how to animate a scatter plot?
>>>> 
>>
>> I've attached a somewhat unpolished but functional example that shows
>> time-synchronized animation of multiple scatter plots. It uses the wx
>> backend explicitly, due to some issues with the idle event handling.
>>
>> 
>>>> The collection returned by scatter() lacks anything akin to a 
>>>> set_data method.
>>>> 
>>
>> Yup, you want this instead:
>> collection.set_offsets(xy)
>> collection.set_array(s)
>>
>> -Eric
>> 
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------- 
>>
>> This SF.Net email is sponsored by the Moblin Your Move Developer's 
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win 
>> great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the 
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Joshua L. <dis...@gm...> - 2008年11月23日 22:39:53
The version of NumPy in Chris's superpack should be recent enough for
you to just need to build matplotlib from SVN and not the other stuff,
and I assume he includes installation of wxPython or some other
compatible backend for matplotlib. It's really straightforward; you
just need to get the source from svn and run the setup.py file inside
with the target "install."
Last I checked, if you were using Leopard, a bug in Apple's GCC 4.0
got angry with the -O3 optimisation flag so you had to go into
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config
and edit the Makefile to change "-O3" to "-Os" in the OPT line under
Compiler flags to get around that (there are other methods that are
slightly more complicated that don't sacrifice using O3, but I think
the "Os" change was deemed the easiest thing to do here). I don't know
if this has changed since then, so hopefully John or someone else will
correct me if this is no longer the case in Leopard. Either way, it's
pretty straightforward; just change one line in the Python Makefile
and matplotlib will install with a simple "sudo python setup.py
install"
Josh
On Sun, Nov 23, 2008 at 2:01 PM, Zane Selvans <za...@id...> wrote:
> On Nov 23, 2008, at 12:36 PM, John Hunter wrote:
>
> On Sun, Nov 23, 2008 at 1:26 PM, John Hunter <jd...@gm...> wrote:
>
> The code is much simpler than the fill_between_posneg original
>
> example, which I have just removed from svn.
>
> The fill between use case is common enough that I decided to make it
> an axes/pyplot method. No need to use the intermediate
> "mlab.poly_between" anymore. fill_between has signature::
>
> Sigh.
> I've never been able to get the whole SciPy dependency mess to successfully
> build from source, so I'm running from the OS X Superpack that Chris
> Fonnesbeck puts out at http://macinscience.org Unfortunately some of the
> versions of stuff being pulled in there are kind of stale it looks like.
> Maybe I should give it another go from source or pre-built SVN binaries.
> Has it gotten any easier lately?
> Zane
> --
> Zane Selvans
> Amateur Earthling
> za...@id...
> 303/815-6866
> http://zaneselvans.org
> PGP Key: 55E0815F
>
>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Zane S. <za...@id...> - 2008年11月23日 22:01:35
On Nov 23, 2008, at 12:36 PM, John Hunter wrote:
> On Sun, Nov 23, 2008 at 1:26 PM, John Hunter <jd...@gm...> 
> wrote:
>
>> The code is much simpler than the fill_between_posneg original
>> example, which I have just removed from svn.
>
> The fill between use case is common enough that I decided to make it
> an axes/pyplot method. No need to use the intermediate
> "mlab.poly_between" anymore. fill_between has signature::
Sigh.
I've never been able to get the whole SciPy dependency mess to 
successfully build from source, so I'm running from the OS X Superpack 
that Chris Fonnesbeck puts out at http://macinscience.org 
Unfortunately some of the versions of stuff being pulled in there are 
kind of stale it looks like.
Maybe I should give it another go from source or pre-built SVN 
binaries. Has it gotten any easier lately?
Zane
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F
From: John H. <jd...@gm...> - 2008年11月23日 20:36:05
On Sun, Nov 23, 2008 at 1:26 PM, John Hunter <jd...@gm...> wrote:
> http://matplotlib.sourceforge.net/examples/api/fill_where_demo.html
>
> The code is much simpler than the fill_between_posneg original
> example, which I have just removed from svn.
The fill between use case is common enough that I decided to make it
an axes/pyplot method. No need to use the intermediate
"mlab.poly_between" anymore. fill_between has signature::
 fill_between(x, y1, y2=0, where=None, **kwargs)
y1 or y2 can be scalars or length x arrays. If where is None, the
fill will be make everywhere between y1 and y2. If where is not None,
it is a len(x) np boolean array and the fill will happen only where
where==True.
The examples are all now folded into fill_between.py
http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between.html
JDH
From: John H. <jd...@gm...> - 2008年11月23日 19:27:01
On Sat, Nov 22, 2008 at 6:46 PM, Angus McMorland <am...@gm...> wrote:
> 2008年11月22日 Zane Selvans <za...@id...>:
>> Does anybody know of an easy way to take two intersecting curves, A(x) and
>> B(x), and fill the areas between them only when A(x) < B(x) and not when
>> A(x) > B(x)?
>
> Looks like this example from the new shiny matplotlib website should help:
>
> http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between_posneg.html
Fortuitously, on Friday, I added a couple of methods to the polygon
collections code to make this a lot easier. I just tweaked these
examples to work with the use case in this post. Take a look at
 http://matplotlib.sourceforge.net/examples/api/fill_where_demo.html
The code is much simpler than the fill_between_posneg original
example, which I have just removed from svn.
JDH
From: John H. <jd...@gm...> - 2008年11月23日 15:36:54
On Sun, Nov 23, 2008 at 2:01 AM, Paul Ivanov <piv...@gm...> wrote:
> I took a stab at it, how does this look?
>
> I also took the liberty of adding alpha to LinearSegmentedColormap and
> updated its docstring changing two somewhat ambiguous uses of the word
> 'entry' with 'key' and 'value'.
Hey Paul,
Thanks for taking this on. I haven't tested this but I read the patch
and have some inline comments below. Some additional comments:
 * the patch should include a section in the CHANGELOG and
API_CHANGES letting people know what is different.
 * you should run examples/tests/backend_driver.py and make sure all
the examples still run, checking the output of some of the mappable
types (images, scaltter, pcolor...)
 * it would be nice to have an example in the examples dir which
exercises the new capabilities.
See also, in case you haven't,
http://matplotlib.sourceforge.net/devel/coding_guide.html, which
covers some of this in more detail.
Thanks again! Comments below:
 Index: lib/matplotlib/colors.py
 ===================================================================
 --- lib/matplotlib/colors.py	(revision 6431)
 +++ lib/matplotlib/colors.py	(working copy)
 @@ -452,7 +452,7 @@
 self._isinit = False
 - def __call__(self, X, alpha=1.0, bytes=False):
 + def __call__(self, X, alpha=None, bytes=False):
 """
 *X* is either a scalar or an array (of any dimension).
 If scalar, a tuple of rgba values is returned, otherwise
 @@ -466,9 +466,10 @@
 """
You need to document what alpha can be here: what does None mean, can
it be an array, scalar, etc...
 if not self._isinit: self._init()
 - alpha = min(alpha, 1.0) # alpha must be between 0 and 1
 - alpha = max(alpha, 0.0)
 - self._lut[:-3, -1] = alpha
 + if alpha:
I prefer to explicitly use "if alpha is None", since there are other
things that would test False (0, [], '') that you probably don't mean.
 + alpha = min(alpha, 1.0) # alpha must be between 0 and 1
 + alpha = max(alpha, 0.0)
You should be able to use np.clip(alpha, 0, 1) here, but we should
consider instead raising for illegal alpha values since this will be
more helpful to the user. I realize some of this is inherited code
from before your changes, but we can improve it while making this
patch.
 + self._lut[:-3, -1] = alpha
 mask_bad = None
 if not cbook.iterable(X):
 vtype = 'scalar'
 @@ -558,9 +559,10 @@
 def __init__(self, name, segmentdata, N=256):
 """Create color map from linear mapping segments
 - segmentdata argument is a dictionary with a red, green and blue
 - entries. Each entry should be a list of *x*, *y0*, *y1* tuples,
 - forming rows in a table.
 + segmentdata argument is a dictionary with red, green and blue
 + keys. An optional alpha key is also supported. Each value
 + should be a list of *x*, *y0*, *y1* tuples, forming rows in a
 + table.
 Example: suppose you want red to increase from 0 to 1 over
 the bottom half, green to do the same over the middle half,
 @@ -606,6 +608,8 @@
 self._lut[:-3, 0] = makeMappingArray(self.N,
self._segmentdata['red'])
 self._lut[:-3, 1] = makeMappingArray(self.N,
self._segmentdata['green'])
 self._lut[:-3, 2] = makeMappingArray(self.N,
self._segmentdata['blue'])
 + if self._segmentdata.has_key('alpha'):
 + self._lut[:-3, 3] = makeMappingArray(self.N,
self._segmentdata['blue'])
Is this what you meant? I think you would use 'alpha' rather than
'blue' here, no?
 self._isinit = True
 self._set_extremes()
 @@ -664,11 +668,10 @@
 def _init(self):
 - rgb = np.array([colorConverter.to_rgb(c)
 + rgba = np.array([colorConverter.to_rgba(c)
 for c in self.colors], np.float)
 self._lut = np.zeros((self.N + 3, 4), np.float)
 - self._lut[:-3, :-1] = rgb
 - self._lut[:-3, -1] = 1
 + self._lut[:-3] = rgba
 self._isinit = True
 self._set_extremes()
From: Paul I. <piv...@gm...> - 2008年11月23日 08:01:32
Attachments: rgba_colormap.diff
I took a stab at it, how does this look?
I also took the liberty of adding alpha to LinearSegmentedColormap and
updated its docstring changing two somewhat ambiguous uses of the word
'entry' with 'key' and 'value'.
tested with
In [1]: import matplotlib; import numpy as np
In [2]: my_rgba_array= np.array( [[ 1., 1., 1., 0.65],
 [ 1., 0., 0., 0.79]])
In [3]: myColormap = matplotlib.colors.ListedColormap(my_rgba_array)
In [4]: myColormap.__call__(.1)
Out[4]: (1.0, 1.0, 1.0, 0.65000000000000002)
In [5]: myColormap.__call__(.9)
Out[5]: (1.0, 0.0, 0.0, 0.790000000000000
In [6]: my_rgba_array= np.array( [ [ 1. , 1. , 1. ],
 [ 1. , 0. , 0. ]])
In [7]: myColormap = matplotlib.colors.ListedColormap(my_rgba_array)
In [8]: myColormap.__call__(.1)
Out[8]: (1.0, 1.0, 1.0, 1.0)
In [9]: myColormap.__call__(.9)
Out[9]: (1.0, 0.0, 0.0, 1.0)
cheers,
Paul Ivanov
John Hunter, on 2008年11月21日 05:52, wrote:
> On Fri, Nov 21, 2008 at 2:45 AM, Simon Kammerer <ko...@we...> wrote:
> 
>> After looking at the source of matplotlib.colors, it seems to me that
>> different alpha values are something Colormap is not designed for.
> 
> Yes, it looks like the colormap only holds the RGB channels, but it
> also looks fairly straightforward to patch the code to support the
> fourth channel. Is this something you'd like to tackle?
> 
> JDH
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Angus M. <am...@gm...> - 2008年11月23日 00:46:50
2008年11月22日 Zane Selvans <za...@id...>:
> Does anybody know of an easy way to take two intersecting curves, A(x) and
> B(x), and fill the areas between them only when A(x) < B(x) and not when
> A(x) > B(x)?
Looks like this example from the new shiny matplotlib website should help:
http://matplotlib.sourceforge.net/examples/pylab_examples/fill_between_posneg.html
Angus.
> --
> Zane Selvans
> Amateur Earthling
> za...@id...
> 303/815-6866
> http://zaneselvans.org
> PGP Key: 55E0815F
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh
From: Zane S. <za...@id...> - 2008年11月23日 00:26:37
Does anybody know of an easy way to take two intersecting curves, A(x) 
and B(x), and fill the areas between them only when A(x) < B(x) and 
not when A(x) > B(x)?
--
Zane Selvans
Amateur Earthling
za...@id...
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F

Showing 9 results 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 によって変換されたページ (->オリジナル) /