Polar Plotting of Stereonets
jryoung3 opened this issue · 15 comments
Will there be Polar plotting of stereonets added in the near future?
@jryoung3 for stereonets plotting and related features and calculations, I would definitely check the mplstereonet
package at https://github.com/joferkington/mplstereonet since it's built to provide lower-hemisphere equal-area and equal-angle stereonets using mainly matplotlib.
The next release of apsg will allow to rotate projection to any position, including polar and both equal-area and equal-angle will be implemented.
StereoNet
keyword argument overlay_position
allows the user-defined orientation of the grid. For polar plotting, you can use:
pos = pair(0, 90, 0, 90)
s = StereoNet(overlay_position=pos)
s.show()
@ondrolexa Question.. apsg uses mplstereonet/matplotlib as backend for plotting?
Cause i just started using mplstereonet again after a long time yday and i found that a lot of arguments no longer work (specially regarding the gridlines) and i think it's because some update in matplotlib.
Today i just downloaded apsg and i'm seeing that it has the same issues, so i'm guessing it's passing the args to matplotlib.
apsg is using matplotlib for plotting, but not mplstereonet. Can you post examples with a description of the issue?
For ex., in any StereoNet plot i can't change the grid step:
s = StereoNet(gridstep=x)
With x being any number, doesn't work, it always uses 15.
Actually, i can put any argument in the constructor and it works without even throwing an error:
s = StereoNet(xsrttnoaregchgch=3)
Try overlay_step
and clip_pole
, e.g.:
s = StereoNet(overlay_step=5, clip_pole=10)
All keyword arguments will be explained soon in the documentation...
Not recognized kwargs are ignored, that's why not error is thrown...
That one did the trick, thanks.
Btw, i'm using the documentation from the master branch (https://apsg.readthedocs.io/en/master/apsg.plotting.html), i noticed the one in the stable release is slighty different, which one is the most up to date?
the master branch of documentation is the most up-to-date... But there are still some remnants of older doc strings. The kwargs for StereoNet are now described... https://apsg.readthedocs.io/en/master/apsg.plotting.html#apsg.plotting.StereoNet
Thanks!
@ondrolexa Question... Is there anyway to create a matplotlib subplots figure like? I've read the source code for the plotting module, but I couldn't find a way to work on that.
I am trying to create a subplot with 1 row (nrows=1) and 3 columns (ncols=3) and plot line data representing X, Y and Z axis in each stereogram individually.
Not in current version, but it could be possible to implement a new method, which will render stereonet to axes passed as argument... I can try to implement it in near future...
@raulindo, it is just the first implementation, so it could change in the future. Anyway using the master version you can use render2fig
method of StereoNet
to render the plot to any prepared figure/subfigure. Here is a working example:
from apsg import *
import matplotlib.pyplot as plt
fig = plt.figure(constrained_layout=True, figsize=(10, 4))
subfigs = fig.subfigures(1, 2)
f = folset.random_fisher(position=fol(130, 60))
l = linset.random_fisher(position=fol(230, 30))
s1 = StereoNet()
s1.great_circle(f)
s2 = StereoNet()
s2.contour(l)
s2.line(l, ms=4)
s1.render2fig(subfigs[0])
s2.render2fig(subfigs[1])
plt.show()
it will produce
@ondrolexa It worked like a charm! Thank you very much!