[Matplotlib-users] twinx problem
Hi, Im running mpl 1.01 from sf installer with py2.7 on windows xp. Can anyone tell me what I am doing wrong in the following snippet: import matplotlib.pyplot as pp fig = pp.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() # works (tick labels are blue): for tick in ax1.yaxis.get_major_ticks(): tick.label1.set_color('blue') # does not work (tick labels are not red): for tick in ax2.yaxis.get_major_ticks(): tick.label1.set_color('red') pp.show() -- Christopher Brown, Ph.D. Associate Research Professor Department of Speech and Hearing Science Arizona State University http://pal.asu.edu -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] twinx problem
On Mon, Oct 3, 2011 at 2:22 PM, Christopher Brown c...@asu.edu wrote: Hi, Im running mpl 1.01 from sf installer with py2.7 on windows xp. Can anyone tell me what I am doing wrong in the following snippet: import matplotlib.pyplot as pp fig = pp.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() # works (tick labels are blue): for tick in ax1.yaxis.get_major_ticks(): tick.label1.set_color('blue') # does not work (tick labels are not red): for tick in ax2.yaxis.get_major_ticks(): tick.label1.set_color('red') pp.show() Confirmed with the v1.1.x branch as well. Although, I don't play with twinx() enough to know if this is really a bug or not, but my vote is that it is a bug. Ben Root -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] twinx problem
On 10/03/2011 09:22 AM, Christopher Brown wrote: import matplotlib.pyplot as pp fig = pp.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() # works (tick labels are blue): for tick in ax1.yaxis.get_major_ticks(): tick.label1.set_color('blue') # does not work (tick labels are not red): for tick in ax2.yaxis.get_major_ticks(): tick.label1.set_color('red') pp.show() Try this instead: import matplotlib.pyplot as pp fig = pp.figure() ax1 = fig.add_subplot(111) ax2 = ax1.twinx() ax1.tick_params(axis='y', labelcolor='b') ax2.tick_params(axis='y', labelcolor='r') pp.show() Eric -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] twinx problem
On Tue, Oct 4, 2011 at 4:22 AM, Christopher Brown c...@asu.edu wrote: tick.label1.set_color('red') You should use tick.label2, not tick.label1. tick.label2.set_color('red') Anyhow, as Eric said, it is strongly advised to use the tick_params method. -JJ -- All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1 ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users