title: Matplotlib: how to set ticks of twinned axis in log plot
body: <p>In my plot, a secondary x axis is used to display the value of another variable for some data. Now, the original axis is log scaled. Unfortunaltely, the twinned axis puts the ticks (and the labels) referring to the linear scale of the original axis and not as intended to the log scale. How can this be overcome?</p>
  
  <p>Here the code example that should put the ticks of the twinned axis in the same (absolute axes) position as the ones for the original axis:</p>
  
  <pre><code>    def conv(x):
          """some conversion function"""
          # ...
          return x2
  
      ax = plt.subplot(1,1,1)
      ax.set_xscale('log')
  
      # get the location of the ticks of ax
      axlocs,axlabels = plt.xticks()
  
      # twin axis and set limits as in ax
      ax2 = ax.twiny()
      ax2.set_xlim(ax.get_xlim())
  
      #Set the ticks, should be set referring to the log scale of ax, but are set referring to the linear scale
      ax2.set_xticks(axlocs)
  
      # put the converted labels
      ax2.set_xticklabels(map(conv,axlocs))
  </code></pre>
  
  <p>An alternative way would be (the ticks are then not set in the same position, but that doesn't matter):</p>
  
  <pre><code>    from matplotlib.ticker import FuncFormatter
  
      ax = plt.subplot(1,1,1)
      ax.set_xscale('log')
  
      ax2 = ax.twiny()
      ax2.set_xlim(ax.get_xlim())
      ax2.xaxis.set_major_formatter(FuncFormatter(lambda x,pos:conv(x)))  
  </code></pre>
  
  <p>Both approaches work well as long as no log scale is used.  </p>
  
  <p>Perhaps there exists an easy fix. Is there something I missed in the documentation? </p>
  
  <p>As a workaround, I tried to obtain the ax.transAxes coordinates of the ticks of ax and put the ticks at the very same position in ax2. But there does not exist something like</p>
  
  <pre><code>    ax2.set_xticks(axlocs,transform=ax2.transAxes)
      TypeError: set_xticks() got an unexpected keyword argument 'transform'
  </code></pre>