I am trying to make a plot with two y-axes, one of which is logarithmic and one linear, using host_subplot from mpl_toolkits.axes_grid1. This figure looks normal, with the exception of small ticks from the secondary y axis (right), which is also displayed on the primary y axis (left), inside the picture.
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
host = host_subplot(111)
host.set_yticks(np.arange(-12, -3, 1.0))
par1 = host.twinx()
par1.set_ylim( 2.7040e+3, 1.3552e+7)
par1.set_yscale('log')
minorLocator_x1 = MultipleLocator(0.3333)
minorLocator_y1 = MultipleLocator(0.5)
host.xaxis.set_minor_locator(minorLocator_x1)
host.yaxis.set_minor_locator(minorLocator_y2)

I can fix mirror small logarithmic axes with:
host = host_subplot(111, axes_class=AA.Axes)
However, this creates another problem, namely, that the labels of the x-axis labels are displayed inside the figure, as well as the x-axis label.

Any ideas on how to get around the problems?
source
share