Quick Start
This guide walks through a minimal working example. By the end you will have generated an interactive Duval's Triangle plot from DGA data.
Prerequisites
Make sure the library is installed:
Step 1: Import the library
Step 2: Prepare gas concentration data
Provide methane (CH4), acetylene (C2H2), and ethylene (C2H4) concentrations in ppm. Each parameter is a list so you can plot multiple samples at once.
Step 3: Create a scatterternary trace
get_duval_points_traces builds a Plotly scatterternary trace dict from the concentration data:
Step 4: Generate the figure
get_duvals_triangle_plot combines fault region polygons with the data trace and returns a Plotly Figure:
Set show_plot=True to display the figure immediately. Set it to False when saving or further customising the figure.
Understanding the output
The resulting figure shows:
- Seven shaded fault regions (PD, D1, D2, DT, T1, T2, T3)
- Your data point plotted as a marker within the ternary axes
- Axis labels for CH4, C2H2, and C2H4 percentages
- A title with the equipment name and the Duval's Triangle label
- Hover information showing sample date and gas concentrations
Using in Jupyter notebooks
This library works natively in Jupyter notebooks. When show_plot=True, the Plotly figure renders inline. No special configuration is needed.