joferkington / mplstereonet

Stereonets for matplotlib
MIT License
189 stars 66 forks source link

ax.pole not working for two points #30

Closed Antoine-Cate closed 4 years ago

Antoine-Cate commented 5 years ago

When plotting series of two poles using ax.pole, the resulting plot includes a number of additional points joining the two expected points. I reproduced the issue in the following code:

fig = plt.figure(figsize=(7,7))
ax = fig.add_subplot(111, projection='stereonet')
strike = [200, 250]
dip = [50, 60]
ax.pole(strike, dip, 'go', markersize=10)
ax.grid()
plt.show()

The following figure was created: image To be noted: the same issue does not occur when using ax.line I looked into stereonet_axes.pole and stereonet_math.pole and did not find the reason for this behaviour.

joferkington commented 5 years ago

Well, that used to work!

Looks like there have been some matplotlib projection changes in the last while, and I've let things get out of date.

The underlying issue is in the way matplotlib projections interpolate between points behind-the-scenes. The code in this case is actually the overridden transform_path_non_affine method in the transform: https://github.com/joferkington/mplstereonet/blob/master/mplstereonet/stereonet_transforms.py#L23 Previously, it relied on some implementation details to figure out whether or not to interpolate lines. However, those matplotlib implementation details have changed.

I'll dig into this one shortly. mplstereonet is long overdue for some general attention regardless.

Thanks for the detailed issue report!!

Antoine-Cate commented 5 years ago

No worries, and thanks for the awesome package.

joferkington commented 4 years ago

[@Antoine-Cate - Sorry for the delay on this. It seems I fixed this quite awhile ago: https://github.com/joferkington/mplstereonet/pull/25. However, there hasn't been an official release in quite awhile, and a lot of bugfixes/etc have accumulated in master in the meantime. I'll have a release out soon, but in the meantime you can install directly from master with

pip install git+https://github.com/joferkington/mplstereonet