Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
To help us understand and resolve your issue please check that you have provided
the information below.
Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
Matplotlib 1.51, Python 3.5.2 on Red Hat Enterprise Linux 6.5How did you install Matplotlib and Python (pip, anaconda, from source ...)
Anaconda 1.5.1 (conda 4.2.9)If possible please supply aShort, Self Contained, Correct, Example
that demonstrates the issue i.e a small piece of code which reproduces the issue
and can be run with out any other (or as few as possible) external dependencies.
frommatplotlibimportpyplotaspltfrommatplotlib.tickerimportFormatter,MaxNLocatorax=plt.plot([0,1,2,3], [0,1,2,3])[0].axesax.figure.subplots_adjust(bottom=0.3)ax.set_xlabel('Axis1')# To demonstrate that labels can be set differentlyax2=ax.twinx()ax2.set_frame_on(True)ax2.patch.set_visible(False)ax2.yaxis.set_visible(False)ax2.xaxis.set_visible(True)ax2.spines['bottom'].set_position(('axes',-0.2))# So far so goodax2.set_xlabel('Axis2')# Surprisingly (or not), this worksclassF(Formatter):def__call__(self,x,pos=None):return'%03d'%x# This does not work as expected:ax.xaxis.set_major_locator(MaxNLocator(integer=True))# Both locators get modifiedax2.xaxis.set_major_formatter(F())# Both formatters get modified
I suspect that this has something to do with the fact thatAxis
has aTicker
container for the attributes that are behaving inappropriately, and that they are not being copied correctly when the axis is twinned for some reason. I have not been able to trace this problem down yet, but with a few pointer from the experts, I'd probably be able to make a PR. Assuming this is actually an issue, of course.
- If this is an image generation bug attach a screenshot demonstrating the issue.
- If this is a regression (Used to work in an earlier version of Matplotlib), please
note where it used to work.