[Matplotlib-users] double tick labels (bottom and top, but with different labels)

Pierre Haessig pierre.haessig at crans.org
Thu Apr 26 11:03:29 EDT 2018


Thanks for all your feedback. Interesting to see that there are indeed
issues and PR on this topic.

Looking at issue https://github.com/matplotlib/matplotlib/issues/10976,
it's makes no relation to the label2
https://github.com/matplotlib/matplotlib/issues/8181. Seems more like a
"smart twinx", because the ENH propose that the ticks are not
necessarily at the same position.

In my case, since I can use the same xtick positions, I think in the end
I can get away with just using one FuncFormatter which shows the two
numbers. Using Adrien's suggestion, I need to try something like
FuncFormatter(lambda x, pos: f"{x} -- {a*x+b}")).

Best,

Pierre




More information about the Matplotlib-users mailing list