Skip to content

Duval's Triangle Plotter

Python library for generating Duval's Triangle plots — a ternary diagnostic tool used in Dissolved Gas Analysis (DGA) for power transformer condition monitoring.

PyPI version MIT license Python versions GitHub stars

What is Duval's Triangle?

Duval's Triangle is a ternary plot that visualises the relative concentrations of methane (CH4), acetylene (C2H2), and ethylene (C2H4) dissolved in transformer oil. Different regions of the triangle correspond to distinct fault types, making it a standard diagnostic tool in power transformer condition monitoring.

Sample Duval's Triangle plot showing seven fault regions (PD, D1, D2, DT, T1, T2, T3) and a plotted data point.

Example plot showing the seven fault regions with a data point from a 2000-08-16 sample.

Why use this library?

Manually plotting Duval's Triangle requires careful calculation of gas ratios and region boundaries. This library automates the entire process: provide gas concentrations and receive a publication-ready, interactive Plotly figure with all seven fault regions shaded and labelled.

  • Ternary Plots — Generate publication-ready Duval's Triangle plots from gas concentration data.
  • Fault Regions — Seven standard zones: PD, D1, D2, DT, T1, T2, and T3, each with a distinct colour.
  • Customisable — Adjust layout dimensions, axis titles, marker symbols, and equipment labels.
  • Plotly Backend — Built on Plotly — interactive, zoomable figures that render in Jupyter notebooks and browsers.

Installation

pip install duvals-triangle-plotter

Full installation guide →

Quick Start

import duvals_triangle_plotter as dtp

# concentrations in ppm
methane   = [0.09]
acetylene = [0.0]
ethylene  = [0.91]
date      = "2000-08-16"

trace = dtp.get_duval_points_traces(
    methane, acetylene, ethylene, date
)

fig = dtp.get_duvals_triangle_plot(
    [trace], show_plot=True
)

Full quick start guide →

Documentation

Frequently Asked Questions

What is Duval's Triangle?

Duval's Triangle is a graphical method for interpreting Dissolved Gas Analysis (DGA) data. It plots three hydrocarbon gases (methane, acetylene, ethylene) as percentages on a ternary diagram and identifies fault types based on which region the data point falls in.

How do I install this library?

Run pip install duvals-triangle-plotter. Requires Python 3.6+ and Plotly 5+. See the Installation page for details.

What inputs does the library expect?

Three lists of gas concentrations (methane, acetylene, ethylene) in ppm, plus a date or label string for each sample.

View all FAQ →

Additional Resources