Open maclariz opened 7 months ago
@maclariz you're right. The measure.pole_density_function
function performs the computation and returns the histogram data and edges, and is useful for accessing the data or performing further processing on the histogram data.
There is a similarly named function (perhaps confusingly) StereographicPlot.pole_density_function
which is essentially a convenience function around measure.pole_density_function
mentioned above, and can be used to quickly produce a plot. You can see this in the code here. (There is also a density plot for the inverse pole figure).
To answer your second point, yes absolutely. There are a couple examples in the tutorial you linked above. You just need to define the subplot projection as stereographic
to use the StereographicPlot
functions.
Here is an example with an independent plot (note that the orix.plot
import is necessary to register the projection within Matplotlib):
import orix.plot
from orix.vector import Vector3d
import numpy as np
import matplotlib.pyplot as plt
v = Vector3d(np.random.randn(1_000, 3))
fig = plt.figure(figsize=(10, 5))
ax1 = fig.add_subplot(121, projection="stereographic")
ax2 = fig.add_subplot(122)
ax1.pole_density_function(v)
x = np.arange(10)
ax2.plot(x, x**2)
This should be added to the examples gallery!
Thanks. This is helpful. Will use this. Sorry for late reply, was travelling on a different project.
Just had some fun with pole density function today, but I found an issue with documentation and I have a question.
First the issue: This page has plotting into an existing figure: https://orix.readthedocs.io/en/stable/tutorials/pole_density_function.html But this page doesn't even mention a "figure" argument you can call: https://orix.readthedocs.io/en/stable/reference/generated/orix.measure.pole_density_function.html
Secondly, the question: Can I use this function to plot within an existing defined axis within a multiple axis figure (e.g. created with plt.subplots)?