Re: [Matplotlib-users] Is it possible to truncate axes in matplotlib?

2013-05-25 Thread ChaoYue
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-node+s1069221n4112...@n5.nabble.com 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=nodenode=41129i=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=nodenode=41124i=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=nodenode=41123i=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.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml



 *truncated_plot.py* (11K) Download 
 Attachmenthttp://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=nodenode=41124i=1
 To unsubscribe from matplotlib, click here.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=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 

Re: [Matplotlib-users] Is it possible to truncate axes in matplotlib?

2013-05-25 Thread ChaoYue
Hi Mat,

Just one words, the plt. 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-node+s1069221n41131...@n5.nabble.com wrote:

 Perfect!! Many thanks!


 2013/5/25 ChaoYue [via matplotlib] [hidden 
 email]http://user/SendEmail.jtp?type=nodenode=41131i=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=nodenode=41130i=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=nodenode=41129i=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=nodenode=41124i=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=nodenode=41123i=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.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml



 *truncated_plot.py* (11K) Download 
 Attachmenthttp://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=nodenode=41124i=1
 To unsubscribe from matplotlib, click here.
 NAMLhttp://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=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 

[Matplotlib-users] 'module' object has no attribute 'instancemethod'

2013-05-25 Thread klo uo
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?
--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 'module' object has no attribute 'instancemethod'

2013-05-25 Thread Christoph Gohlke
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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Fwd: 'module' object has no attribute 'instancemethod'

2013-05-25 Thread klo uo
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 cgoh...@uci.edu 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


--
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users