<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p><br>
</p>
<p>I'd like to know if it's possible to get a sort of double tick
labeling (e.g. bottom and top), but with different labels. One way
to think of my use case is that there are two different units for
the x data (or more precisely in my case, I've two different x
quantities which are bound by a linear relationship).</p>
<p>The result I'd like is the right part of the attached image (it's
a Gimp-edited mockup composition of the two actual plots on the
left).<br>
</p>
<p>I've tried to play with the double labeling of a single axe.
Indeed, the following two calls put the double labeling<br>
</p>
<blockquote>
<p>ax1.xaxis.set_ticks_position('both')<br>
ax1.xaxis.set_tick_params(labeltop=True)</p>
</blockquote>
<p>However, when I want to alter only the top labels using <br>
</p>
<blockquote>
<p>for tick, l in zip(ax1.xaxis.get_major_ticks(), l2):<br>
tick.set_label2(l)</p>
</blockquote>
<p>I get no visible change on the plot. (full script attached). Did
I need to call some update ?<br>
</p>
<p>Did I miss something with the proper way to call Tick.set_label2?
<br>
</p>
<p>Looking at the source code of ax1.xaxis.set_ticklabels, there is
something I don't get. First it sets a FixedFormatter(ticklabels),
and then it sets label1 and/or label2 for each Tick object. So in
the end, where is the text coming from?</p>
<p><br>
</p>
<p>Also, to complement the second series of tick labels, I'd like a
second axis label as well. However, I only know
ax.xaxis.set_label_position('top') to move xlabel to the top, not
to get a 2nd one...<br>
</p>
<p><br>
</p>
<p>As an alternative approach, I see twinx. I didn't try it yet,
because I feel like my objective is not of the objective of twinx
(e.g. I'm plotting only a single dataset, not two). However, I
suspect it's possible to 'bend" twinx to get what I want. What do
you think.</p>
<p><br>
</p>
<p>Thank you in advance for your ideas.<br>
</p>
<p><br>
</p>
<p>Best,</p>
<p>Pierre<br>
</p>
<p><br>
</p>
</body>
</html>