Two y axis with twinx, only one of them logscale

Hi everybody,

I want to include different data into one plot using a common xaxis but two
yaxis. One of these axis should be log scaled. The problem is, that this
automatically changes the scaling (or just the ticks) of first yaxis, which
should be linear to log. I assume this is a bug, but its also possible that
I didn't understand how to do it. Here my code:

fig=figure()
ax1=fig.add_subplot(111)
p1=ax1.plot(A0,data[:,11])
ax1.set_yscale('linear')
setp(p1,color='blue',ms=3.0,marker='.',alpha=1.,ls='')
ylim(ymax=1.1)
xlabel(r'$m_{16} \ (\mathrm{GeV})$')
ylabel(r'$R$')
#savefig('p30.pdf')
ax2=ax1.twinx()
p2=ax2.plot(A0,data[:,33])
ax2.set_yscale('log')
ax1.set_yscale('linear')
ylim(ymax=10)
axhline(y=0.136, xmin=0., xmax=1, color='black',ls=':')
axhline(y=0.094, xmin=0., xmax=1, color='black',ls=':')
setp(p2,color='orange',ms=3.0,marker='.',alpha=0.3,ls='')
savefig('p33.png')
clf()

Thanks for your help

···

--
View this message in context: http://www.nabble.com/Two-y-axis-with-twinx%2C-only-one-of-them-logscale-tp22082290p22082290.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

I believe that it does not actually change the y scale of the first
axes, but simply the
y tickmarks of the second axes gets visible again. It seems to me a
bug, though. Anyhow, I guess inserting following line after
ax2.set_yscale("log") should solve your problem.

ax2.yaxis.tick_right()

-JJ

···

On Wed, Feb 18, 2009 at 11:21 AM, marcusantonius <markus.haider@...2356...> wrote:

Hi everybody,

I want to include different data into one plot using a common xaxis but two
yaxis. One of these axis should be log scaled. The problem is, that this
automatically changes the scaling (or just the ticks) of first yaxis, which
should be linear to log. I assume this is a bug, but its also possible that
I didn't understand how to do it. Here my code:

fig=figure()
ax1=fig.add_subplot(111)
p1=ax1.plot(A0,data[:,11])
ax1.set_yscale('linear')
setp(p1,color='blue',ms=3.0,marker='.',alpha=1.,ls='')
ylim(ymax=1.1)
xlabel(r'm\_\{16\} \\ \(\\mathrm\{GeV\}\)')
ylabel(r'R')
#savefig('p30.pdf')
ax2=ax1.twinx()
p2=ax2.plot(A0,data[:,33])
ax2.set_yscale('log')
ax1.set_yscale('linear')
ylim(ymax=10)
axhline(y=0.136, xmin=0., xmax=1, color='black',ls=':')
axhline(y=0.094, xmin=0., xmax=1, color='black',ls=':')
setp(p2,color='orange',ms=3.0,marker='.',alpha=0.3,ls='')
savefig('p33.png')
clf()

Thanks for your help
--
View this message in context: http://www.nabble.com/Two-y-axis-with-twinx%2C-only-one-of-them-logscale-tp22082290p22082290.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

You are right, this solved my problem. Thank you very much.

mh

Jae-Joon Lee wrote:

···

I believe that it does not actually change the y scale of the first
axes, but simply the
y tickmarks of the second axes gets visible again. It seems to me a
bug, though. Anyhow, I guess inserting following line after
ax2.set_yscale("log") should solve your problem.

ax2.yaxis.tick_right()

-JJ

On Wed, Feb 18, 2009 at 11:21 AM, marcusantonius > <markus.haider@...2356...> wrote:

Hi everybody,

I want to include different data into one plot using a common xaxis but
two
yaxis. One of these axis should be log scaled. The problem is, that this
automatically changes the scaling (or just the ticks) of first yaxis,
which
should be linear to log. I assume this is a bug, but its also possible
that
I didn't understand how to do it. Here my code:

fig=figure()
ax1=fig.add_subplot(111)
p1=ax1.plot(A0,data[:,11])
ax1.set_yscale('linear')
setp(p1,color='blue',ms=3.0,marker='.',alpha=1.,ls='')
ylim(ymax=1.1)
xlabel(r'm\_\{16\} \\ \(\\mathrm\{GeV\}\)')
ylabel(r'R')
#savefig('p30.pdf')
ax2=ax1.twinx()
p2=ax2.plot(A0,data[:,33])
ax2.set_yscale('log')
ax1.set_yscale('linear')
ylim(ymax=10)
axhline(y=0.136, xmin=0., xmax=1, color='black',ls=':')
axhline(y=0.094, xmin=0., xmax=1, color='black',ls=':')
setp(p2,color='orange',ms=3.0,marker='.',alpha=0.3,ls='')
savefig('p33.png')
clf()

Thanks for your help
--
View this message in context:
http://www.nabble.com/Two-y-axis-with-twinx%2C-only-one-of-them-logscale-tp22082290p22082290.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
CA
-OSBC tackles the biggest issue in open source: Open Sourcing the
Enterprise
-Strategies to boost innovation and cut costs with open source
participation
-Receive a $600 discount off the registration fee with the source code:
SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco,
CA
-OSBC tackles the biggest issue in open source: Open Sourcing the
Enterprise
-Strategies to boost innovation and cut costs with open source
participation
-Receive a $600 discount off the registration fee with the source code:
SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
View this message in context: http://www.nabble.com/Two-y-axis-with-twinx%2C-only-one-of-them-logscale-tp22082290p22082961.html
Sent from the matplotlib - users mailing list archive at Nabble.com.