Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
- [[#417](https://github.com/plotly/plotly.rs/issues/417)] Add `ScatterMap` (MapLibre `map` subplot) trace type — the modern counterpart to `ScatterMapbox`
- [[#418](https://github.com/plotly/plotly.rs/issues/418)] Add native point clustering to `ScatterMap` via a `Cluster` option
- [[#421](https://github.com/plotly/plotly.rs/pull/421)] Backfill trace attributes on trace types to bring them to parity with plotly.js 3.7
- [[#422](https://github.com/plotly/plotly.rs/issues/422)] Add `Indicator`, `Histogram2d`, `Icicle` trace types

### Changed

- [[#406](https://github.com/plotly/plotly.rs/issues/406)] Upgrade bundled plotly.js from 3.0.1 to 3.6.0
- [[#419](https://github.com/plotly/plotly.rs/issues/419)] Upgrade bundled plotly.js from 3.6.0 to 3.7.0
- [[#422](https://github.com/plotly/plotly.rs/issues/422)] Add layout-level `uirevision` to preserve UI state (zoom/pan/selection) across re-renders (complements the trace-level `uirevision` added in #421)

## [0.14.1] - 2026-02-15

Expand Down
3 changes: 3 additions & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
- [Sankey Diagrams](./recipes/basic_charts/sankey_diagrams.md)
- [Treemap Charts](./recipes/basic_charts/treemap_charts.md)
- [Sunburst Charts](./recipes/basic_charts/sunburst_charts.md)
- [Icicle Charts](./recipes/basic_charts/icicle_charts.md)
- [Indicator Charts](./recipes/basic_charts/indicator_charts.md)
- [Statistical Charts](./recipes/statistical_charts.md)
- [Error Bars](./recipes/statistical_charts/error_bars.md)
- [Box Plots](./recipes/statistical_charts/box_plots.md)
- [Violin Plots](./recipes/statistical_charts/violin_plots.md)
- [Histograms](./recipes/statistical_charts/histograms.md)
- [2D Histograms](./recipes/statistical_charts/histogram2d.md)
- [Scientific Charts](./recipes/scientific_charts.md)
- [Contour Plots](./recipes/scientific_charts/contour_plots.md)
- [Heatmaps](./recipes/scientific_charts/heatmaps.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/book/src/recipes/basic_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Pie Charts | [![Pie Charts](./img/pie_charts.png)](./basic_charts/pie_charts.md)
Sankey Diagrams | [![Sankey Diagrams](./img/basic_sankey.png)](./basic_charts/sankey_diagrams.md)
Treemap Charts | [Treemap Charts](./basic_charts/treemap_charts.md)
Sunburst Charts | [Sunburst Charts](./basic_charts/sunburst_charts.md)
Icicle Charts | [Icicle Charts](./basic_charts/icicle_charts.md)
Indicator Charts | [Indicator Charts](./basic_charts/indicator_charts.md)
27 changes: 27 additions & 0 deletions docs/book/src/recipes/basic_charts/icicle_charts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Icicle Charts

The following imports have been used to produce the plots below:

```rust,no_run
use plotly::color::NamedColor;
use plotly::common::{Line, Orientation};
use plotly::icicle::{BranchValues, Leaf, Marker, PathBar, Side, Tiling};
use plotly::{Icicle, Plot};
```

The `to_inline_html` method is used to produce the html plot displayed in this page.

## Basic Icicle
```rust,no_run
{{#include ../../../../../examples/basic_charts/src/main.rs:basic_icicle}}
```

{{#include ../../../../../examples/basic_charts/output/inline_basic_icicle.html}}


## Styled Icicle with Tiling and Path Bar
```rust,no_run
{{#include ../../../../../examples/basic_charts/src/main.rs:styled_icicle}}
```

{{#include ../../../../../examples/basic_charts/output/inline_styled_icicle.html}}
31 changes: 31 additions & 0 deletions docs/book/src/recipes/basic_charts/indicator_charts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Indicator Charts

The following imports have been used to produce the plots below:

```rust,no_run
use plotly::color::NamedColor;
use plotly::common::{Domain, Line};
use plotly::layout::Layout;
use plotly::traces::indicator::{
Align, Delta, DeltaPosition, Direction, Gauge, GaugeAxis, GaugeBar, GaugeShape,
IndicatorTitle, Mode, Number, Step, Threshold,
};
use plotly::{Indicator, Plot};
```

The `to_inline_html` method is used to produce the html plot displayed in this page.

## Basic Indicator with Number and Delta
```rust,no_run
{{#include ../../../../../examples/basic_charts/src/main.rs:basic_indicator}}
```

{{#include ../../../../../examples/basic_charts/output/inline_basic_indicator.html}}


## Indicator Gauge
```rust,no_run
{{#include ../../../../../examples/basic_charts/src/main.rs:indicator_gauge}}
```

{{#include ../../../../../examples/basic_charts/output/inline_indicator_gauge.html}}
Binary file added docs/book/src/recipes/img/basic_histogram2d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/book/src/recipes/statistical_charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Error Bars |[![Scatter Plots](./img/error_bars.png)](./statistical_charts/error_
Box Plots | [![Line Charts](./img/box_plot.png)](./statistical_charts/box_plots.md)
Violin Plots | [![Violin Plots](./img/violin_plot.png)](./statistical_charts/violin_plots.md)
Histograms | [![Scatter Plots](./img/overlaid_histogram.png)](./statistical_charts/histograms.md)
2D Histograms | [![2D Histograms](./img/basic_histogram2d.png)](./statistical_charts/histogram2d.md)
35 changes: 35 additions & 0 deletions docs/book/src/recipes/statistical_charts/histogram2d.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 2D Histograms

The following imports have been used to produce the plots below:

```rust,no_run
use plotly::common::{ColorScale, ColorScalePalette};
use plotly::histogram::{Bins, HistFunc, HistNorm};
use plotly::layout::{Axis, Layout};
use plotly::{Histogram2d, Plot};
```

The `to_inline_html` method is used to produce the html plot displayed in this page.

## Basic 2D Histogram
```rust,no_run
{{#include ../../../../../examples/statistical_charts/src/main.rs:basic_histogram2d}}
```

{{#include ../../../../../examples/statistical_charts/output/inline_basic_histogram2d.html}}


## Styled 2D Histogram
```rust,no_run
{{#include ../../../../../examples/statistical_charts/src/main.rs:styled_histogram2d}}
```

{{#include ../../../../../examples/statistical_charts/output/inline_styled_histogram2d.html}}


## 2D Histogram with Per-Sample Aggregation
```rust,no_run
{{#include ../../../../../examples/statistical_charts/src/main.rs:histogram2d_aggregation}}
```

{{#include ../../../../../examples/statistical_charts/output/inline_histogram2d_aggregation.html}}
149 changes: 148 additions & 1 deletion examples/basic_charts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,26 @@ use plotly::{
ColorScale, ColorScalePalette, DashType, Domain, Fill, Font, HoverInfo, Line, LineShape,
Marker, Mode, Orientation, Pattern, PatternShape,
},
icicle::{
BranchValues as IcicleBranchValues, Leaf as IcicleLeaf, Marker as IcicleMarker,
PathBar as IciclePathBar, Side as IcicleSide, Tiling as IcicleTiling,
},
layout::{
AngularAxis, Annotation, Axis, AxisRange, BarMode, CategoryOrder, Layout, LayoutGrid,
LayoutPolar, Legend, PolarAxisAttributes, PolarAxisTicks, PolarDirection, RadialAxis,
TicksDirection, TraceOrder,
},
sankey::{Line as SankeyLine, Link, Node},
sunburst::{InsideTextOrientation, Leaf},
traces::indicator::{
Align, Delta, DeltaPosition, Direction, Gauge, GaugeAxis, GaugeBar, GaugeShape,
IndicatorTitle, Mode as IndicatorMode, Number, Step, Threshold,
},
traces::table::{
Align as TableAlign, Cells, Fill as TableFill, Font as TableFont, Header, Line as TableLine,
},
treemap::{BranchValues, Marker as TreemapMarker, Packing, PathBar, Side, Tiling},
Bar, Pie, Plot, Sankey, Scatter, ScatterPolar, Sunburst, Table, Treemap,
Bar, Icicle, Indicator, Pie, Plot, Sankey, Scatter, ScatterPolar, Sunburst, Table, Treemap,
};
use plotly_utils::write_example_to_html;
use rand_distr::{Distribution, Normal, Uniform};
Expand Down Expand Up @@ -1147,6 +1155,137 @@ fn styled_sunburst(show: bool, file_name: &str) {
}
// ANCHOR_END: styled_sunburst

// Icicle Charts
// ANCHOR: basic_icicle
fn basic_icicle(show: bool, file_name: &str) {
let labels = vec![
"Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura",
];
let parents = vec![
"", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve",
];
let trace = Icicle::new(labels, parents)
.values(vec![10.0, 14.0, 12.0, 10.0, 2.0, 6.0, 6.0, 4.0, 4.0])
.text_info("label+value");

let mut plot = Plot::new();
plot.add_trace(trace);

let path = write_example_to_html(&plot, file_name);
if show {
plot.show_html(path);
}
}
// ANCHOR_END: basic_icicle

// ANCHOR: styled_icicle
fn styled_icicle(show: bool, file_name: &str) {
let labels = vec![
"Total",
"Tech",
"Health",
"Finance",
"Software",
"Hardware",
"Pharma",
"Devices",
"Banking",
"Insurance",
];
let parents = vec![
"", "Total", "Total", "Total", "Tech", "Tech", "Health", "Health", "Finance", "Finance",
];
let trace = Icicle::new(labels, parents)
.values(vec![0.0, 0.0, 0.0, 0.0, 40.0, 30.0, 25.0, 15.0, 20.0, 18.0])
.branch_values(IcicleBranchValues::Remainder)
.marker(IcicleMarker::new().line(Line::new().width(1.0).color(NamedColor::White)))
.tiling(
IcicleTiling::new()
.orientation(Orientation::Horizontal)
.pad(2.0),
)
.path_bar(IciclePathBar::new().visible(true).side(IcicleSide::Top))
.leaf(IcicleLeaf::new().opacity(0.7))
.text_info("label+value+percent parent");

let mut plot = Plot::new();
plot.add_trace(trace);

let path = write_example_to_html(&plot, file_name);
if show {
plot.show_html(path);
}
}
// ANCHOR_END: styled_icicle

// Indicator Charts
// ANCHOR: basic_indicator
fn basic_indicator(show: bool, file_name: &str) {
let trace = Indicator::new(120.0)
.mode(IndicatorMode::NumberAndDelta)
.align(Align::Center)
.title(IndicatorTitle::new().text("Revenue"))
.number(Number::new().prefix("$").value_format(".2f"))
.delta(
Delta::new()
.reference(100.0)
.relative(true)
.position(DeltaPosition::Top)
.increasing(Direction::new().color(NamedColor::Green).symbol("▲"))
.decreasing(Direction::new().color(NamedColor::Red).symbol("▼")),
)
.domain(Domain::new());

let layout = Layout::new().title("Basic Indicator");
let mut plot = Plot::new();
plot.set_layout(layout);
plot.add_trace(trace);

let path = write_example_to_html(&plot, file_name);
if show {
plot.show_html(path);
}
}
// ANCHOR_END: basic_indicator

// ANCHOR: indicator_gauge
fn indicator_gauge(show: bool, file_name: &str) {
let trace = Indicator::new(270.0)
.mode(IndicatorMode::Gauge)
.title(IndicatorTitle::new().text("Speed"))
.gauge(
Gauge::new()
.shape(GaugeShape::Angular)
.axis(GaugeAxis::new().range([0.0, 500.0]))
.bar(GaugeBar::new().color("darkblue").thickness(0.75))
.background_color(NamedColor::White)
.border_color(NamedColor::Gray)
.border_width(1.0)
.steps(vec![
Step::new().range([0.0, 250.0]).color("lightgray"),
Step::new().range([250.0, 400.0]).color("gray"),
])
.threshold(
Threshold::new()
.line(Line::new().color(NamedColor::Red).width(4.0))
.thickness(0.75)
.value(490.0),
),
)
.domain(Domain::new());

let layout = Layout::new().title("Indicator Gauge");
let mut plot = Plot::new();
plot.set_layout(layout);
plot.add_trace(trace);

let path = write_example_to_html(&plot, file_name);
if show {
plot.show_html(path);
}
}
// ANCHOR_END: indicator_gauge

// ANCHOR: set_lower_or_upper_bound_on_axis
fn set_lower_or_upper_bound_on_axis(show: bool, file_name: &str) {
use std::fs::File;
Expand Down Expand Up @@ -1312,6 +1451,14 @@ fn main() {
basic_sunburst(false, "basic_sunburst");
styled_sunburst(false, "styled_sunburst");

// Icicle Charts
basic_icicle(false, "basic_icicle");
styled_icicle(false, "styled_icicle");

// Indicator Charts
basic_indicator(false, "basic_indicator");
indicator_gauge(false, "indicator_gauge");

// Set Lower or Upper Bound on Axis
set_lower_or_upper_bound_on_axis(false, "set_lower_or_upper_bound_on_axis");
}
Loading
Loading