[Matplotlib-users] Getting tight layout to recognize the second axis via twinx()

2012-08-29 Thread Jeffrey Spencer
For example running this code and then fig.tight_layout(). The second axis
isn't recognized. Is there a way to add it to the tight_layout spec or a
better method.

out = ones(200)
fign = 52
h, w = freqz(out)
fig = figure(fign)
semilogy(h,abs(w)/abs(max(w)), 'b', label='Mag')
ylim(0.01,1.2)
ylabel('Amplitude (db)', color='b')
xlabel('Frequency (rad/sample)')
ax = fig.gca()
ax2 = ax.twinx()
angles = unwrap(angle(w))
plot(h, angles, 'g')
ylabel('Phase (rads)', color='g')

Cheers,
Jeff
--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting tight layout to recognize the second axis via twinx()

2012-08-29 Thread Eric Firing
On 2012/08/28 9:11 PM, Jeffrey Spencer wrote:
 For example running this code and then fig.tight_layout(). The second
 axis isn't recognized. Is there a way to add it to the tight_layout spec
 or a better method.

This is a bug, or rather one of the ways in which tight_layout is 
limited. twinx and twiny probably will need to return SubplotBase 
instances if their parent is a SubplotBase instance.  I don't 
immediately see a quick and easy way to do this. I filed a ticket:
https://github.com/matplotlib/matplotlib/issues/1165

Eric


 out = ones(200)
 fign = 52
 h, w = freqz(out)
 fig = figure(fign)
 semilogy(h,abs(w)/abs(max(w)), 'b', label='Mag')
 ylim(0.01,1.2)
 ylabel('Amplitude (db)', color='b')
 xlabel('Frequency (rad/sample)')
 ax = fig.gca()
 ax2 = ax.twinx()
 angles = unwrap(angle(w))
 plot(h, angles, 'g')
 ylabel('Phase (rads)', color='g')

 Cheers,
 Jeff


 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/



 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users



--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting tight layout to recognize the second axis via twinx()

2012-08-29 Thread Jeffrey Spencer
Thanks, sounds good just wanted to know if possible now. I will use
something else.

Cheers
On Aug 29, 2012 5:53 PM, Eric Firing efir...@hawaii.edu wrote:

 On 2012/08/28 9:11 PM, Jeffrey Spencer wrote:
  For example running this code and then fig.tight_layout(). The second
  axis isn't recognized. Is there a way to add it to the tight_layout spec
  or a better method.

 This is a bug, or rather one of the ways in which tight_layout is
 limited. twinx and twiny probably will need to return SubplotBase
 instances if their parent is a SubplotBase instance.  I don't
 immediately see a quick and easy way to do this. I filed a ticket:
 https://github.com/matplotlib/matplotlib/issues/1165

 Eric

 
  out = ones(200)
  fign = 52
  h, w = freqz(out)
  fig = figure(fign)
  semilogy(h,abs(w)/abs(max(w)), 'b', label='Mag')
  ylim(0.01,1.2)
  ylabel('Amplitude (db)', color='b')
  xlabel('Frequency (rad/sample)')
  ax = fig.gca()
  ax2 = ax.twinx()
  angles = unwrap(angle(w))
  plot(h, angles, 'g')
  ylabel('Phase (rads)', color='g')
 
  Cheers,
  Jeff
 
 
 
 --
  Live Security Virtual Conference
  Exclusive live event will cover all the ways today's security and
  threat landscape has changed and how IT managers can respond. Discussions
  will include endpoint security, mobile security and the latest in malware
  threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 
 
 
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 



 --
 Live Security Virtual Conference
 Exclusive live event will cover all the ways today's security and
 threat landscape has changed and how IT managers can respond. Discussions
 will include endpoint security, mobile security and the latest in malware
 threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Getting tight layout to recognize the second axis via twinx()

2012-08-29 Thread Jae-Joon Lee
On Wed, Aug 29, 2012 at 4:52 PM, Eric Firing efir...@hawaii.edu wrote:
 twinx and twiny probably will need to return SubplotBase
 instances if their parent is a SubplotBase instance.

My take on this.

https://github.com/matplotlib/matplotlib/pull/1169

And, tight_layout seem to work okay with this change.

Regards,

-JJ

--
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users