-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
DOC: missing second y-axis in demo_parasite_axes2
#6836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Besides, I do not use that much the |
demo_parasite_axes2
demo_parasite_axes2
demo_parasite_axes2
demo_parasite_axes2
It works correctly on v2.x... |
@efiring What version of mpl 2.x did you test? On my computer, with mpl I will try to have a look at it, as well as at the tick direction and Cie. |
In [5]: matplotlib.version |
This is broken on
|
@QuLogic Thank you for figuring out the bisecting point! I think I may have found the reason why the 2nd y-axis is not visible after d268abf. For example in
# 1/ Deactivate the right side of the parent axis, but its line.
self.axis["right"].toggle(all=False)
self.axis["right"].line.set_visible(True)
# 2/ Hide all the sides of the parasite axe but the right side.
ax2.axis["right"].set_visible(True)
ax2.axis["left","top", "bottom"].toggle(all=False)
ax2.axis["left","top", "bottom"].line.set_visible(False)
# 3/ Setup the right side of the parasite ax.
ax2.axis["right"].toggle(all=True) # Do not forget to activate tick & labels!
ax2.axis["right"].line.set_visible(False) # the one from parent ax is visible
# 1/ Simply make the right side of the parent ax not visible.
self.axis["right"].set_visible(False)
# 2/ Make all sides of the parasite ax not visible but the right one.
ax2.axis["right"].set_visible(True)
ax2.axis["left", "top", "bottom"].set_visible(False)
# 3/ Setup the right side of the parasite ax.
# Empty! and if I add I did not have time to look carefully to the related PR (#4898) yet: I cannot tell for the moment that this is not going against the aim of #4898. I will have a better look at this tomorrow or this weekend. |
@afvincent Everything that #4898 was meant to achieve has been put into the Although I don't really get why it doesn't work the way it is. I think it has something to do with the Anyway, I think your suggestion should fix it. |
@smheidrich Thank you for the explanations as well as for the experiments :)! I have played a bit with the test you added in #4898 (doing more or less the same kind of things as you did in gist) and it seemed to me too that the problem has to do with |
Makes mpl_toolkits.axisartist.AxisArtist.set_visible behave like mpl_toolkits.axes_grid1.mpl_axes.SimpleAxisArtist, i.e. it now toggles all child elements as well as setting what is normally called "visibility" in matplotlib.
All right, so to me it seems this comes down to the difference between axis artists that are used by the default axes vs
So that explains why my code worked for default axes without the explicit I tested this by making Also I think the better solution might be to do the exact opposite and make But in general one problem with the axes grid toolkit it's that it's so damn inconsistent, so perhaps having at least |
👍 making |
@tacaswell It might be better to make it consistent the other way round, i.e. by making |
Was fixed by above PRs. |
It looks like the example demo_parasite_axes2 lost its “Temperature” second y-axis in the devdocs gallery. See the non-devodcs version for a comparison.
For those who do not like to click, here are the two PNGs with default dpi:
NB: a diff between the code source of each example results in an empty file.
Edit: “twin y-axis” ← “second y-axis”, which should be more correct.
The text was updated successfully, but these errors were encountered: