def test_multiple_grid(self): ix = [1, 3] fig, ax = plt.subplots(2, 2) ax = ax.flat ax = axes_to_ternary([ax[i] for i in ix]) self.assertTrue(hasattr(fig, "orderedaxes")) for i in ix: self.assertIsInstance(fig.orderedaxes[i], TernaryAxes)
def test_multiple_grid(self): ix = [1, 3] fig, ax = plt.subplots(2, 2) ax = ax.flat ax = axes_to_ternary([ax[i] for i in ix]) self.assertIsInstance(ax, list) for i in ix: self.assertIsInstance(ax[i], TernaryAxes)
def test_plot(self): ix = 1 fig, ax = plt.subplots(1, 2) ax = axes_to_ternary(ax[ix]) ax[ix].plot(*self.tlr, "k")
def test_default(self): ix = 1 fig, ax = plt.subplots(1, 2) ax = axes_to_ternary(ax[ix]) self.assertTrue(hasattr(fig, "orderedaxes")) self.assertIsInstance(fig.orderedaxes[ix], TernaryAxes)
def test_default(self): ix = 1 fig, ax = plt.subplots(1, 2) ax = axes_to_ternary(ax[ix]) self.assertIsInstance(ax, list) self.assertIsInstance(ax[ix], TernaryAxes)
# which will come in handy for exploring how it came together. The data variable here # is a dictonary with contains the grids and coordiantes used to construct the # histogram/density diagram. We can use these to show how the ternary log-grid is # constructed, and then transformed back to ternary space before being triangulated # and interpoalted for the ternary heatmap: # import matplotlib.pyplot as plt import pyrolite.plot from pyrolite.util.math import flattengrid from pyrolite.util.plot.axes import axes_to_ternary, share_axes fig, ax = plt.subplots(3, 2, figsize=(6, 9)) ax = ax.flat share_axes([ax[1], ax[2], ax[3]]) ax = axes_to_ternary([ax[0], ax[4], ax[5]]) ax[0].set_title("data", y=1.2) df.pyroplot.scatter(ax=ax[0], c="k", alpha=0.1) ax[0].scatter(*data["tern_bound_points"].T, c="k") ax[1].set_title("transformed data", y=1.2) ax[1].scatter(*data["tfm_tern_bound_points"].T, c="k") ax[1].scatter(*data["grid_transform"](df.values).T, c="k", alpha=0.1) ax[2].set_title("log grid", y=1.2) ax[2].scatter(*flattengrid(data["tfm_centres"]).T, c="k", marker=".", s=5) ax[2].scatter(*flattengrid(data["tfm_edges"]).T, c="k", marker=".", s=2) ax[2].scatter(*data["tfm_tern_bound_points"].T, c="k") ax[3].set_title("log-grid heatmap", y=1.2)