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

Showing results of 141

<< < 1 2 3 4 .. 6 > >> (Page 2 of 6)
From: zetah <ot...@hu...> - 2013年05月28日 07:51:24
Hi,
if I use something like this:
==================================================
import numpy as np
import matplotlib.pyplot as plt
def draw_fig(arr, fn):
 fig = plt.figure()
 ax = fig.add_subplot(111)
 ax.contourf(arr)
 plt.savefig(fn)
if __name__ == '__main__':
	for i in range(10):
		draw_fig(np.random.random((10, 10)), 'fig_%02d.png' % i)
==================================================
memory usage grows with every loop, so I can't plot this way many sequences.
I know there is animation class in Matplotlib, but this way is easier to me, and I think I miss something fundamental because this is happening. How can I avoid memory leak using this approach?
Thanks
From: Nils W. <ni...@go...> - 2013年05月28日 07:50:11
Hi all,
I would like to add a legend to a 3D plot.
However, the legend ist not visible in the example given below.
Am I missing something ?
Nils
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import random
def fun(x, y):
 return x**2 + y
def fun1(x, y):
 return 10+x**2 + y
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = y = np.arange(-3.0, 3.0, 0.05)
X, Y = np.meshgrid(x, y)
zs = np.array([fun(x,y) for x,y in zip(np.ravel(X), np.ravel(Y))])
Z = zs.reshape(X.shape)
zs = np.array([fun1(x,y) for x,y in zip(np.ravel(X), np.ravel(Y))])
Z1 = zs.reshape(X.shape)
ax.plot_surface(X, Y, Z, label=r'$f$')
ax.plot_surface(X, Y, Z1,label=r'$f_1$')
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
ax.legend()
plt.show()
From: John <was...@gm...> - 2013年05月27日 08:46:16
http://matplotlib.1069221.n5.nabble.com/Plotting-curves-filled-with-nonuniform-color-patch-td25773.html
Raising an old thread here, but does anyone know how to make this work with
'fill_between'?
From: klo uo <kl...@gm...> - 2013年05月25日 20:15:02
Ah, right. There was indeed new.pyc file in folder I was working in.
Thanks
On Sat, May 25, 2013 at 9:47 PM, Christoph Gohlke <cg...@uc...> wrote:
> On 5/25/2013 12:37 PM, klo uo wrote:
> > Out of the blue, I started getting this messages while plotting with MPL
> > 1.2.1:
> >
> > ========================================
> > Traceback (most recent call last):
> > File
> > "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py", line
> > 244, in mouseMoveEvent
> > FigureCanvasBase.motion_notify_event( self, x, y )
> > File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py",
> > line 1724, in motion_notify_event
> > self.callbacks.process(s, event)
> > File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 343,
> > in process
> > proxy(*args, **kwargs)
> > File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 215,
> > in __call__
> > mtd = new.instancemethod(self.func, self.inst(), self.klass)
> > AttributeError: 'module' object has no attribute 'instancemethod'
> > ========================================
> >
> > I didn't install any new package or change my Python installation in any
> > way, which makes this hard for me to solve. The message appears when I
> > move my mouse pointer inside plot window. I first removed matplotlibrc
> > from my "home" folder, and it happens again regardless backend changed
> > this way from wx to tk (which is default). I set backend to qt4 also,
> > but it's just the same.
> >
> > Any ideas?
> >
>
> There is likely a `new` module in sys.path that shadows Python's builtin
> new module. Add a `import new;print(new.__file__)` statement at the top
> of your script. It should output 'X:\\Python27\\lib\\new.pyc'
>
> Christoph
>
>
From: Christoph G. <cg...@uc...> - 2013年05月25日 19:47:39
On 5/25/2013 12:37 PM, klo uo wrote:
> Out of the blue, I started getting this messages while plotting with MPL
> 1.2.1:
>
> ========================================
> Traceback (most recent call last):
> File
> "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py", line
> 244, in mouseMoveEvent
> FigureCanvasBase.motion_notify_event( self, x, y )
> File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py",
> line 1724, in motion_notify_event
> self.callbacks.process(s, event)
> File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 343,
> in process
> proxy(*args, **kwargs)
> File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 215,
> in __call__
> mtd = new.instancemethod(self.func, self.inst(), self.klass)
> AttributeError: 'module' object has no attribute 'instancemethod'
> ========================================
>
> I didn't install any new package or change my Python installation in any
> way, which makes this hard for me to solve. The message appears when I
> move my mouse pointer inside plot window. I first removed matplotlibrc
> from my "home" folder, and it happens again regardless backend changed
> this way from wx to tk (which is default). I set backend to qt4 also,
> but it's just the same.
>
> Any ideas?
>
There is likely a `new` module in sys.path that shadows Python's builtin 
new module. Add a `import new;print(new.__file__)` statement at the top 
of your script. It should output 'X:\\Python27\\lib\\new.pyc'
Christoph
From: klo uo <kl...@gm...> - 2013年05月25日 19:37:15
Out of the blue, I started getting this messages while plotting with MPL
1.2.1:
========================================
Traceback (most recent call last):
 File "C:\Python27\lib\site-packages\matplotlib\backends\backend_qt4.py",
line 244, in mouseMoveEvent
 FigureCanvasBase.motion_notify_event( self, x, y )
 File "C:\Python27\lib\site-packages\matplotlib\backend_bases.py", line
1724, in motion_notify_event
 self.callbacks.process(s, event)
 File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 343, in
process
 proxy(*args, **kwargs)
 File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 215, in
__call__
 mtd = new.instancemethod(self.func, self.inst(), self.klass)
AttributeError: 'module' object has no attribute 'instancemethod'
========================================
I didn't install any new package or change my Python installation in any
way, which makes this hard for me to solve. The message appears when I move
my mouse pointer inside plot window. I first removed matplotlibrc from my
"home" folder, and it happens again regardless backend changed this way
from wx to tk (which is default). I set backend to qt4 also, but it's just
the same.
Any ideas?
From: ChaoYue <cha...@gm...> - 2013年05月25日 12:22:24
Hi Mat,
Just one words, the plt.xxxx functions probably normally pick the last
active axes to act on.
many of these functions are methods of axes object, you can call directly
from there.
Chao
On Sat, May 25, 2013 at 1:14 PM, mat [via matplotlib] <
ml-...@n5...> wrote:
> Perfect!! Many thanks!
>
>
> 2013年5月25日 ChaoYue [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41131&i=0>
> >
>
>> Is this what you want?
>>
>> I change a bit of the code and put some example data there.
>>
>>
>> fig,axs = plt.subplots(nrows=2, ncols = 2, figsize = (6, 6) )
>>
>>
>> plt.subplots_adjust( left = 0.0505, right = 0.96, bottom = 0.05, top =
>> 0.95 , wspace = 0.07, hspace = 0.12)
>>
>> left_ax, right_ax =
>> Axes_Replace_Split_Axes(fig,axs[1,1],split_fraction=[0.48,0.02,0.50],direction='h')
>>
>> Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')
>>
>> #left_ax.set_xlim(-0.05, 0.29)
>>
>> #left_ax.set_xticks (np.arange (0, 0.3, 0.1))
>>
>> #right_ax.set_xticks (np.arange (0.7, 1.05, 0.1))
>>
>> #right_ax.set_xlim(0.71, 1)
>>
>> left_ax.plot(np.arange(10),'ro')
>> right_ax.plot(np.arange(10),'ro')
>> left_ax.set_xlim(0,10)
>> right_ax.set_xlim(0,10)
>> left_ax.set_ylim(0,15)
>> right_ax.set_ylim(0,40)
>>
>> cheers,
>>
>> Chao
>>
>> On Sat, May 25, 2013 at 11:54 AM, mat [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41130&i=0>
>> > wrote:
>>
>>> Great!
>>>
>>> The code is almost finished:
>>>
>>> fig,axs = plt.subplots(nrows=2, ncols = 2, figsize = (11, 10) )
>>>
>>> plt.subplots_adjust( left = 0.0505, right = 0.96, bottom = 0.05, top =
>>> 0.95 , wspace = 0.07, hspace = 0.12)
>>>
>>> left_ax, right_ax =
>>> Axes_Replace_Split_Axes(fig,axs[1,1],split_fraction=[0.48,0.02,0.50],direction='h')
>>>
>>> Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')
>>>
>>> left_ax.set_xlim(-0.05, 0.29)
>>>
>>> left_ax.set_xticks (np.arange (0, 0.3, 0.1))
>>>
>>> right_ax.set_xticks (np.arange (0.7, 1.05, 0.1))
>>>
>>> right_ax.set_xlim(0.71, 1)
>>>
>>>
>>>
>>>
>>>
>>> All what I need now is to manipulate the ylim of the truncated subplot
>>> (independently for the left and right y axes). plt.ylim(300, 500) only
>>> modifies the right yaxis of the truncated plot, not the left one. Is it
>>> possible to modify the left y axis of the truncated plot?
>>>
>>>
>>>
>>>
>>>
>>>
>>> 2013年5月24日 ChaoYue [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41129&i=0>
>>> >
>>>
>>>> Hi Mat,
>>>>
>>>>
>>>> so you have two points in the TODO:
>>>> #TODO: #plot something on the left side of suplot 2 -->
>>>> plt.plot(xx,yy, marker = 'o', color = 'k') does not work
>>>> #change the y axis of suplot 2, on the right and on the left
>>>> side
>>>>
>>>> the first one, is this what you want?
>>>> left_ax.plot(xx,yy, marker = 'o', color = 'k')
>>>>
>>>> the second one, I don't get well, are you meaning something like:
>>>> left_ax.set_ylim(....)?
>>>>
>>>> cheers,
>>>>
>>>> Chao
>>>>
>>>> On Fri, May 24, 2013 at 2:36 PM, mat [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41124&i=0>
>>>> > wrote:
>>>>
>>>>> Hi Chao,
>>>>>
>>>>> Please find attached the script which includes your 3 functions, and a
>>>>> plot that I've just made. The things I can't manage to do are listed in the
>>>>> TODO section (end of the script)
>>>>>
>>>>>
>>>>> Cheers,
>>>>> Mat
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 2013年5月24日 ChaoYue [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41123&i=0>
>>>>> >
>>>>>
>>>>> Hi, could you send an attachment to show what you've achieved so far?
>>>>>>
>>>>>> Chao
>>>>>>
>>>>>> ------------------------------
>>>>>> If you reply to this email, your message will be added to the
>>>>>> discussion below:
>>>>>>
>>>>>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41122.html
>>>>>> To unsubscribe from Is it possible to truncate axes in matplotlib?, click
>>>>>> here.
>>>>>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>>>
>>>>>
>>>>>
>>>>> *truncated_plot.py* (11K) Download Attachment<http://matplotlib.1069221.n5.nabble.com/attachment/41123/0/truncated_plot.py>
>>>>>
>>>>>
>>>>> ------------------------------
>>>>> If you reply to this email, your message will be added to the
>>>>> discussion below:
>>>>>
>>>>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41123.html
>>>>> To start a new topic under matplotlib - users, email [hidden email]<http://user/SendEmail.jtp?type=node&node=41124&i=1>
>>>>> To unsubscribe from matplotlib, click here.
>>>>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> ***********************************************************************************
>>>> 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
>>>>
>>>> ************************************************************************************
>>>>
>>>>
>>>> ------------------------------
>>>> If you reply to this email, your message will be added to the
>>>> discussion below:
>>>>
>>>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41124.html
>>>> To unsubscribe from Is it possible to truncate axes in matplotlib?, click
>>>> here.
>>>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>
>>>
>>>
>>>
>>> ------------------------------
>>> If you reply to this email, your message will be added to the
>>> discussion below:
>>>
>>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41129.html
>>> To start a new topic under matplotlib - users, email [hidden email]<http://user/SendEmail.jtp?type=node&node=41130&i=1>
>>> To unsubscribe from matplotlib, click here.
>>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>>
>>
>>
>> --
>>
>> ***********************************************************************************
>> 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
>>
>> ************************************************************************************
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41130.html
>> To unsubscribe from Is it possible to truncate axes in matplotlib?, click
>> here.
>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41131.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
***********************************************************************************
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
************************************************************************************
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41132.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: ChaoYue <cha...@gm...> - 2013年05月25日 10:40:02
Is this what you want?
I change a bit of the code and put some example data there.
fig,axs = plt.subplots(nrows=2, ncols = 2, figsize = (6, 6) )
plt.subplots_adjust( left = 0.0505, right = 0.96, bottom = 0.05, top = 0.95
, wspace = 0.07, hspace = 0.12)
left_ax, right_ax =
Axes_Replace_Split_Axes(fig,axs[1,1],split_fraction=[0.48,0.02,0.50],direction='h')
Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')
#left_ax.set_xlim(-0.05, 0.29)
#left_ax.set_xticks (np.arange (0, 0.3, 0.1))
#right_ax.set_xticks (np.arange (0.7, 1.05, 0.1))
#right_ax.set_xlim(0.71, 1)
left_ax.plot(np.arange(10),'ro')
right_ax.plot(np.arange(10),'ro')
left_ax.set_xlim(0,10)
right_ax.set_xlim(0,10)
left_ax.set_ylim(0,15)
right_ax.set_ylim(0,40)
cheers,
Chao
On Sat, May 25, 2013 at 11:54 AM, mat [via matplotlib] <
ml-...@n5...> wrote:
> Great!
>
> The code is almost finished:
>
> fig,axs = plt.subplots(nrows=2, ncols = 2, figsize = (11, 10) )
>
> plt.subplots_adjust( left = 0.0505, right = 0.96, bottom = 0.05, top =
> 0.95 , wspace = 0.07, hspace = 0.12)
>
> left_ax, right_ax =
> Axes_Replace_Split_Axes(fig,axs[1,1],split_fraction=[0.48,0.02,0.50],direction='h')
>
> Axes_Set_Breakaxis(left_ax, right_ax, 0.03,0.02,'h')
>
> left_ax.set_xlim(-0.05, 0.29)
>
> left_ax.set_xticks (np.arange (0, 0.3, 0.1))
>
> right_ax.set_xticks (np.arange (0.7, 1.05, 0.1))
>
> right_ax.set_xlim(0.71, 1)
>
>
>
>
>
> All what I need now is to manipulate the ylim of the truncated subplot
> (independently for the left and right y axes). plt.ylim(300, 500) only
> modifies the right yaxis of the truncated plot, not the left one. Is it
> possible to modify the left y axis of the truncated plot?
>
>
>
>
>
>
> 2013年5月24日 ChaoYue [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41129&i=0>
> >
>
>> Hi Mat,
>>
>>
>> so you have two points in the TODO:
>> #TODO: #plot something on the left side of suplot 2 --> plt.plot(xx,yy,
>> marker = 'o', color = 'k') does not work
>> #change the y axis of suplot 2, on the right and on the left side
>>
>> the first one, is this what you want?
>> left_ax.plot(xx,yy, marker = 'o', color = 'k')
>>
>> the second one, I don't get well, are you meaning something like:
>> left_ax.set_ylim(....)?
>>
>> cheers,
>>
>> Chao
>>
>> On Fri, May 24, 2013 at 2:36 PM, mat [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41124&i=0>
>> > wrote:
>>
>>> Hi Chao,
>>>
>>> Please find attached the script which includes your 3 functions, and a
>>> plot that I've just made. The things I can't manage to do are listed in the
>>> TODO section (end of the script)
>>>
>>>
>>> Cheers,
>>> Mat
>>>
>>>
>>>
>>>
>>> 2013年5月24日 ChaoYue [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41123&i=0>
>>> >
>>>
>>> Hi, could you send an attachment to show what you've achieved so far?
>>>>
>>>> Chao
>>>>
>>>> ------------------------------
>>>> If you reply to this email, your message will be added to the
>>>> discussion below:
>>>>
>>>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41122.html
>>>> To unsubscribe from Is it possible to truncate axes in matplotlib?, click
>>>> here.
>>>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>
>>>
>>>
>>> *truncated_plot.py* (11K) Download Attachment<http://matplotlib.1069221.n5.nabble.com/attachment/41123/0/truncated_plot.py>
>>>
>>>
>>> ------------------------------
>>> If you reply to this email, your message will be added to the
>>> discussion below:
>>>
>>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41123.html
>>> To start a new topic under matplotlib - users, email [hidden email]<http://user/SendEmail.jtp?type=node&node=41124&i=1>
>>> To unsubscribe from matplotlib, click here.
>>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>
>>
>>
>>
>> --
>>
>> ***********************************************************************************
>> 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
>>
>> ************************************************************************************
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41124.html
>> To unsubscribe from Is it possible to truncate axes in matplotlib?, click
>> here.
>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41129.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
***********************************************************************************
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
************************************************************************************
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41130.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: ChaoYue <cha...@gm...> - 2013年05月24日 13:39:40
Hi Mat,
so you have two points in the TODO:
#TODO: #plot something on the left side of suplot 2 --> plt.plot(xx,yy,
marker = 'o', color = 'k') does not work
 #change the y axis of suplot 2, on the right and on the left side
the first one, is this what you want?
left_ax.plot(xx,yy, marker = 'o', color = 'k')
the second one, I don't get well, are you meaning something like:
left_ax.set_ylim(....)?
cheers,
Chao
On Fri, May 24, 2013 at 2:36 PM, mat [via matplotlib] <
ml-...@n5...> wrote:
> Hi Chao,
>
> Please find attached the script which includes your 3 functions, and a
> plot that I've just made. The things I can't manage to do are listed in the
> TODO section (end of the script)
>
>
> Cheers,
> Mat
>
>
>
>
> 2013年5月24日 ChaoYue [via matplotlib] <[hidden email]<http://user/SendEmail.jtp?type=node&node=41123&i=0>
> >
>
>> Hi, could you send an attachment to show what you've achieved so far?
>>
>> Chao
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41122.html
>> To unsubscribe from Is it possible to truncate axes in matplotlib?, click
>> here.
>> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> *truncated_plot.py* (11K) Download Attachment<http://matplotlib.1069221.n5.nabble.com/attachment/41123/0/truncated_plot.py>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41123.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
***********************************************************************************
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
************************************************************************************
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41124.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: ChaoYue <cha...@gm...> - 2013年05月24日 12:27:42
Hi, could you send an attachment to show what you've achieved so far?
Chao
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41122.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Jae-Joon L. <lee...@gm...> - 2013年05月24日 00:19:58
I do not have any access to mpl 0.98 so I cannot tell for sure. My guess is
that you have been using a feature that has not been intended, that has
fixed at some point. The first argument to legend should be a list of
artists. And pie2010 is a tuple of a list of patches and a list of texts,
i.e., they are not compatible with the current implementation of legend.
Maybe the below is what you wanted?
plt.legend( (pie2010[0]), ...)
Regards,
-JJ
On Fri, May 24, 2013 at 6:19 AM, Paul Hobson <pmh...@gm...> wrote:
> Sorry I have to be so brief, but just like the error says, you fed the
> legend function the wedges returned by the pie command. But legend can't
> handle wedges. As the proxy artist tutorial hints, you need to feed it
> rectangles created manually (i.e., outside of any plotting commands).
>
> Hope that gets you started,
> -paul
>
>
> On Wed, May 22, 2013 at 8:06 AM, oyster <lep...@gm...> wrote:
>
>> the following code runs ok with py2.4 and matplotlib.0.98.3
>> however no legend appears with py2.7.3 and matplotlib-1.2.1/1.3. and I get
>> [quote]
>> e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629:
>> U
>> serWarning: Legend does not support [<matplotlib.patches.Wedge object at
>> 0x03842
>> 0F0>, <matplotlib.patches.Wedge object at 0x03842530>,
>> <matplotlib.patches.Wedge
>> object at 0x03842930>, <matplotlib.patches.Wedge object at 0x03842D30>,
>> <matplo
>> tlib.patches.Wedge object at 0x038B0150>]
>> Use proxy artist instead.
>>
>>
>> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>>
>> (str(orig_handle),))
>> e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629:
>> U
>> serWarning: Legend does not support [<matplotlib.text.Text object at
>> 0x03842310>
>> , <matplotlib.text.Text object at 0x03842750>, <matplotlib.text.Text
>> object at 0
>> x03842B50>, <matplotlib.text.Text object at 0x03842F50>,
>> <matplotlib.text.Text o
>> bject at 0x038B0370>]
>> Use proxy artist instead.
>>
>>
>> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>>
>> (str(orig_handle),))
>> [/quote]
>>
>> what's the matter? thanks
>>
>> [code]
>> #coding=utf-8
>> from pylab import *
>>
>> val2010 = [2, 10, 20, 15, 3]
>>
>> figure()
>>
>> pie2010=pie(val2010, labels=[u'%i persons' % i for i in val2010])
>>
>> plt.legend( (pie2010), [u'<60', u'60~70', u'70~80', u'80~90',
>> u'90~100'], loc = 'best', bbox_to_anchor = (0.90, 0.75) )
>> axis('equal')
>>
>> show()
>> [/code]
>>
>>
>> ------------------------------------------------------------------------------
>> Try New Relic Now & We'll Send You this Cool Shirt
>> New Relic is the only SaaS-based application performance monitoring
>> service
>> that delivers powerful full stack analytics. Optimize and monitor your
>> browser, app, & servers with just a few lines of code. Try New Relic
>> and get this awesome Nerd Life shirt!
>> http://p.sf.net/sfu/newrelic_d2d_may
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: Paul H. <pmh...@gm...> - 2013年05月23日 21:21:18
Sorry I have to be so brief, but just like the error says, you fed the
legend function the wedges returned by the pie command. But legend can't
handle wedges. As the proxy artist tutorial hints, you need to feed it
rectangles created manually (i.e., outside of any plotting commands).
Hope that gets you started,
-paul
On Wed, May 22, 2013 at 8:06 AM, oyster <lep...@gm...> wrote:
> the following code runs ok with py2.4 and matplotlib.0.98.3
> however no legend appears with py2.7.3 and matplotlib-1.2.1/1.3. and I get
> [quote]
> e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629:
> U
> serWarning: Legend does not support [<matplotlib.patches.Wedge object at
> 0x03842
> 0F0>, <matplotlib.patches.Wedge object at 0x03842530>,
> <matplotlib.patches.Wedge
> object at 0x03842930>, <matplotlib.patches.Wedge object at 0x03842D30>,
> <matplo
> tlib.patches.Wedge object at 0x038B0150>]
> Use proxy artist instead.
>
>
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>
> (str(orig_handle),))
> e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629:
> U
> serWarning: Legend does not support [<matplotlib.text.Text object at
> 0x03842310>
> , <matplotlib.text.Text object at 0x03842750>, <matplotlib.text.Text
> object at 0
> x03842B50>, <matplotlib.text.Text object at 0x03842F50>,
> <matplotlib.text.Text o
> bject at 0x038B0370>]
> Use proxy artist instead.
>
>
> http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
>
> (str(orig_handle),))
> [/quote]
>
> what's the matter? thanks
>
> [code]
> #coding=utf-8
> from pylab import *
>
> val2010 = [2, 10, 20, 15, 3]
>
> figure()
>
> pie2010=pie(val2010, labels=[u'%i persons' % i for i in val2010])
>
> plt.legend( (pie2010), [u'<60', u'60~70', u'70~80', u'80~90',
> u'90~100'], loc = 'best', bbox_to_anchor = (0.90, 0.75) )
> axis('equal')
>
> show()
> [/code]
>
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: ChaoYue <cha...@gm...> - 2013年05月23日 21:12:20
Hi Martin,
I am not sure that I understand your question very well.
For a single scatter() plot, I guess I agree with you, you need to put it
in [] because
legend() function must receive iterable as far as I understand.
I don't think scatter() allows you to pass a series of group of (x,y) data
as plot().
So probably if you want to scatter more than one groups of data, you need
to:
handle_list = []
label_list = []
for (x,y) in zip(xdata_list, ydata_list):
 d = ax1.scatter(x,y)
 handle_list.append(x)
 label_list.append(....)
ax2.legend(handle_list,label_list,...)
This is what I could think of, perhaps others have better ways.
cheers,
Chao
On Thu, May 23, 2013 at 4:57 PM, Martin Mokrejs [via matplotlib] <
ml-...@n5...> wrote:
> Hi Chao,
> I spent some time to figure out why I cannot replace ax1.hist() with
> ax1.scatter().
> It seems hist() returns list of 'Rectangle' (sadly if there is just one,
> it does return
> just the 'Rectangle' (not wrapped in a list) ... somewhere a trick
>
> a = [a, ]
>
> is likely needed.
>
>
> Anyway, my problem is that scatter() returns 'PathCollection' object,
> whatever that is.
> How can I grab handles to individual legend items to move them under ax2
> like in your
> hist-plot example?
>
> Thank you for your help,
> Martin
>
>
> ChaoYue wrote:
>
> > Dear Martin,
> >
> > I worked out a similar example for your reference as I don't catch your
> example very well.
> >
> > fig = plt.figure()
>
> > ax1 = fig.add_subplot(211)
>
> > ax2 = fig.add_subplot(212)
>
> > arrlist = [np.random.normal(size=100) for i in range(50)]
>
> > ret = ax1.hist(arrlist,histtype='barstacked')
>
> > reclist = [patchlist[0] for patchlist in ret[2]]
>
> > labellist = ['data'+str(i) for i in range(50)]
>
> > ax2.legend(reclist,labellist,loc='upper
> left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
> > ax2.set_frame_on(False)
>
> > ax2.tick_params(bottom='off',left='off',right='off',top='off')
>
> > plt.setp(ax2.get_yticklabels(),visible=False)
>
> > plt.setp(ax2.get_xticklabels(),visible=False)
> >
> >
> > you're asking some object-oriented way, I personally don't think using
> pylab and set_tight_layout are the good way
> > to be "object-oriented" as pylab is only a bounding wrapper by my
> understanding (maybe I am wrong!). legend and
> > hist are all matplotlib.axes.Axes method.
> >
> > Also, I think it's unrealistic to ask the figure do a nice job for you
> if there are 50 legned handlers and you want to show
> > them in 2 columns with a very high width/height ratio of the figure....
> >
> > hope it could be of a bit help,
> >
> > cheers,
> >
> > Chao
> >
> >
> > On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib]
> <[hidden email] </user/SendEmail.jtp?type=node&node=41102&i=0>> wrote:
> >
> > Hi Ben,
> >
> > Benjamin Root wrote:
> >
> > >
> > >
> > >
> > > On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs <[hidden email] <
> http://user/SendEmail.jtp?type=node&node=41090&i=0> <mailto:[hidden
> email] <http://user/SendEmail.jtp?type=node&node=41090&i=1>>> wrote:
> > >
> > > Hi,
> > > I am having trouble to get space allocated for a long legend
> text,
> > > lets say spanning 2/3 - 3/4 of the whole output. I would like
> to have
> > > stacked barchart as 1st subplot and the place of remaining 3
> subplots
> > > to be actually allocated by the legend. Alternatively, could I
> get the
> > > legend saved into a separate figure?
> > >
> > > Or could the space for legend text be allocated automatically
> minimizing
> > > output figure size? For example, the width would be 1120px
> while height
> > > be multiples of 840px (840 for each subplot)?
> > >
> > > Attached is a quick example. It shows also that I tried
> tight_layout()
> > > but wasn't successful with this either. I would be glad for
> some help,
> > > ideally converting the whole thing into an object-oriented
> approach.
> > > I am generating several figures in a row and would like to
> clear()/del()
> > > any previously used data ASAP.
> > >
> > >
> > > Thank you,
> > > Martin
> > > Am using mpl-1.2.2
> > >
> > >
> > > Try "fig.savefig('foobar.png', bbox_inches='tight')" when saving
> the
> > > image. It will make the figure size such that all the visible
> > > elements of the figure will fit into the saved output.
> tight_layout()
> > > is meant to make sure the elements don't overlap each other, but
> does
> > > nothing about making sure nothing gets clipped.
> > Ah, would be nice to make this clear in the docs. So far was doing
> >
> >
> > import pylab
> > F = pylab.gcf()
> > F.set_tight_layout(True)
> >
> > which as you say does not help the way I thought.
> >
> >
> > Unfortunately, while
> >
> > fig.savefig('foobar.png', bbox_inches='tight')
> >
> > helped to get everything into the .png file (attached), the barchart
> itself
> > should span according to the code I posted just 1/2 of the figure.
> But somehow
> > it is enlarged and rescaled so that it occupies *more than* 1/2 of
> the figure.
> > What in pylab is resizing my image? Note: the final image is
> 625x1075.
> >
> > Martin
> >
> >
> ------------------------------------------------------------------------------
>
> > AlienVault Unified Security Management (USM) platform delivers
> complete
> > security visibility with the essential security capabilities. Easily
> and
> > efficiently configure, manage, and operate all of your security
> controls
> > from a single console and one unified framework. Download a free
> trial.
> > http://p.sf.net/sfu/alienvault_d2d
> > _______________________________________________
> > Matplotlib-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=2>
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> > *foobar.png* (132K) Download Attachment <
> http://matplotlib.1069221.n5.nabble.com/attachment/41090/0/foobar.png>
> >
> >
> >
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> > If you reply to this email, your message will be added to the
> discussion below:
> >
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41090.html
> > To start a new topic under matplotlib - users, email [hidden email]
> </user/SendEmail.jtp?type=node&node=41102&i=1>
> > To unsubscribe from matplotlib, click here.
> > NAML <
> http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
> >
> >
> >
> >
> > --
> >
> ***********************************************************************************
>
> > 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
> >
> ************************************************************************************
>
> >
> >
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> > View this message in context: Re: Making space for a long legend outside
> of a barchart <
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41102.html>
>
> > Sent from the matplotlib - users mailing list archive <
> http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html> at
> Nabble.com.
> >
> >
> >
> ------------------------------------------------------------------------------
>
> > Try New Relic Now & We'll Send You this Cool Shirt
> > New Relic is the only SaaS-based application performance monitoring
> service
> > that delivers powerful full stack analytics. Optimize and monitor your
> > browser, app, & servers with just a few lines of code. Try New Relic
> > and get this awesome Nerd Life shirt!
> http://p.sf.net/sfu/newrelic_d2d_may
> >
> >
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=41114&i=0>
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
> ------------------------------------------------------------------------------
>
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring
> service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=41114&i=1>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41114.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
***********************************************************************************
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
************************************************************************************
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41115.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Martin M. <mmo...@fo...> - 2013年05月23日 14:57:31
Hi Chao,
 I spent some time to figure out why I cannot replace ax1.hist() with ax1.scatter().
It seems hist() returns list of 'Rectangle' (sadly if there is just one, it does return
just the 'Rectangle' (not wrapped in a list) ... somewhere a trick
a = [a, ]
is likely needed.
Anyway, my problem is that scatter() returns 'PathCollection' object, whatever that is.
How can I grab handles to individual legend items to move them under ax2 like in your
hist-plot example?
Thank you for your help,
Martin
ChaoYue wrote:
> Dear Martin,
> 
> I worked out a similar example for your reference as I don't catch your example very well.
> 
> fig = plt.figure() 
> ax1 = fig.add_subplot(211) 
> ax2 = fig.add_subplot(212) 
> arrlist = [np.random.normal(size=100) for i in range(50)] 
> ret = ax1.hist(arrlist,histtype='barstacked') 
> reclist = [patchlist[0] for patchlist in ret[2]] 
> labellist = ['data'+str(i) for i in range(50)] 
> ax2.legend(reclist,labellist,loc='upper left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
> ax2.set_frame_on(False) 
> ax2.tick_params(bottom='off',left='off',right='off',top='off') 
> plt.setp(ax2.get_yticklabels(),visible=False) 
> plt.setp(ax2.get_xticklabels(),visible=False) 
> 
> 
> you're asking some object-oriented way, I personally don't think using pylab and set_tight_layout are the good way
> to be "object-oriented" as pylab is only a bounding wrapper by my understanding (maybe I am wrong!). legend and
> hist are all matplotlib.axes.Axes method. 
> 
> Also, I think it's unrealistic to ask the figure do a nice job for you if there are 50 legned handlers and you want to show
> them in 2 columns with a very high width/height ratio of the figure....
> 
> hope it could be of a bit help,
> 
> cheers,
> 
> Chao
> 
> 
> On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib] <[hidden email] </user/SendEmail.jtp?type=node&node=41102&i=0>> wrote:
> 
> Hi Ben,
> 
> Benjamin Root wrote:
> 
> >
> >
> >
> > On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs <[hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=0> <mailto:[hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=1>>> wrote:
> >
> > Hi,
> > I am having trouble to get space allocated for a long legend text,
> > lets say spanning 2/3 - 3/4 of the whole output. I would like to have
> > stacked barchart as 1st subplot and the place of remaining 3 subplots
> > to be actually allocated by the legend. Alternatively, could I get the
> > legend saved into a separate figure?
> >
> > Or could the space for legend text be allocated automatically minimizing
> > output figure size? For example, the width would be 1120px while height
> > be multiples of 840px (840 for each subplot)?
> >
> > Attached is a quick example. It shows also that I tried tight_layout()
> > but wasn't successful with this either. I would be glad for some help,
> > ideally converting the whole thing into an object-oriented approach.
> > I am generating several figures in a row and would like to clear()/del()
> > any previously used data ASAP.
> >
> >
> > Thank you,
> > Martin
> > Am using mpl-1.2.2
> >
> >
> > Try "fig.savefig('foobar.png', bbox_inches='tight')" when saving the
> > image. It will make the figure size such that all the visible
> > elements of the figure will fit into the saved output. tight_layout()
> > is meant to make sure the elements don't overlap each other, but does
> > nothing about making sure nothing gets clipped.
> Ah, would be nice to make this clear in the docs. So far was doing
> 
> 
> import pylab
> F = pylab.gcf()
> F.set_tight_layout(True)
> 
> which as you say does not help the way I thought.
> 
> 
> Unfortunately, while
> 
> fig.savefig('foobar.png', bbox_inches='tight')
> 
> helped to get everything into the .png file (attached), the barchart itself
> should span according to the code I posted just 1/2 of the figure. But somehow
> it is enlarged and rescaled so that it occupies *more than* 1/2 of the figure.
> What in pylab is resizing my image? Note: the final image is 625x1075.
> 
> Martin
> 
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=2>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> *foobar.png* (132K) Download Attachment <http://matplotlib.1069221.n5.nabble.com/attachment/41090/0/foobar.png>
> 
> 
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion below:
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41090.html
> To start a new topic under matplotlib - users, email [hidden email] </user/SendEmail.jtp?type=node&node=41102&i=1>
> To unsubscribe from matplotlib, click here.
> NAML <http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
> 
> 
> 
> 
> -- 
> ***********************************************************************************
> 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
> ************************************************************************************
> 
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> View this message in context: Re: Making space for a long legend outside of a barchart <http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41102.html>
> Sent from the matplotlib - users mailing list archive <http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html> at Nabble.com.
> 
> 
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> 
> 
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: Martin M. <mmo...@fo...> - 2013年05月23日 14:51:32
Hi,
 I just hit a broken example at
http://matplotlib.org/examples/pylab_examples/scatter_hist.html?highlight=scatter
$ python scatter_hist.py
Traceback (most recent call last):
 File "scatter_hist.py", line 44, in <module>
 axHisty.hist(y, bins=bins, orientation='horizontal')
 File "/usr/lib64/python2.7/site-packages/matplotlib/axes.py", line 8180, in hist
 color=c, bottom=bottom)
TypeError: barh() got multiple values for keyword argument 'bottom'
$
I have mpl-1.2.1.
Hope this helps.
Martin
From: Nicolas R. <Nic...@in...> - 2013年05月23日 06:15:58
You can use the 'origin' keyword:
pl.controuf(Matrix, origin='lower')
or
pl.controuf(Matrix, origin='upper')
Nicolas
On May 23, 2013, at 7:27 AM, Bakhtiyor Zokhidov <bak...@ma...> wrote:
> Hi,
> 
> I have following code:
> 
> import numpy as np
> import pylab as pl
> 
> Matrix(10,10) = 
> np.array([[ 4.5, 4.5, 4.5, 3.4, 2.5, 3.9, 3.4, 3.4, 2.2, 3.9],
> [ 3.9, 4.5, 5.2, 4.5, 3.4, 3.4, 2.2, 2.9, 3.4, 3.4],
> [ 3.9, 3.9, 2.5, 2.2, 1.9, 1.2, 1.2, 1.4, 2.5, 2.9],
> [ 3.4, 3.9, 2.9, 2.2, 1.2, 1.4, 1.7, 1.4, 1.9, 2.2],
> [ 2.5, 3.4, 2.2, 1.4, 1.2, 1.2, 1.7, 0.8, 1.9, 1.7],
> [ 2.5, 2.2, 2.5, 1.2, 1.2, 0.9, 1.7, 1.7, 1.4, 1.9],
> [ 2.2, 2.2, 3.4, 1.7, 0.9, 0.9, 0.9, 1.2, 1.7, 1.9],
> [ 2.9, 1.9, 1.9, 1.4, 1.1, 0.9, 1.2, 1.1, 1.7, 1.9],
> [ 2.9, 1.7, 2.2, 1.4, 1.1, 0.9, 1.1, 0.8, 1.1, 1.9],
> [ 2.5, 1.9, 1.7, 1.2, 1.4, 0.8, 1.1, 0.8, 1.4, 1.7]])
> 
> pl.contourf(Matrix)
> pl.show()
> 
> The problem is that that plots reversely, in other words top values are below, bottom values are top!!
> 
> How can I plot it properly?
> 
> 
> -- 
> Bakhtiyor Zokhidov
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may_______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
From: Bakhtiyor Z. <bak...@ma...> - 2013年05月23日 05:27:27
 Hi,
I have following code:
import numpy as np
import pylab as pl
Matrix(10,10) = 
np.array([[ 4.5, 4.5, 4.5, 3.4, 2.5, 3.9, 3.4, 3.4, 2.2, 3.9],
[ 3.9, 4.5, 5.2, 4.5, 3.4, 3.4, 2.2, 2.9, 3.4, 3.4],
[ 3.9, 3.9, 2.5, 2.2, 1.9, 1.2, 1.2, 1.4, 2.5, 2.9],
[ 3.4, 3.9, 2.9, 2.2, 1.2, 1.4, 1.7, 1.4, 1.9, 2.2],
[ 2.5, 3.4, 2.2, 1.4, 1.2, 1.2, 1.7, 0.8, 1.9, 1.7],
[ 2.5, 2.2, 2.5, 1.2, 1.2, 0.9, 1.7, 1.7, 1.4, 1.9],
[ 2.2, 2.2, 3.4, 1.7, 0.9, 0.9, 0.9, 1.2, 1.7, 1.9],
[ 2.9, 1.9, 1.9, 1.4, 1.1, 0.9, 1.2, 1.1, 1.7, 1.9],
[ 2.9, 1.7, 2.2, 1.4, 1.1, 0.9, 1.1, 0.8, 1.1, 1.9],
[ 2.5, 1.9, 1.7, 1.2, 1.4, 0.8, 1.1, 0.8, 1.4, 1.7]]) pl.contourf(Matrix)
pl.show()
The problem is that that plots reversely, in other words top values are below, bottom values are top!!
How can I plot it properly?
-- 
Bakhtiyor Zokhidov
From: oyster <lep...@gm...> - 2013年05月22日 15:06:52
the following code runs ok with py2.4 and matplotlib.0.98.3
however no legend appears with py2.7.3 and matplotlib-1.2.1/1.3. and I get
[quote]
e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U
serWarning: Legend does not support [<matplotlib.patches.Wedge object at 0x03842
0F0>, <matplotlib.patches.Wedge object at 0x03842530>, <matplotlib.patches.Wedge
 object at 0x03842930>, <matplotlib.patches.Wedge object at 0x03842D30>, <matplo
tlib.patches.Wedge object at 0x038B0150>]
Use proxy artist instead.
http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
 (str(orig_handle),))
e:\prg\py\python-2.7.3\lib\site-packages\_matplotlib\matplotlib\legend.py:629: U
serWarning: Legend does not support [<matplotlib.text.Text object at 0x03842310>
, <matplotlib.text.Text object at 0x03842750>, <matplotlib.text.Text object at 0
x03842B50>, <matplotlib.text.Text object at 0x03842F50>, <matplotlib.text.Text o
bject at 0x038B0370>]
Use proxy artist instead.
http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
 (str(orig_handle),))
[/quote]
what's the matter? thanks
[code]
#coding=utf-8
from pylab import *
val2010 = [2, 10, 20, 15, 3]
figure()
pie2010=pie(val2010, labels=[u'%i persons' % i for i in val2010])
plt.legend( (pie2010), [u'<60', u'60~70', u'70~80', u'80~90',
u'90~100'], loc = 'best', bbox_to_anchor = (0.90, 0.75) )
axis('equal')
show()
[/code]
From: Gregorio B. <gre...@gm...> - 2013年05月22日 14:48:09
Hi,
I have problems with constrained rectangular zoom to x-y axis with
PyQt4 / PySide backend. When I use the "Zoom-to-rectangle" button of
the navigation toolbar while holding the x or y key, sometimes nothing
happens when the mouse is released. Constrained panning and
pan-zooming ("Pan/Zoom" button) works well.
I used the following dummy code to set up the environment:
import numpy as np
import matplotlib as mpl
if mpl.get_backend() != 'Qt4Agg':
 mpl.use('Qt4Agg')
 # mpl.rcParams['backend.qt4']='PySide'
 # mpl.rcParams['backend.qt4']='PyQt4'
import matplotlib.pyplot as plt
x = np.linspace(0,1)
y = np.random.rand(x.size)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,y)
plt.show()
Looking at the mail archives and the issue tracker gave me no relevant
result. Has anyone experienced a similar issue?
python 2.7.4 win32
matplotlib 1.1.1 and 1.2.1
PyQt4 QtCore 4.8.3
PySide QtCore 4.8.3
PySide 1.1.2
Thanks,
Gregorio
From: Martin M. <mmo...@fo...> - 2013年05月22日 12:30:45
ChaoYue wrote:
> Hi Martin,
> 
> I don't know tight_layout quite well. Probably you could also split the handlers of the barplot into
> and 2 or 3 or 4 parts depending on the number, and then show them in sperate axes?
> 
> then you create n+1 subplots for the whole figure?
No, the reason why I use stacked bar chart is that I can squeeze the data
into a single figure. It is only difficult for the reader to compare 20
separate barcharts between each other whereas seeing 20 stacked bars in a
single chart on top of each other is easy.
I think your approach combined with something like a future improvement:
fig.savefig('foobar.png', bbox_inches='tight', keep_fig_width=True)
will do the best for me (unused space below the legend will be chopped away
while figure width will be untouched).
Lets see what Ben or others say about the tight_layout rescaling issue and the
"feature request". ;-)
Maritn
> 
> probably this is quite stupid.
> 
> cheers,
> 
> Chao
> 
> On Wed, May 22, 2013 at 1:03 PM, Martin Mokrejs [via matplotlib] <[hidden email] </user/SendEmail.jtp?type=node&node=41105&i=0>> wrote:
> 
> Hi Chao,
> 
> ChaoYue wrote:
> > Dear Martin,
> >
> > I worked out a similar example for your reference as I don't catch your example very well.
> 
> I think you got the idea quite well.
> 
> >
> > fig = plt.figure() 
> > ax1 = fig.add_subplot(211) 
> > ax2 = fig.add_subplot(212) 
> > arrlist = [np.random.normal(size=100) for i in range(50)] 
> > ret = ax1.hist(arrlist,histtype='barstacked') 
> > reclist = [patchlist[0] for patchlist in ret[2]] 
> > labellist = ['data'+str(i) for i in range(50)] 
> > ax2.legend(reclist,labellist,loc='upper left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
> > ax2.set_frame_on(False) 
> > ax2.tick_params(bottom='off',left='off',right='off',top='off') 
> > plt.setp(ax2.get_yticklabels(),visible=False) 
> > plt.setp(ax2.get_xticklabels(),visible=False) 
> >
> I added plt.show() and it demonstrates my problem: the legend is not complete in the
> figure. That is why I think I could instead use:
> 
> import pylab as plt
> import numpy as np
> 
> fig = plt.figure()
> DefaultSize = tuple(fig.get_size_inches())
> fig.set_size_inches(DefaultSize[0], 4*DefaultSize[1])
> ax1 = fig.add_subplot(411)
> ax2 = fig.add_subplot(412)
> arrlist = [np.random.normal(size=100) for i in range(50)]
> ret = ax1.hist(arrlist,histtype='barstacked')
> reclist = [patchlist[0] for patchlist in ret[2]]
> labellist = ['data'+str(i) for i in range(50)]
> ax2.legend(reclist,labellist,loc='upper left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
> ax2.set_frame_on(False)
> ax2.tick_params(bottom='off',left='off',right='off',top='off')
> plt.setp(ax2.get_yticklabels(),visible=False)
> plt.setp(ax2.get_xticklabels(),visible=False)
> plt.show()
> 
> But, this does not make the image 4* taller than I thought. But thank you
> for the example how to extract the legend of ax1 and place it under ax2.
> 
> 
> 
> >
> > you're asking some object-oriented way, I personally don't think
> > using pylab and set_tight_layout are the good way to be
> > "object-oriented" as pylab is only a bounding wrapper by my
> > understanding (maybe I am wrong!). legend and hist are all
> > matplotlib.axes.Axes method.
> >
> > Also, I think it's unrealistic to ask the figure do a nice job for
> > you if there are 50 legend handlers and you want to show them in 2
> > columns with a very high width/height ratio of the figure....
> 
> The problem is that the data are calculated dynamically and sometimes
> I need to display data for 20 data types while sometimes for 200 data
> types (and for each I need a legend).
> 
> I did not show that but I do calculate how many columns I could use
> legend display and pass that via pylab.legend(..., ncol= ). Of course
> at the same time I could calculate whether I will need 2 or 3 or 4
> subplots on the page (the first will be the barchart itself), the
> remaining space will be used by the long legend of subplot(211).
> I would hope that matplotlib does not mind that I actually issue any
> fig.add_subplot() foe the third or even fourth subplot at all. That
> would be just a trick to get more space for the legend. If I can live
> with just with subplot(211) and subplot(212)
> 
> The fig.savefig('foobar.png', bbox_inches='tight') which Ben mentioned
> yesterday is nice but I want it to crop the image only vertically.
> An optional argument like:
> fig.savefig('foobar.png', bbox_inches='tight', keep_fig_width=True)
> would maybe do the job for me.
> 
> 
> What I still don't understand what is resizing the image in tight_layout.
> It doesn't seem to me that just the unused border space is chopped away.
> Fonts look different, ratio between x and y axes lengths seems different.
> Certainly not what I want.
> 
> 
> > hope it could be of a bit help,
> 
> Sure, I am still learning to use matplotlib.
> 
> Martin
> 
> >
> > cheers,
> >
> > Chao
> >
> 
> >
> > On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib] <[hidden email] </user/SendEmail.jtp?type=node&node=41102&i=0>> wrote:
> >
> > Hi Ben,
> >
> > Benjamin Root wrote:
> >
> > >
> > >
> > >
> > > On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs <[hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=0> <mailto:[hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=1>>> wrote:
> 
> > >
> > > Hi,
> > > I am having trouble to get space allocated for a long legend text,
> > > lets say spanning 2/3 - 3/4 of the whole output. I would like to have
> > > stacked barchart as 1st subplot and the place of remaining 3 subplots
> > > to be actually allocated by the legend. Alternatively, could I get the
> > > legend saved into a separate figure?
> > >
> > > Or could the space for legend text be allocated automatically minimizing
> > > output figure size? For example, the width would be 1120px while height
> > > be multiples of 840px (840 for each subplot)?
> > >
> > > Attached is a quick example. It shows also that I tried tight_layout()
> > > but wasn't successful with this either. I would be glad for some help,
> > > ideally converting the whole thing into an object-oriented approach.
> > > I am generating several figures in a row and would like to clear()/del()
> > > any previously used data ASAP.
> > >
> > >
> > > Thank you,
> > > Martin
> > > Am using mpl-1.2.2
> > >
> > >
> > > Try "fig.savefig('foobar.png', bbox_inches='tight')" when saving the
> > > image. It will make the figure size such that all the visible
> > > elements of the figure will fit into the saved output. tight_layout()
> > > is meant to make sure the elements don't overlap each other, but does
> > > nothing about making sure nothing gets clipped.
> > Ah, would be nice to make this clear in the docs. So far was doing
> >
> >
> > import pylab
> > F = pylab.gcf()
> > F.set_tight_layout(True)
> >
> > which as you say does not help the way I thought.
> >
> >
> > Unfortunately, while
> >
> > fig.savefig('foobar.png', bbox_inches='tight')
> >
> > helped to get everything into the .png file (attached), the barchart itself
> > should span according to the code I posted just 1/2 of the figure. But somehow
> > it is enlarged and rescaled so that it occupies *more than* 1/2 of the figure.
> > What in pylab is resizing my image? Note: the final image is 625x1075.
> >
> > Martin
From: ChaoYue <cha...@gm...> - 2013年05月22日 11:22:52
Hi Martin,
I don't know tight_layout quite well. Probably you could also split the
handlers of the barplot into
and 2 or 3 or 4 parts depending on the number, and then show them in
sperate axes?
then you create n+1 subplots for the whole figure?
probably this is quite stupid.
cheers,
Chao
On Wed, May 22, 2013 at 1:03 PM, Martin Mokrejs [via matplotlib] <
ml-...@n5...> wrote:
> Hi Chao,
>
> ChaoYue wrote:
> > Dear Martin,
> >
> > I worked out a similar example for your reference as I don't catch your
> example very well.
>
> I think you got the idea quite well.
>
> >
> > fig = plt.figure()
>
> > ax1 = fig.add_subplot(211)
>
> > ax2 = fig.add_subplot(212)
>
> > arrlist = [np.random.normal(size=100) for i in range(50)]
>
> > ret = ax1.hist(arrlist,histtype='barstacked')
>
> > reclist = [patchlist[0] for patchlist in ret[2]]
>
> > labellist = ['data'+str(i) for i in range(50)]
>
> > ax2.legend(reclist,labellist,loc='upper
> left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
> > ax2.set_frame_on(False)
>
> > ax2.tick_params(bottom='off',left='off',right='off',top='off')
>
> > plt.setp(ax2.get_yticklabels(),visible=False)
>
> > plt.setp(ax2.get_xticklabels(),visible=False)
> >
>
> I added plt.show() and it demonstrates my problem: the legend is not
> complete in the
> figure. That is why I think I could instead use:
>
> import pylab as plt
> import numpy as np
>
> fig = plt.figure()
> DefaultSize = tuple(fig.get_size_inches())
> fig.set_size_inches(DefaultSize[0], 4*DefaultSize[1])
> ax1 = fig.add_subplot(411)
> ax2 = fig.add_subplot(412)
> arrlist = [np.random.normal(size=100) for i in range(50)]
> ret = ax1.hist(arrlist,histtype='barstacked')
> reclist = [patchlist[0] for patchlist in ret[2]]
> labellist = ['data'+str(i) for i in range(50)]
> ax2.legend(reclist,labellist,loc='upper
> left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
> ax2.set_frame_on(False)
> ax2.tick_params(bottom='off',left='off',right='off',top='off')
> plt.setp(ax2.get_yticklabels(),visible=False)
> plt.setp(ax2.get_xticklabels(),visible=False)
> plt.show()
>
> But, this does not make the image 4* taller than I thought. But thank you
> for the example how to extract the legend of ax1 and place it under ax2.
>
>
>
> >
> > you're asking some object-oriented way, I personally don't think
> > using pylab and set_tight_layout are the good way to be
> > "object-oriented" as pylab is only a bounding wrapper by my
> > understanding (maybe I am wrong!). legend and hist are all
> > matplotlib.axes.Axes method.
> >
> > Also, I think it's unrealistic to ask the figure do a nice job for
> > you if there are 50 legend handlers and you want to show them in 2
> > columns with a very high width/height ratio of the figure....
>
> The problem is that the data are calculated dynamically and sometimes
> I need to display data for 20 data types while sometimes for 200 data
> types (and for each I need a legend).
>
> I did not show that but I do calculate how many columns I could use
> legend display and pass that via pylab.legend(..., ncol= ). Of course
> at the same time I could calculate whether I will need 2 or 3 or 4
> subplots on the page (the first will be the barchart itself), the
> remaining space will be used by the long legend of subplot(211).
> I would hope that matplotlib does not mind that I actually issue any
> fig.add_subplot() foe the third or even fourth subplot at all. That
> would be just a trick to get more space for the legend. If I can live
> with just with subplot(211) and subplot(212)
>
> The fig.savefig('foobar.png', bbox_inches='tight') which Ben mentioned
> yesterday is nice but I want it to crop the image only vertically.
> An optional argument like:
> fig.savefig('foobar.png', bbox_inches='tight', keep_fig_width=True)
> would maybe do the job for me.
>
>
> What I still don't understand what is resizing the image in tight_layout.
> It doesn't seem to me that just the unused border space is chopped away.
> Fonts look different, ratio between x and y axes lengths seems different.
> Certainly not what I want.
>
>
> > hope it could be of a bit help,
>
> Sure, I am still learning to use matplotlib.
>
> Martin
>
> >
> > cheers,
> >
> > Chao
> >
> >
> > On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib]
> <[hidden email] </user/SendEmail.jtp?type=node&node=41102&i=0>> wrote:
> >
> > Hi Ben,
> >
> > Benjamin Root wrote:
> >
> > >
> > >
> > >
> > > On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs <[hidden email] <
> http://user/SendEmail.jtp?type=node&node=41090&i=0> <mailto:[hidden
> email] <http://user/SendEmail.jtp?type=node&node=41090&i=1>>> wrote:
> > >
> > > Hi,
> > > I am having trouble to get space allocated for a long legend
> text,
> > > lets say spanning 2/3 - 3/4 of the whole output. I would like
> to have
> > > stacked barchart as 1st subplot and the place of remaining 3
> subplots
> > > to be actually allocated by the legend. Alternatively, could I
> get the
> > > legend saved into a separate figure?
> > >
> > > Or could the space for legend text be allocated automatically
> minimizing
> > > output figure size? For example, the width would be 1120px
> while height
> > > be multiples of 840px (840 for each subplot)?
> > >
> > > Attached is a quick example. It shows also that I tried
> tight_layout()
> > > but wasn't successful with this either. I would be glad for
> some help,
> > > ideally converting the whole thing into an object-oriented
> approach.
> > > I am generating several figures in a row and would like to
> clear()/del()
> > > any previously used data ASAP.
> > >
> > >
> > > Thank you,
> > > Martin
> > > Am using mpl-1.2.2
> > >
> > >
> > > Try "fig.savefig('foobar.png', bbox_inches='tight')" when saving
> the
> > > image. It will make the figure size such that all the visible
> > > elements of the figure will fit into the saved output.
> tight_layout()
> > > is meant to make sure the elements don't overlap each other, but
> does
> > > nothing about making sure nothing gets clipped.
> > Ah, would be nice to make this clear in the docs. So far was doing
> >
> >
> > import pylab
> > F = pylab.gcf()
> > F.set_tight_layout(True)
> >
> > which as you say does not help the way I thought.
> >
> >
> > Unfortunately, while
> >
> > fig.savefig('foobar.png', bbox_inches='tight')
> >
> > helped to get everything into the .png file (attached), the barchart
> itself
> > should span according to the code I posted just 1/2 of the figure.
> But somehow
> > it is enlarged and rescaled so that it occupies *more than* 1/2 of
> the figure.
> > What in pylab is resizing my image? Note: the final image is
> 625x1075.
> >
> > Martin
> >
> >
> ------------------------------------------------------------------------------
>
> > AlienVault Unified Security Management (USM) platform delivers
> complete
> > security visibility with the essential security capabilities. Easily
> and
> > efficiently configure, manage, and operate all of your security
> controls
> > from a single console and one unified framework. Download a free
> trial.
> > http://p.sf.net/sfu/alienvault_d2d
> > _______________________________________________
> > Matplotlib-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=2>
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
> > *foobar.png* (132K) Download Attachment <
> http://matplotlib.1069221.n5.nabble.com/attachment/41090/0/foobar.png>
> >
> >
> >
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> > If you reply to this email, your message will be added to the
> discussion below:
> >
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41090.html
> > To start a new topic under matplotlib - users, email [hidden email]
> </user/SendEmail.jtp?type=node&node=41102&i=1>
> > To unsubscribe from matplotlib, click here.
> > NAML <
> http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
> >
> >
> >
> >
> > --
> >
> ***********************************************************************************
>
> > 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
> >
> ************************************************************************************
>
> >
> >
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> > View this message in context: Re: Making space for a long legend outside
> of a barchart <
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41102.html>
>
> > Sent from the matplotlib - users mailing list archive <
> http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html> at
> Nabble.com.
> >
> >
> >
> ------------------------------------------------------------------------------
>
> > Try New Relic Now & We'll Send You this Cool Shirt
> > New Relic is the only SaaS-based application performance monitoring
> service
> > that delivers powerful full stack analytics. Optimize and monitor your
> > browser, app, & servers with just a few lines of code. Try New Relic
> > and get this awesome Nerd Life shirt!
> http://p.sf.net/sfu/newrelic_d2d_may
> >
> >
> >
> > _______________________________________________
> > Matplotlib-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=41104&i=0>
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> >
>
> ------------------------------------------------------------------------------
>
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring
> service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=41104&i=1>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41104.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
***********************************************************************************
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
************************************************************************************
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41105.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Martin M. <mmo...@fo...> - 2013年05月22日 11:02:57
Hi Chao,
ChaoYue wrote:
> Dear Martin,
> 
> I worked out a similar example for your reference as I don't catch your example very well.
I think you got the idea quite well.
> 
> fig = plt.figure() 
> ax1 = fig.add_subplot(211) 
> ax2 = fig.add_subplot(212) 
> arrlist = [np.random.normal(size=100) for i in range(50)] 
> ret = ax1.hist(arrlist,histtype='barstacked') 
> reclist = [patchlist[0] for patchlist in ret[2]] 
> labellist = ['data'+str(i) for i in range(50)] 
> ax2.legend(reclist,labellist,loc='upper left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
> ax2.set_frame_on(False) 
> ax2.tick_params(bottom='off',left='off',right='off',top='off') 
> plt.setp(ax2.get_yticklabels(),visible=False) 
> plt.setp(ax2.get_xticklabels(),visible=False) 
> 
I added plt.show() and it demonstrates my problem: the legend is not complete in the
figure. That is why I think I could instead use:
import pylab as plt
import numpy as np
fig = plt.figure()
DefaultSize = tuple(fig.get_size_inches())
fig.set_size_inches(DefaultSize[0], 4*DefaultSize[1])
ax1 = fig.add_subplot(411)
ax2 = fig.add_subplot(412)
arrlist = [np.random.normal(size=100) for i in range(50)]
ret = ax1.hist(arrlist,histtype='barstacked')
reclist = [patchlist[0] for patchlist in ret[2]]
labellist = ['data'+str(i) for i in range(50)]
ax2.legend(reclist,labellist,loc='upper left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
ax2.set_frame_on(False)
ax2.tick_params(bottom='off',left='off',right='off',top='off')
plt.setp(ax2.get_yticklabels(),visible=False)
plt.setp(ax2.get_xticklabels(),visible=False)
plt.show()
But, this does not make the image 4* taller than I thought. But thank you
for the example how to extract the legend of ax1 and place it under ax2.
> 
> you're asking some object-oriented way, I personally don't think
> using pylab and set_tight_layout are the good way to be
> "object-oriented" as pylab is only a bounding wrapper by my
> understanding (maybe I am wrong!). legend and hist are all
> matplotlib.axes.Axes method.
> 
> Also, I think it's unrealistic to ask the figure do a nice job for
> you if there are 50 legend handlers and you want to show them in 2
> columns with a very high width/height ratio of the figure....
The problem is that the data are calculated dynamically and sometimes
I need to display data for 20 data types while sometimes for 200 data
types (and for each I need a legend).
I did not show that but I do calculate how many columns I could use
legend display and pass that via pylab.legend(..., ncol= ). Of course
at the same time I could calculate whether I will need 2 or 3 or 4
subplots on the page (the first will be the barchart itself), the
remaining space will be used by the long legend of subplot(211).
I would hope that matplotlib does not mind that I actually issue any
fig.add_subplot() foe the third or even fourth subplot at all. That
would be just a trick to get more space for the legend. If I can live
with just with subplot(211) and subplot(212)
The fig.savefig('foobar.png', bbox_inches='tight') which Ben mentioned
yesterday is nice but I want it to crop the image only vertically.
An optional argument like:
fig.savefig('foobar.png', bbox_inches='tight', keep_fig_width=True)
would maybe do the job for me.
What I still don't understand what is resizing the image in tight_layout.
It doesn't seem to me that just the unused border space is chopped away.
Fonts look different, ratio between x and y axes lengths seems different.
Certainly not what I want.
> hope it could be of a bit help,
Sure, I am still learning to use matplotlib. 
Martin
> 
> cheers,
> 
> Chao
> 
> 
> On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib] <[hidden email] </user/SendEmail.jtp?type=node&node=41102&i=0>> wrote:
> 
> Hi Ben,
> 
> Benjamin Root wrote:
> 
> >
> >
> >
> > On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs <[hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=0> <mailto:[hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=1>>> wrote:
> >
> > Hi,
> > I am having trouble to get space allocated for a long legend text,
> > lets say spanning 2/3 - 3/4 of the whole output. I would like to have
> > stacked barchart as 1st subplot and the place of remaining 3 subplots
> > to be actually allocated by the legend. Alternatively, could I get the
> > legend saved into a separate figure?
> >
> > Or could the space for legend text be allocated automatically minimizing
> > output figure size? For example, the width would be 1120px while height
> > be multiples of 840px (840 for each subplot)?
> >
> > Attached is a quick example. It shows also that I tried tight_layout()
> > but wasn't successful with this either. I would be glad for some help,
> > ideally converting the whole thing into an object-oriented approach.
> > I am generating several figures in a row and would like to clear()/del()
> > any previously used data ASAP.
> >
> >
> > Thank you,
> > Martin
> > Am using mpl-1.2.2
> >
> >
> > Try "fig.savefig('foobar.png', bbox_inches='tight')" when saving the
> > image. It will make the figure size such that all the visible
> > elements of the figure will fit into the saved output. tight_layout()
> > is meant to make sure the elements don't overlap each other, but does
> > nothing about making sure nothing gets clipped.
> Ah, would be nice to make this clear in the docs. So far was doing
> 
> 
> import pylab
> F = pylab.gcf()
> F.set_tight_layout(True)
> 
> which as you say does not help the way I thought.
> 
> 
> Unfortunately, while
> 
> fig.savefig('foobar.png', bbox_inches='tight')
> 
> helped to get everything into the .png file (attached), the barchart itself
> should span according to the code I posted just 1/2 of the figure. But somehow
> it is enlarged and rescaled so that it occupies *more than* 1/2 of the figure.
> What in pylab is resizing my image? Note: the final image is 625x1075.
> 
> Martin
> 
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=2>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> *foobar.png* (132K) Download Attachment <http://matplotlib.1069221.n5.nabble.com/attachment/41090/0/foobar.png>
> 
> 
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> If you reply to this email, your message will be added to the discussion below:
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41090.html
> To start a new topic under matplotlib - users, email [hidden email] </user/SendEmail.jtp?type=node&node=41102&i=1>
> To unsubscribe from matplotlib, click here.
> NAML <http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
> 
> 
> 
> 
> -- 
> ***********************************************************************************
> 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
> ************************************************************************************
> 
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> View this message in context: Re: Making space for a long legend outside of a barchart <http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41102.html>
> Sent from the matplotlib - users mailing list archive <http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html> at Nabble.com.
> 
> 
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service 
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
> 
> 
> 
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
From: ChaoYue <cha...@gm...> - 2013年05月21日 20:21:18
Hi Mat,
this has been asked before. see here:
http://matplotlib.1069221.n5.nabble.com/quot-zig-zag-quot-to-represent-suppressed-0-on-axis-td40849.html#a40858
cheers,
Chao
On Mon, May 20, 2013 at 8:29 PM, mat [via matplotlib] <
ml-...@n5...> wrote:
> Dear community,
>
> I would like to truncate the x axis of a plot, as in the attached figure:
>
> Is it possible to do so ?
>
> Best,
> Mat
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
***********************************************************************************
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
************************************************************************************
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Is-it-possible-to-truncate-axes-in-matplotlib-tp41092p41103.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: ChaoYue <cha...@gm...> - 2013年05月21日 20:15:46
Dear Martin,
I worked out a similar example for your reference as I don't catch your
example very well.
fig =
plt.figure()
ax1 =
fig.add_subplot(211)
ax2 =
fig.add_subplot(212)
arrlist = [np.random.normal(size=100) for i in
range(50)]
ret =
ax1.hist(arrlist,histtype='barstacked')
reclist = [patchlist[0] for patchlist in
ret[2]]
labellist = ['data'+str(i) for i in
range(50)]
ax2.legend(reclist,labellist,loc='upper
left',bbox_to_anchor=(0,0,1,1),borderaxespad=0.,ncol=5,mode='expand')
ax2.set_frame_on(False)
ax2.tick_params(bottom='off',left='off',right='off',top='off')
plt.setp(ax2.get_yticklabels(),visible=False)
plt.setp(ax2.get_xticklabels(),visible=False)
you're asking some object-oriented way, I personally don't think using
pylab and set_tight_layout are the good way
to be "object-oriented" as pylab is only a bounding wrapper by my
understanding (maybe I am wrong!). legend and
hist are all matplotlib.axes.Axes method.
Also, I think it's unrealistic to ask the figure do a nice job for you if
there are 50 legned handlers and you want to show
them in 2 columns with a very high width/height ratio of the figure....
hope it could be of a bit help,
cheers,
Chao
On Mon, May 20, 2013 at 6:43 PM, Martin Mokrejs [via matplotlib] <
ml-...@n5...> wrote:
> Hi Ben,
>
> Benjamin Root wrote:
>
> >
> >
> >
> > On Mon, May 20, 2013 at 12:02 PM, Martin Mokrejs <[hidden email]<http://user/SendEmail.jtp?type=node&node=41090&i=0><mailto:[hidden
> email] <http://user/SendEmail.jtp?type=node&node=41090&i=1>>> wrote:
> >
> > Hi,
> > I am having trouble to get space allocated for a long legend text,
> > lets say spanning 2/3 - 3/4 of the whole output. I would like to
> have
> > stacked barchart as 1st subplot and the place of remaining 3
> subplots
> > to be actually allocated by the legend. Alternatively, could I get
> the
> > legend saved into a separate figure?
> >
> > Or could the space for legend text be allocated automatically
> minimizing
> > output figure size? For example, the width would be 1120px while
> height
> > be multiples of 840px (840 for each subplot)?
> >
> > Attached is a quick example. It shows also that I tried
> tight_layout()
> > but wasn't successful with this either. I would be glad for some
> help,
> > ideally converting the whole thing into an object-oriented approach.
> > I am generating several figures in a row and would like to
> clear()/del()
> > any previously used data ASAP.
> >
> >
> > Thank you,
> > Martin
> > Am using mpl-1.2.2
> >
> >
> > Try "fig.savefig('foobar.png', bbox_inches='tight')" when saving the
> > image. It will make the figure size such that all the visible
> > elements of the figure will fit into the saved output. tight_layout()
> > is meant to make sure the elements don't overlap each other, but does
> > nothing about making sure nothing gets clipped.
> Ah, would be nice to make this clear in the docs. So far was doing
>
>
> import pylab
> F = pylab.gcf()
> F.set_tight_layout(True)
>
> which as you say does not help the way I thought.
>
>
> Unfortunately, while
>
> fig.savefig('foobar.png', bbox_inches='tight')
>
> helped to get everything into the .png file (attached), the barchart
> itself
> should span according to the code I posted just 1/2 of the figure. But
> somehow
> it is enlarged and rescaled so that it occupies *more than* 1/2 of the
> figure.
> What in pylab is resizing my image? Note: the final image is 625x1075.
>
> Martin
>
> ------------------------------------------------------------------------------
>
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=41090&i=2>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
> *foobar.png* (132K) Download Attachment<http://matplotlib.1069221.n5.nabble.com/attachment/41090/0/foobar.png>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41090.html
> To start a new topic under matplotlib - users, email
> ml-...@n5...
> To unsubscribe from matplotlib, click here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
-- 
***********************************************************************************
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
************************************************************************************
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Making-space-for-a-long-legend-outside-of-a-barchart-tp41088p41102.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: gaspra <ye...@gm...> - 2013年05月21日 18:02:54
Michael Droettboom-3 wrote
> Michael Droettboom-3 wrote
> The issue I filed was related to the build problem you reported -- that 
> building matplotlib with a MacPorts python is trying to use the system 
> (framework) Tcl/Tk. That's completely independent of the other problem 
> related to ticks, which should not be affected by the backend at all. 
> In my quick skimming of this thread, I thought that that issue was 
> resolved, but apparently not. I'll look into that further and file a 
> separate issue for that if need be.
I have experimented the setupext.py a little bit and find this change can 
compile matplotlib using MacPorts python and Tcl/Tk without conflict:
 def parse_tcl_config(self, tcl_lib_dir, tk_lib_dir):
 ...
 tcl_poss = [tcl_lib_dir,
 os.path.normpath(os.path.join(tcl_lib_dir, '..')),
 "/usr/lib/tcl" + str(Tkinter.TclVersion),
 "/opt/local/lib"] # /usr/lib is replaced by
/opt/local/lib
 tk_poss = [tk_lib_dir,
 os.path.normpath(os.path.join(tk_lib_dir, '..')),
 "/usr/lib/tk" + str(Tkinter.TkVersion),
 "/opt/local/lib"] # /usr/lib is replaced by
/opt/local/lib
 ...
I also replaced this logical statement: 
 elif sys.platform == 'darwin':
by 
 elif sys.platform == 'dummy':
The reason why I replaced /usr/lib with /opt/local/lib instead of expanding
the 
tcl_poss and tk_poss lists is that the system tclConfig.sh and tkConfig.sh
are 
located in /usr/lib, while the MacPorts tclConfig.sh and tkConfig.sh are
located 
in /opt/local/lib.
I don't think we really need specially treatment for Mac OS, since
tclConfig.sh and 
tkConfig.sh will return correctly Tcl/Tk lib/include path. Maybe I am
missing something? 
I have tested this and it works perfectly fine. Surely this assumes the 
MacPorts Tcl/Tk are installed. Conditions need to be added so they can check
wether 
we are using MacPorts Python, wether MacPorts Tcl/Tk exist if using MacPorts
Python. 
If MacPorts Tcl/Tk exist then we use /opt/local/lib, otherwise we use
/usr/lib.
Hope this helps. Thanks.
Yuan
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/missing-ticks-on-inverted-log-axis-tp41063p41100.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
1 message has been excluded from this view by a project administrator.

Showing results of 141

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