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




Showing 15 results of 15

From: C M <cmp...@gm...> - 2011年05月12日 19:17:09
On Thu, May 12, 2011 at 2:50 PM, Michael Droettboom <md...@st...> wrote:
> On 05/12/2011 02:34 PM, C M wrote:
>>
>> On Thu, May 12, 2011 at 1:26 PM, Michael Droettboom<md...@st...>
>> wrote:
>>
>>>
>>> You can always get a tarball of the current git master by going here:
>>>
>>> https://github.com/matplotlib/matplotlib
>>>
>>> clicking on "Download" and choosing one of the "download source" options
>>> at the top of the popup box.
>>>
>>> Mike
>>>
>>
>> Thanks, but I'm having trouble using that. I downloaded the .zip
>> file, unzipped the archive, moved the folder to
>> C:\Python25\Lib\site-packages, renamed my current matplotlib folder to
>> matplotlib_OLD, ran these commands from the new directory:
>>
>> python setup.py build
>> python setup.py install
>>
>> And finally renamed the new folder to just matplotlib. It is not
>> finding the modules when I go to run it. If revert the names of the
>> folders, my old folder still works. What am I doing wrong?
>>
>
> You should not expand the directory tree under site-packages -- "python
> setup.py install" is what does that for you. You should expand it anywhere
> else (most people create a "src" directory somewhere on their machine for
> source code). Then run those commands.
I unzipped it in a download directory, changed the directory to that
folder, and ran the commands again...and it did not put a matplotlib
folder under site-packages. Is there a step-by-step method on the
website that shows how to do this?
But all I really want is the changes that Jae Joon made as mentioned
above. Is there a way to just grab them from the new folders? (I
thought not because the folder structure from what I downloaded from
git master doesn't match the folder structure I had from mpl 1.0,
downloaded from the main mpl page).
Thanks,
Che
From: Michael D. <md...@st...> - 2011年05月12日 18:56:38
On 05/12/2011 02:34 PM, C M wrote:
> On Thu, May 12, 2011 at 1:26 PM, Michael Droettboom<md...@st...> wrote:
> 
>> You can always get a tarball of the current git master by going here:
>>
>> https://github.com/matplotlib/matplotlib
>>
>> clicking on "Download" and choosing one of the "download source" options
>> at the top of the popup box.
>>
>> Mike
>> 
> Thanks, but I'm having trouble using that. I downloaded the .zip
> file, unzipped the archive, moved the folder to
> C:\Python25\Lib\site-packages, renamed my current matplotlib folder to
> matplotlib_OLD, ran these commands from the new directory:
>
> python setup.py build
> python setup.py install
>
> And finally renamed the new folder to just matplotlib. It is not
> finding the modules when I go to run it. If revert the names of the
> folders, my old folder still works. What am I doing wrong?
> 
You should not expand the directory tree under site-packages -- "python 
setup.py install" is what does that for you. You should expand it 
anywhere else (most people create a "src" directory somewhere on their 
machine for source code). Then run those commands.
Cheers,
Mike
-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA
From: C M <cmp...@gm...> - 2011年05月12日 18:35:03
On Thu, May 12, 2011 at 1:26 PM, Michael Droettboom <md...@st...> wrote:
> You can always get a tarball of the current git master by going here:
>
> https://github.com/matplotlib/matplotlib
>
> clicking on "Download" and choosing one of the "download source" options
> at the top of the popup box.
>
> Mike
Thanks, but I'm having trouble using that. I downloaded the .zip
file, unzipped the archive, moved the folder to
C:\Python25\Lib\site-packages, renamed my current matplotlib folder to
matplotlib_OLD, ran these commands from the new directory:
python setup.py build
python setup.py install
And finally renamed the new folder to just matplotlib. It is not
finding the modules when I go to run it. If revert the names of the
folders, my old folder still works. What am I doing wrong?
Thanks,
Che
From: Soumyaroop R. <roy...@gm...> - 2011年05月12日 18:26:33
I see. Thanks, Ben.
-Soumyaroop
On Thu, May 12, 2011 at 10:32 AM, Benjamin Root <ben...@ou...> wrote:
> On Thursday, May 12, 2011, Soumyaroop Roy <roy...@gm...> wrote:
>> Here's a short follow up question:
>> Is there a concept of erasing in matplotlib? If I were to erase an
>> axvline that I drew earlier, how would I do that? Can you use del to
>> delete the object and then force a redraw?
>>
>> -Soumyaroop
>>
>> On Mon, May 2, 2011 at 11:35 AM, Soumyaroop Roy
>> <roy...@gm...> wrote:
>>> Thanks Justin. I have the event handling thing in place and was really
>>> looking for drawing options. Thanks for the tips. I'll look into them.
>>> regards,
>>> Soumyaroop
>>>
>>> On Mon, May 2, 2011 at 11:06 AM, Justin McCann <jn...@gm...> wrote:
>>>>
>>>> You'll want to use event handling to figure out where the user clicked,
>>>> and then you have a couple of options: Axes.vlines(), or pylab.axvline(). It
>>>> seems like pylab.axvline() will always span the entire y-axis by default,
>>>> but with Axes.vlines() you need to specify the ymin/ymax. Maybe someone else
>>>> knows of an argument to pass to Axes.vlines() that will always span the
>>>> entire y-axis.
>>>> Here's the code (assuming 'ipython -pylab'):
>>>> ========
>>>> fig = figure()
>>>> plot([1,2,3,4], [5,6,7,8])
>>>> def onclick(event):
>>>>   """Draw a vertical line spanning the axes every time the user clicks
>>>> inside them"""
>>>>   if event.inaxes: # make sure the click was within a set of axes
>>>>     pylab.axvline(event.xdata, axes=event.inaxes, color='r',
>>>> linestyle=':') # red dotted line
>>>>     event.inaxes.figure.canvas.draw() # force a re-draw
>>>> cid = fig.canvas.mpl_connect('button_press_event', onclick) # add the
>>>> click handler
>>>> ... interact with it
>>>> fig.canvas.mpl_disconnect(cid) # get rid of the click-handler
>>>> ========
>>>> Docs:
>>>> Axes.vlines():
>>>> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.vlines
>>>> pyplot.axvline():
>>>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axvline
>>>> Event
>>>> handling: http://matplotlib.sourceforge.net/users/event_handling.html
>>>>
>>>> Example: http://matplotlib.sourceforge.net/examples/event_handling/data_browser.html
>>>>  Justin
>>>>
>>>> On Mon, May 2, 2011 at 10:08 AM, Soumyaroop Roy <roy...@gm...>
>>>> wrote:
>>>>>
>>>>> Any pointers on this?
>>>>> On Sat, Apr 30, 2011 at 12:34 AM, Soumyaroop Roy
>>>>> <roy...@gm...> wrote:
>>>>>>
>>>>>> 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
>>>>>
>>>>>
>
> No, don't use del. If you save the object returned by the call to
> axvline, then you should be able to call its .remove() method.
>
> That should do the proper bookkeeping.
>
> Ben Root
>
From: Michael D. <md...@st...> - 2011年05月12日 17:28:33
You can always get a tarball of the current git master by going here:
https://github.com/matplotlib/matplotlib
clicking on "Download" and choosing one of the "download source" options 
at the top of the popup box.
Mike
On 05/11/2011 11:07 AM, C M wrote:
> On Wed, May 11, 2011 at 11:07 AM, C M<cmp...@gm...> wrote:
> 
>> On Wed, May 11, 2011 at 12:29 AM, Jae-Joon Lee<lee...@gm...> wrote:
>> 
>>> I think I fixed a similar bug at some point but I'm not sure if that
>>> is related with this.
>>> Are you using the *make_axes_area_auto_adjustable* from the current
>>> git master (check
>>> examples/axes_grid/make_room_for_ylabel_using_axesgrid.py)? If not can
>>> you try that? Also please post your code.
>>> 
>> 
> I have not set up with git since Matplotlib made the change from svn.
> I just downloaded git to get started but don't know how to use it yet;
> for now is there a way to just check out the files I need to test
> this, or is there some other (non-git) way to get this update?
>
> Thanks,
> Che
>
> ------------------------------------------------------------------------------
> Achieve unprecedented app performance and reliability
> What every C/C++ and Fortran developer should know.
> Learn how Intel has extended the reach of its next-generation tools
> to help boost performance applications - inlcuding clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> 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: Benjamin R. <ben...@ou...> - 2011年05月12日 15:32:14
On Thursday, May 12, 2011, Soumyaroop Roy <roy...@gm...> wrote:
> Here's a short follow up question:
> Is there a concept of erasing in matplotlib? If I were to erase an
> axvline that I drew earlier, how would I do that? Can you use del to
> delete the object and then force a redraw?
>
> -Soumyaroop
>
> On Mon, May 2, 2011 at 11:35 AM, Soumyaroop Roy
> <roy...@gm...> wrote:
>> Thanks Justin. I have the event handling thing in place and was really
>> looking for drawing options. Thanks for the tips. I'll look into them.
>> regards,
>> Soumyaroop
>>
>> On Mon, May 2, 2011 at 11:06 AM, Justin McCann <jn...@gm...> wrote:
>>>
>>> You'll want to use event handling to figure out where the user clicked,
>>> and then you have a couple of options: Axes.vlines(), or pylab.axvline(). It
>>> seems like pylab.axvline() will always span the entire y-axis by default,
>>> but with Axes.vlines() you need to specify the ymin/ymax. Maybe someone else
>>> knows of an argument to pass to Axes.vlines() that will always span the
>>> entire y-axis.
>>> Here's the code (assuming 'ipython -pylab'):
>>> ========
>>> fig = figure()
>>> plot([1,2,3,4], [5,6,7,8])
>>> def onclick(event):
>>>   """Draw a vertical line spanning the axes every time the user clicks
>>> inside them"""
>>>   if event.inaxes: # make sure the click was within a set of axes
>>>     pylab.axvline(event.xdata, axes=event.inaxes, color='r',
>>> linestyle=':') # red dotted line
>>>     event.inaxes.figure.canvas.draw() # force a re-draw
>>> cid = fig.canvas.mpl_connect('button_press_event', onclick) # add the
>>> click handler
>>> ... interact with it
>>> fig.canvas.mpl_disconnect(cid) # get rid of the click-handler
>>> ========
>>> Docs:
>>> Axes.vlines():
>>> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.vlines
>>> pyplot.axvline():
>>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axvline
>>> Event
>>> handling: http://matplotlib.sourceforge.net/users/event_handling.html
>>>
>>> Example: http://matplotlib.sourceforge.net/examples/event_handling/data_browser.html
>>>  Justin
>>>
>>> On Mon, May 2, 2011 at 10:08 AM, Soumyaroop Roy <roy...@gm...>
>>> wrote:
>>>>
>>>> Any pointers on this?
>>>> On Sat, Apr 30, 2011 at 12:34 AM, Soumyaroop Roy
>>>> <roy...@gm...> wrote:
>>>>>
>>>>> 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
>>>>
>>>>
No, don't use del. If you save the object returned by the call to
axvline, then you should be able to call its .remove() method.
That should do the proper bookkeeping.
Ben Root
From: Johannes R. <JRa...@gm...> - 2011年05月12日 15:10:55
Hello again,
I tried the script you provided to test the PolyCollection and that works fine.
I am working under Mac OS X 10.6.6 Snow Leopard and use matplotlib 1.0.1.
That is the script where I fail with eps but not with pdf:
import matplotlib.pyplot as plt
import numpy
from scipy import stats
p=0.3
m=0
s1min=120
s1max=140
s2min=1200
s2max=1600
x = numpy.arange((s2max*-1.5), (s2max*1.5), 0.2)
def pdf(x,s1,s2):
 return p * stats.norm.pdf(x, loc=m, scale=s1) + (1-p) * stats.norm.pdf(x, loc=m, scale=s2)
pdf_min = pdf(x,s1min,s2min)
pdf_max = pdf(x,s1max,s2max)
plt.plot(x, pdf_min, x, pdf_max, color="k")
plt.fill_between(x, pdf_min, pdf_max, color='0.85')
#plt.show()
#plt.savefig("testplot.eps")
plt.savefig("testplot.pdf")
/Johannes
Am 12.05.2011 um 15:28 schrieb John Hunter:
> 
> 
> On Thu, May 12, 2011 at 3:42 AM, Johannes Radinger <JRa...@gm...> wrote:
> Hello ,
> 
> sofar I know how to safe a plot into a *.eps file and it works good,
> but there is one issue with filled areas between two functions.
> 
> When I try to use:
> plt.fill_between(x, pdf_min, pdf_max, color='0.85')
> 
> and I try to open it on my mac I fail. So far as I know
> is the mac converting the eps internally to pdf to be
> displayed, but it seems it can't be converted.
> 
> If I try to set the output to *.pdf it works perfectly and I can
> open the file. Something in the combination of fill_between
> and eps is causing the error. I tried also color="red" but with
> the same problems.
> 
> Is there anything I've to set because I need the output as
> a working eps.
> 
> 
> under the hool, fill_between uses a PolyCollection. Below is a simple example which uses a PolyCollection directly. Does this crash when you convert eps -> pdf. If not, maybe we can hone in on what is special about the vertices in your fill_between example. Also, you should give us some information about what version of matplotlib and OSX you are running.
> 
> 
> import numpy as np
> import matplotlib.collections as mcollections
> import matplotlib.pyplot as plt
> 
> theta = np.linspace(0, 2*np.pi, 20)
> x1 = np.cos(theta)
> y1 = np.sin(theta)
> 
> x2 = x1 + 5
> y2 = y1 + 5
> 
> verts1 = zip(x1, y1)
> verts2 = zip(x2, y2)
> 
> c = mcollections.PolyCollection([verts1, verts2], facecolors=['red', 'green'])
> 
> ax = plt.subplot(111)
> ax.add_collection(c)
> ax.axis([-5, 10, -5, 10])
> 
> plt.savefig('test.eps')
> plt.show()
> 
From: Soumyaroop R. <roy...@gm...> - 2011年05月12日 14:47:31
Here's a short follow up question:
Is there a concept of erasing in matplotlib? If I were to erase an
axvline that I drew earlier, how would I do that? Can you use del to
delete the object and then force a redraw?
-Soumyaroop
On Mon, May 2, 2011 at 11:35 AM, Soumyaroop Roy
<roy...@gm...> wrote:
> Thanks Justin. I have the event handling thing in place and was really
> looking for drawing options. Thanks for the tips. I'll look into them.
> regards,
> Soumyaroop
>
> On Mon, May 2, 2011 at 11:06 AM, Justin McCann <jn...@gm...> wrote:
>>
>> You'll want to use event handling to figure out where the user clicked,
>> and then you have a couple of options: Axes.vlines(), or pylab.axvline(). It
>> seems like pylab.axvline() will always span the entire y-axis by default,
>> but with Axes.vlines() you need to specify the ymin/ymax. Maybe someone else
>> knows of an argument to pass to Axes.vlines() that will always span the
>> entire y-axis.
>> Here's the code (assuming 'ipython -pylab'):
>> ========
>> fig = figure()
>> plot([1,2,3,4], [5,6,7,8])
>> def onclick(event):
>>   """Draw a vertical line spanning the axes every time the user clicks
>> inside them"""
>>   if event.inaxes: # make sure the click was within a set of axes
>>     pylab.axvline(event.xdata, axes=event.inaxes, color='r',
>> linestyle=':') # red dotted line
>>     event.inaxes.figure.canvas.draw() # force a re-draw
>> cid = fig.canvas.mpl_connect('button_press_event', onclick) # add the
>> click handler
>> ... interact with it
>> fig.canvas.mpl_disconnect(cid) # get rid of the click-handler
>> ========
>> Docs:
>> Axes.vlines():
>> http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.vlines
>> pyplot.axvline():
>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.axvline
>> Event
>> handling: http://matplotlib.sourceforge.net/users/event_handling.html
>>
>> Example: http://matplotlib.sourceforge.net/examples/event_handling/data_browser.html
>>  Justin
>>
>> On Mon, May 2, 2011 at 10:08 AM, Soumyaroop Roy <roy...@gm...>
>> wrote:
>>>
>>> Any pointers on this?
>>> On Sat, Apr 30, 2011 at 12:34 AM, Soumyaroop Roy
>>> <roy...@gm...> wrote:
>>>>
>>>> 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
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> 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: John H. <jd...@gm...> - 2011年05月12日 13:29:20
On Thu, May 12, 2011 at 3:42 AM, Johannes Radinger <JRa...@gm...> wrote:
> Hello ,
>
> sofar I know how to safe a plot into a *.eps file and it works good,
> but there is one issue with filled areas between two functions.
>
> When I try to use:
> plt.fill_between(x, pdf_min, pdf_max, color='0.85')
>
> and I try to open it on my mac I fail. So far as I know
> is the mac converting the eps internally to pdf to be
> displayed, but it seems it can't be converted.
>
> If I try to set the output to *.pdf it works perfectly and I can
> open the file. Something in the combination of fill_between
> and eps is causing the error. I tried also color="red" but with
> the same problems.
>
> Is there anything I've to set because I need the output as
> a working eps.
>
under the hool, fill_between uses a PolyCollection. Below is a simple
example which uses a PolyCollection directly. Does this crash when you
convert eps -> pdf. If not, maybe we can hone in on what is special about
the vertices in your fill_between example. Also, you should give us some
information about what version of matplotlib and OSX you are running.
import numpy as np
import matplotlib.collections as mcollections
import matplotlib.pyplot as plt
theta = np.linspace(0, 2*np.pi, 20)
x1 = np.cos(theta)
y1 = np.sin(theta)
x2 = x1 + 5
y2 = y1 + 5
verts1 = zip(x1, y1)
verts2 = zip(x2, y2)
c = mcollections.PolyCollection([verts1, verts2], facecolors=['red',
'green'])
ax = plt.subplot(111)
ax.add_collection(c)
ax.axis([-5, 10, -5, 10])
plt.savefig('test.eps')
plt.show()
From: _olivier_ <ol...@gm...> - 2011年05月12日 11:48:20
Hello,
I am trying to generate on the fly a non linear rainbow colorbar as in
picture Colorbar below.
I use a slider to automatically modify the aspect of the colorbar (see code
below).
This works fine except that I want to have a different behaviour of the
colorbar when moving the slider:
My wish is to have the limits of the colorbar remain fixed (cmin and cmax),
but the rainbow range should be shrinked (though the tick label of the
colorbar should not be modified).
 
I am seaching around using matplotlib.colors.LinearSegmentedColormap without
any success.
Should in this case the colormap be completly re created each time the
slider moves, or is it possible using any kwargs to automatically change the
behaviour of the colorbar as I wanted ?
Many thanks in advance for any help...
See example below, where the colorbar cmax limit is changed, whereas I
wanted that it remains fixed and the shape of the colorbar rainbow
decreases.
from matplotlib.pylab import *
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
sizeX = 4
sizeY = 21
dims = ( sizeY, sizeX )
data = zeros( dims )
for x in range( 0, sizeX ):
 for y in range( 0, sizeY ):
 data[ y, x ] = y
figure = plt.figure()
axes = figure.add_subplot( 111 )
figure.subplots_adjust(left=0.25, bottom=0.25)
cax = axes.matshow( data, aspect = 'auto', interpolation = 'nearest' )
col = figure.colorbar( cax, spacing='proportional', extend='min' )
vmax = 50
axmax = figure.add_axes([0.25, 0.15, 0.65, 0.03],
axisbg='lightgoldenrodyellow')
smax = Slider( axmax, 'Max', 0, vmax, valinit = vmax )
cax.set_clim( vmin = 0, vmax = vmax )
def update(val):
 
 cax.set_clim( vmin = 0, vmax = smax.val )
 figure.canvas.draw()
 
smax.on_changed( update )
http://old.nabble.com/file/p31602280/Colorbar.png Colorbar.png 
-- 
View this message in context: http://old.nabble.com/Creating-non-linear-colorbar-Colorbar-tp31602280p31602280.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Johannes R. <JRa...@gm...> - 2011年05月12日 08:43:05
Hello ,
sofar I know how to safe a plot into a *.eps file and it works good,
but there is one issue with filled areas between two functions.
When I try to use:
plt.fill_between(x, pdf_min, pdf_max, color='0.85')
and I try to open it on my mac I fail. So far as I know
is the mac converting the eps internally to pdf to be
displayed, but it seems it can't be converted.
If I try to set the output to *.pdf it works perfectly and I can
open the file. Something in the combination of fill_between
and eps is causing the error. I tried also color="red" but with
the same problems.
Is there anything I've to set because I need the output as
a working eps.
/johannes
From: Jae-Joon L. <lee...@gm...> - 2011年05月12日 02:38:37
On Thu, May 12, 2011 at 7:18 AM, David Andrews <irb...@gm...> wrote:
> I'm quite interested in getting involved with mpl development, partly
> as a way to get my head around python & numpy and aid porting a bunch
> of stuff I use over to python from IDL. Unless I'm doing something
> totally wrong by expecting the above snippet to work, then I'd happily
> spend some time looking into this in more detail, having written some
> similar code in IDL. The docs for that module also look like they
> could benefit from some work.
>
Yes, the docs need lots of work I guess and any contribution will be
greatly appreciated.
If you're willing to improve the docs for gridspec, I'm more than
happy to help you (I am the main author of that module).
The best way to contribute is to use github pull request and
matplotlib is hosted here
 https://github.com/matplotlib/matplotlib
Regards,
-JJ
From: Jae-Joon L. <lee...@gm...> - 2011年05月12日 02:28:51
Yes, this is a bug that has been fixed.
https://github.com/matplotlib/matplotlib/commit/76851eb
Regards,
-JJ
On Thu, May 12, 2011 at 7:53 AM, Goyo <goy...@gm...> wrote:
> 2011年5月12日 David Andrews <irb...@gm...>:
>> Hi,
>>
>> I've come across something I don't entirely understand in the
>> behaviour of gridspec. It's not obvious from the code & docs for this
>> module, but is it only supposed to be able to deal with 'square'
>> layouts, e.g. 3x3, 4x4 etc?
>>
>> Taking some code from an example on the gridspec page ...
>>
>> import matplotlib.pylab as plt
>> import matplotlib.gridspec as gridspec
>> #gs = gridspec.GridSpec(3, 3) # OK
>> gs = gridspec.GridSpec(6, 3) # Will cause an error later on
>> ax1 = plt.subplot(gs[0, :])
>> ax2 = plt.subplot(gs[1,:-1])
>> ax3 = plt.subplot(gs[1:,-1])
>> ax4 = plt.subplot(gs[-1,0])
>> ax5 = plt.subplot(gs[-1,-2])
>> plt.show()
>>
>> ... will fail if that line is uncommented, giving an index error.
>
> Works for me.
> Ubuntu 11.04 Natty, stock python 2.7.1 and matplotlib 1.0.1 from
> https://launchpad.net/~valavanisalex/+archive/matplotlib.
>
> ------------------------------------------------------------------------------
> Achieve unprecedented app performance and reliability
> What every C/C++ and Fortran developer should know.
> Learn how Intel has extended the reach of its next-generation tools
> to help boost performance applications - inlcuding clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Jae-Joon L. <lee...@gm...> - 2011年05月12日 02:21:57
On Thu, May 12, 2011 at 2:59 AM, Benjamin Root <ben...@ou...> wrote:
> Most things, we do know the sizes of. It is my understanding that it is the
> text objects that is the unknown. If this could be solved, then a layout
> engine would be much more feasible.
I doubt it. As far as I know, the main reason that things needed to be
drawn is because the location and size of some artist depends on
location and size of other artists.
Unfortunately, with current matplotlib code, most of these things are
determined inside the "draw" method. Therefore, we need to separate
out those things out from the draw method.
Another option, which I think is more feasible, is to implement a
BBoxRenderer which does not draw anything but only update the size and
location of artists.
Regards,
-JJ
> The problem is that even LaTeX has to
> re-render things multiple times to get this right for an arbitrary font. If
> we were to restrict ourselves to particular fonts and package those fonts
> with matplotlib, then we could have an internal table of size information
> for each glyph and compute it on the fly and lay everything out right. But,
> that would cause us to give up significant benefits for another benefit.
From: Jae-Joon L. <lee...@gm...> - 2011年05月12日 01:58:33
On Thu, May 12, 2011 at 2:37 AM, Brendan Barnwell <bre...@br...> wrote:
> One thing I've always wondered: is it fundamentally impossible to change the
> fact that, in matplotlib, you cannot know how big a drawn object will be
> until you actually draw it?
Well, I don't think this is 100% correct. As far as I can see, there
is two issues involved.
 1) size of text may depend on the renderer (since font selection
could be different).
 2) Position of some artist depend on position of other artist (e.g.,
the exact location of axis label depend on sizes of tick labels).
In fact, neither of these "require" drawing. But, the easiest way is
to draw it (primarily due to the second point).
Can you describe what you were doing with your animation?
Matplotlib provide some framework to overcome these limitation (e.g.,
classes in the offsetbox module). And there may be easier ways that
does what you want.
Regards,
-JJ

Showing 15 results of 15

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