.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/examples/01_getting_started/03_plot_demo.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_examples_01_getting_started_03_plot_demo.py: Plot Demo ========= Demonstrating the plot methods. .. GENERATED FROM PYTHON SOURCE LINES 7-14 .. code-block:: Python import pandas as pd import plotly from plotly.graph_objs import Figure from elphick.geomet import Sample from elphick.geomet.utils.data import sample_data .. GENERATED FROM PYTHON SOURCE LINES 15-19 Load Data --------- We get some demo data in the form of a pandas DataFrame .. GENERATED FROM PYTHON SOURCE LINES 20-24 .. code-block:: Python df_data: pd.DataFrame = sample_data() df_data.head() .. raw:: html
wet_mass mass_dry FE SIO2 al2o3 LOI group
index
0 100.0 90.0 57.0 5.2 3.0 5.0 grp_1
1 90.0 80.0 59.0 3.1 1.7 4.0 grp_1
2 110.0 90.0 61.0 2.2 0.9 3.0 grp_2


.. GENERATED FROM PYTHON SOURCE LINES 25-27 Create Sample ------------- .. GENERATED FROM PYTHON SOURCE LINES 28-32 .. code-block:: Python obj_smpl: Sample = Sample(df_data) print(obj_smpl) .. rst-class:: sphx-glr-script-out .. code-block:: none Sample: None {'wet_mass': {0: 300.0}, 'mass_dry': {0: 260.0}, 'H2O': {0: 13.333333333333334}, 'Fe': {0: 59.0}, 'SiO2': {0: 3.5153846153846153}, 'Al2O3': {0: 1.8730769230769235}, 'LOI': {0: 4.0}} .. GENERATED FROM PYTHON SOURCE LINES 33-36 Parallel Plots -------------- Create an interactive parallel plot. Great for visualising and interactively filtering mass-composition data. .. GENERATED FROM PYTHON SOURCE LINES 37-41 .. code-block:: Python fig: Figure = obj_smpl.plot_parallel() fig .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 42-43 Create a parallel plot with only selected components and color .. GENERATED FROM PYTHON SOURCE LINES 44-48 .. code-block:: Python fig2 = obj_smpl.plot_parallel(vars_include=['wet_mass', 'H2O', 'Fe', 'group'], color='group') fig2 .. raw:: html


.. GENERATED FROM PYTHON SOURCE LINES 49-53 Ternary Diagram --------------- Create a ternary diagram for any 3 composition variables. .. GENERATED FROM PYTHON SOURCE LINES 53-58 .. code-block:: Python fig3 = obj_smpl.plot_ternary(variables=['SiO2', 'Al2O3', 'LOI'], color='group') # noinspection PyTypeChecker plotly.io.show(fig3) # this call to show will set the thumbnail for use in the gallery .. raw:: html :file: images/sphx_glr_03_plot_demo_001.html .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.866 seconds) .. _sphx_glr_download_auto_examples_examples_01_getting_started_03_plot_demo.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 03_plot_demo.ipynb <03_plot_demo.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 03_plot_demo.py <03_plot_demo.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_