Skip to content
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

Problem with ax.set_azimuth_ticks() #41

Open
GlacialGeo opened this issue May 19, 2021 · 2 comments
Open

Problem with ax.set_azimuth_ticks() #41

GlacialGeo opened this issue May 19, 2021 · 2 comments

Comments

@GlacialGeo
Copy link

I was updating some stereonet subplots in Jupyter (that used to look fine) and after running the cell the degrees around the stereonets did not plot correctly as they used to. Instead of plotting around the edge of the stereonets, they plotted all around the frame of the four subplots. I then tried on a single stereonet and it was better, but the degrees were positioned quite far away from the edge of the stereonet and I could not adjust that position.

@kaibro94
Copy link

I encountered exactly the same issue today, and I am using Spyder. The last time I used mplstereonet was in December 2020 and back then the error did not occur. Here is an example of the ticks and labels:
grafik

@JNDanielson
Copy link

JNDanielson commented Dec 15, 2021

Ok, took me a while to figure out what was going on. I can suggest two workarounds to fix this issue:

  1. If "ax" is your stereonet axis, add the line "ax._polar.set_position(ax.get_position())" before calling plt.show()
  2. Downgrade matplotlib to version <3.4.0

mplstereonet makes a hidden polar axis within the stereonet axis as a bit of a kludge to add azimuth tick labels.

I think the issue is in mplstereonet/stereonet_axes.py line 291. Prior to matplotlib 3.4.0, fig.add_axes() used to detect if you were attempting to create Axes with the same keyword arguments as already-existing Axes in the current Figure, and if so, it would return the existing Axes. Now it will create a new axis. So changes to the size of the stereonet axis aren't matched by changes in the polar axis anymore. Workaround 1 manually matches any size changes that have occurred in the parent axis.

The matplotlib functionality change is documented here:
https://matplotlib.org/stable/users/prev_whats_new/whats_new_3.4.0.html#changes-to-behavior-of-axes-creation-methods-gca-add-axes-add-subplot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants