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

Showing 12 results of 12

From: Emmanuel M. <ema...@ya...> - 2012年03月30日 23:23:43
Hello all,
I can create a figure
and get the corresponding axes/plots 
for examples:
1/
fig = Figure(figsize=(width, height), dpi=dpi)
ax = gif.add_subplot(111)
2/
fig, ax = plt.subplots()
but I would like to create my plot independently from the figure and assign it to a figure
I code I would like to do something like this
my_ax = Axes(...)
my_ax.plot(x,y)
ax = my_ax
or 
my_ax.set_figure(fig)
How can I create the axes/plot object independently from the figure?
Better yet, how can I assign an axe to a figure?
--
Emmanuel
From: Skipper S. <jss...@gm...> - 2012年03月30日 21:52:34
On Fri, Mar 30, 2012 at 5:45 PM, Tony Yu <ts...@gm...> wrote:
>
> On Fri, Mar 30, 2012 at 4:40 PM, Eric Firing <ef...@ha...> wrote:
>>
>> On 03/30/2012 08:47 AM, Skipper Seabold wrote:
>> > There is probably a simple answer to this, but I don't see it. How can
>> > I pad the axis limits automatically? For instance, in the below
>> > example, the x axis limits are the data points and the y limit is
>> > close. I want to have a function that pads the axis limit at least, by
>> > say, 10% of the range of x past the last data point without having to
>> > take my x values and calculate some sensible x limit. Is this
>> > possible?
>>
>> Does the margins() function or method do what you want?
>>
>>
>> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.margins
>>
>>
>> http://matplotlib.sourceforge.net/api/axes_api.html?highlight=margins#matplotlib.axes.Axes.margins
>>
>> Eric
>>
> Thanks for the tip, Eric. I'm continually surprised by all the useful stuff
> that's nestled in the corners of matplotlib.
>
Indeed. Both solutions are nice. I've never noticed margins before,
even though this is a common issue for me. The documentation isn't all
the clear, what exactly to do with it, but set_xmargin and set_ymargin
cleared that up. Thanks.
Skipper
From: Tony Yu <ts...@gm...> - 2012年03月30日 21:45:34
On Fri, Mar 30, 2012 at 4:40 PM, Eric Firing <ef...@ha...> wrote:
> On 03/30/2012 08:47 AM, Skipper Seabold wrote:
> > There is probably a simple answer to this, but I don't see it. How can
> > I pad the axis limits automatically? For instance, in the below
> > example, the x axis limits are the data points and the y limit is
> > close. I want to have a function that pads the axis limit at least, by
> > say, 10% of the range of x past the last data point without having to
> > take my x values and calculate some sensible x limit. Is this
> > possible?
>
> Does the margins() function or method do what you want?
>
>
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.margins
>
>
> http://matplotlib.sourceforge.net/api/axes_api.html?highlight=margins#matplotlib.axes.Axes.margins
>
> Eric
>
> Thanks for the tip, Eric. I'm continually surprised by all the useful
stuff that's nestled in the corners of matplotlib.
Hmm, it looks like `margins` doesn't support log scales, though. Maybe I'll
submit a PR on this later.
Best,
-Tony
From: Eric F. <ef...@ha...> - 2012年03月30日 20:40:33
On 03/30/2012 08:47 AM, Skipper Seabold wrote:
> There is probably a simple answer to this, but I don't see it. How can
> I pad the axis limits automatically? For instance, in the below
> example, the x axis limits are the data points and the y limit is
> close. I want to have a function that pads the axis limit at least, by
> say, 10% of the range of x past the last data point without having to
> take my x values and calculate some sensible x limit. Is this
> possible?
Does the margins() function or method do what you want?
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.margins
http://matplotlib.sourceforge.net/api/axes_api.html?highlight=margins#matplotlib.axes.Axes.margins
Eric
>
>
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(111)
> x = [1,2,3]
> y = [8125, 9754, 10855]
> ax.plot(x,y,marker='D',ms=12)
> plt.show()
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Tony Yu <ts...@gm...> - 2012年03月30日 20:26:52
On Fri, Mar 30, 2012 at 2:47 PM, Skipper Seabold <jss...@gm...>wrote:
> There is probably a simple answer to this, but I don't see it. How can
> I pad the axis limits automatically? For instance, in the below
> example, the x axis limits are the data points and the y limit is
> close. I want to have a function that pads the axis limit at least, by
> say, 10% of the range of x past the last data point without having to
> take my x values and calculate some sensible x limit. Is this
> possible?
>
>
> import matplotlib.pyplot as plt
> fig = plt.figure()
> ax = fig.add_subplot(111)
> x = [1,2,3]
> y = [8125, 9754, 10855]
> ax.plot(x,y,marker='D',ms=12)
> plt.show()
>
>
A similar issue<http://old.nabble.com/Why-are-bars,-errorbars...-clipped-td33525497.html>came
up recently on the list:
http://old.nabble.com/Why-are-bars,-errorbars...-clipped-td33525497.html
I posted a snippet of
code<http://old.nabble.com/Re%3A-Why-are-bars%2C-errorbars...-clipped-p33526197.html>there.
Ben Root also mentioned `padx` and `pady` parameters, but I was not
able to find them.
Best,
-Tony
From: Skipper S. <jss...@gm...> - 2012年03月30日 18:48:17
There is probably a simple answer to this, but I don't see it. How can
I pad the axis limits automatically? For instance, in the below
example, the x axis limits are the data points and the y limit is
close. I want to have a function that pads the axis limit at least, by
say, 10% of the range of x past the last data point without having to
take my x values and calculate some sensible x limit. Is this
possible?
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
x = [1,2,3]
y = [8125, 9754, 10855]
ax.plot(x,y,marker='D',ms=12)
plt.show()
From: Mateusz J B. <mbu...@we...> - 2012年03月30日 17:19:12
Hello,
I am trying to download matplot (matplotlib-1.1.0) but at the start of the
download I get a screen that says "Python version 2.7 required, which was
not found in the registry."
I have python 2.7. Where exactly should I save mathplotlib so that it can
find python for the installation?
Many thanks,
Matt.
From: eoj <jos...@gm...> - 2012年03月30日 16:26:03
Basically the problem is like this. I have a relatively expensive (time wise)
figure to create, specifically a map with lots of detail in it. On top of
that, I'm making an inset set of axes to highlight some regions. I'm having
to recreate the base of the map, which is static, every time I want to make
an inset for a different region which is taking forever. What I want to do
is something like this: 
fig = figure()
#do stuff that makes the expensive figure
for region in regions:
 fig2 = copy.copy(fig)
 ax2 = fig.add_axes([0.1, 0.15, 0.25, 0.25])
 ax2.fill(x1,y1)
 savefig(region_name)
 close()
The problem is that the clf() clear figure function seems to clear the base
of the map off, even if I try to make a copy of it inside a loop that is
generating the insets. Also, close() seems to close fig and not fig2. Does
this rambling make any sense, and if so, any suggestions? 
-- 
View this message in context: http://old.nabble.com/Copying-a-figure-instance--tp33544918p33544918.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Francesco M. <fra...@go...> - 2012年03月30日 12:46:06
Dear Dorm,
Il 30 marzo 2012 14:17, Dorm Eight <dor...@ya...> ha scritto:
> Dear Francesco,
> Yes, I just tried it, it can be save perfectly.
so might be a problem with the backend.
Give a look to this page:
http://stackoverflow.com/questions/2512225/matplotlib-not-showing-up-in-mac-osx
and try to change the backend.
I think that I cannot help much more here. Does anyone else has an
idea if there might be any other problem?
Cheers,
Francesco
>
> ________________________________
> From: Francesco Montesano <fra...@go...>
> To: Dorm Eight <dor...@ya...>; mat...@li...
> Sent: Friday, March 30, 2012 8:01 PM
>
> Subject: Re: [Matplotlib-users] (no subject)
>
>> ________________________________
>> From: Francesco Montesano <fra...@go...>
>> To: Dorm Eight <dor...@ya...>
>> Cc: "mat...@li..."
>> <mat...@li...>
>> Sent: Tuesday, March 27, 2012 3:38 PM
>> Subject: Re: [Matplotlib-users] (no subject)
>>
>> Il 27 marzo 2012 05:08, Dorm Eight <dor...@ya...> ha scritto:
>>> hi, everybody!
>>>
>>> when I run my script, why there is no figure show up? I downloaded the
>>> demos
>>> from matplotlib gallery and it didn't work either.
>>>>>>
>>>>>> x=np.arange(100)
>>>>>> y=x**2+3*x-1
>>>>>> pl.plot(x,y)
>>> [<matplotlib.lines.Line2D object at 0x2581050>]
>>>>>> pl.show()
>>>>>>
>>> there is no error, no figure pop-up!
>>>
>>> Thank you for any answer!
>>>
>>
>> Hi Dorm
>> If you can send more info about the operating system and matplotlib
>> version, it's easier to help you
>> (for the latter do
>> import matplotlib
>> print matplotlib.__version__
>> )
>>
>> Cheers,
>> Francesco
>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> This SF email is sponsosred by:
>>> Try Windows Azure free for 90 days Click Here
>>> http://p.sf.net/sfu/sfd2d-msazure
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>>Il 30 marzo 2012 13:23, Dorm Eight <dor...@ya...> ha scritto:
>
> Dear Dorm,
>
> please reply to all the list.
>> My system is Fedora 3.3.0-4.fc16.x86_64, after I recently updated the
>> system with 'yum update', the problem appeared.
>> the Matplotlib version is 1.10. I have no idea at all now.
>
> I've tested your small example on python 2.6, matplotlib 1.0.0 with
> MacOSX backend and on Kubuntu 11.04, python 2.7, matplotlib 1.1, with
> TkAgg and Qt4Agg backends and the small code works for me. In all
> cases I have set "plt.ion()"
>
> If you save the figure instead of showing, does it work?
> Which backend are you using: the name is stored in
> "matplotlib.backends.backend"
>
> Cheers
> Francesco
>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Dorm E. <dor...@ya...> - 2012年03月30日 12:17:13
DearFrancesco,
Yes, I just tried it, it can be save perfectly.
________________________________
 From: Francesco Montesano <fra...@go...>
To: Dorm Eight <dor...@ya...>; mat...@li... 
Sent: Friday, March 30, 2012 8:01 PM
Subject: Re: [Matplotlib-users] (no subject)
 
> ________________________________
> From: Francesco Montesano <fra...@go...>
> To: Dorm Eight <dor...@ya...>
> Cc: "mat...@li..."
> <mat...@li...>
> Sent: Tuesday, March 27, 2012 3:38 PM
> Subject: Re: [Matplotlib-users] (no subject)
>
> Il 27 marzo 2012 05:08, Dorm Eight <dor...@ya...> ha scritto:
>> hi, everybody!
>>
>> when I run my script, why there is no figure show up? I downloaded the
>> demos
>> from matplotlib gallery and it didn't work either.
>>>>>
>>>>> x=np.arange(100)
>>>>> y=x**2+3*x-1
>>>>> pl.plot(x,y)
>> [<matplotlib.lines.Line2D object at 0x2581050>]
>>>>> pl.show()
>>>>>
>> there is no error, no figure pop-up!
>>
>> Thank you for any answer!
>>
>
> Hi Dorm
> If you can send more info about the operating system and matplotlib
> version, it's easier to help you
> (for the latter do
> import matplotlib
> print matplotlib.__version__
> )
>
> Cheers,
> Francesco
>
>>
>> ------------------------------------------------------------------------------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>Il 30 marzo 2012 13:23, Dorm Eight <dor...@ya...> ha scritto:
Dear Dorm,
please reply to all the list.
> My system is Fedora 3.3.0-4.fc16.x86_64, after I recently updated the
> system with 'yum update', the problem appeared.
> the Matplotlib version is 1.10. I have no idea at all now.
I've tested your small example on python 2.6, matplotlib 1.0.0 with
MacOSX backend and on Kubuntu 11.04, python 2.7, matplotlib 1.1, with
TkAgg and Qt4Agg backends and the small code works for me. In all
cases I have set "plt.ion()"
If you save the figure instead of showing, does it work?
Which backend are you using: the name is stored in "matplotlib.backends.backend"
Cheers
Francesco
From: Francesco M. <fra...@go...> - 2012年03月30日 12:02:23
> ________________________________
> From: Francesco Montesano <fra...@go...>
> To: Dorm Eight <dor...@ya...>
> Cc: "mat...@li..."
> <mat...@li...>
> Sent: Tuesday, March 27, 2012 3:38 PM
> Subject: Re: [Matplotlib-users] (no subject)
>
> Il 27 marzo 2012 05:08, Dorm Eight <dor...@ya...> ha scritto:
>> hi, everybody!
>>
>> when I run my script, why there is no figure show up? I downloaded the
>> demos
>> from matplotlib gallery and it didn't work either.
>>>>>
>>>>> x=np.arange(100)
>>>>> y=x**2+3*x-1
>>>>> pl.plot(x,y)
>> [<matplotlib.lines.Line2D object at 0x2581050>]
>>>>> pl.show()
>>>>>
>> there is no error, no figure pop-up!
>>
>> Thank you for any answer!
>>
>
> Hi Dorm
> If you can send more info about the operating system and matplotlib
> version, it's easier to help you
> (for the latter do
> import matplotlib
> print matplotlib.__version__
> )
>
> Cheers,
> Francesco
>
>>
>> ------------------------------------------------------------------------------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>Il 30 marzo 2012 13:23, Dorm Eight <dor...@ya...> ha scritto:
Dear Dorm,
please reply to all the list.
> My system is Fedora 3.3.0-4.fc16.x86_64, after I recently updated the
> system with 'yum update', the problem appeared.
> the Matplotlib version is 1.10. I have no idea at all now.
I've tested your small example on python 2.6, matplotlib 1.0.0 with
MacOSX backend and on Kubuntu 11.04, python 2.7, matplotlib 1.1, with
TkAgg and Qt4Agg backends and the small code works for me. In all
cases I have set "plt.ion()"
If you save the figure instead of showing, does it work?
Which backend are you using: the name is stored in "matplotlib.backends.backend"
Cheers
Francesco
From: Chao Y. <cha...@gm...> - 2012年03月30日 08:10:15
Hi Tony,
thanks! the first one works but not lambda x : 1-x. The function might be
useful while it needs a little bit knowledge of colors.
cheers,
Chao
2012年3月29日 Tony Yu <ts...@gm...>
>
>
> On Thu, Mar 29, 2012 at 1:31 PM, Chao YUE <cha...@gm...> wrote:
>
>> Dear all,
>>
>> here in cookbook it says "Ever wanted to reverse a colormap, or to
>> desaturate one ? Here is a routine to apply a function to the look up table
>> of a colormap: "
>> http://www.scipy.org/Cookbook/Matplotlib/ColormapTransformations
>>
>> but I don't know how to use cmap_map function as in the link to reverse,
>> for example, the cm.jet colormap?
>>
>
>
> If all you want is the reversed colormap, you can call `cm.jet_r` (all the
> default colormaps have a `_r` version). From a *quick* look at the example
> you link to, it seems that you can pass `lambda x: 1 - x` as the function
> to `cmap_xmap`.
>
> Cheers,
> -Tony
>
> (Chao: Sorry for the duplicate. Forgot to reply-all)
>
>
>> thanks,
>>
>> Chao
>> --
>>
>> ***********************************************************************************
>> Chao YUE
>> Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
>> UMR 1572 CEA-CNRS-UVSQ
>> Batiment 712 - Pe 119
>> 91191 GIF Sur YVETTE Cedex
>> Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
>>
>> ************************************************************************************
>>
>>
>>
>> ------------------------------------------------------------------------------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************

Showing 12 results of 12

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