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
12 changes: 10 additions & 2 deletions examples/scientific_charts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::f64::consts::PI;

use plotly::common::{ColorScale, ColorScalePalette, Font};
use plotly::common::{ColorScale, ColorScalePalette, Font, HoverInfo};
use plotly::contour::Contours;
use plotly::{Contour, HeatMap, Layout, Plot};
use plotly_utils::write_example_to_html;
Expand Down Expand Up @@ -124,7 +124,15 @@ fn customizing_spacing_between_x_and_y_ticks(show: bool, file_name: &str) {
// ANCHOR: basic_heat_map
fn basic_heat_map(show: bool, file_name: &str) {
let z = vec![vec![1, 20, 30], vec![20, 1, 60], vec![30, 60, 1]];
let trace = HeatMap::new_z(z).zmin(1.0).zmax(60.0);
let trace = HeatMap::new_z(z)
.zmin(1.0)
.zmax(60.0)
.hover_info(HoverInfo::Text)
.hover_text_matrix(vec![
vec!["A", "B", "C"],
vec!["D", "E", "F"],
vec!["G", "H", "I"],
]);
let mut plot = Plot::new();
plot.add_trace(trace);

Expand Down
10 changes: 6 additions & 4 deletions plotly/src/traces/heat_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ where
#[serde(rename = "hovertemplate")]
hover_template: Option<Dim<String>>,
#[serde(rename = "hovertext")]
hover_text: Option<Vec<String>>,
#[field_setter(with_matrix)]
hover_text: Option<Dim<String>>,
#[serde(rename = "legendgroup")]
legend_group: Option<String>,
#[serde(rename = "legendgrouptitle")]
Expand All @@ -99,7 +100,8 @@ where
show_legend: Option<bool>,
#[serde(rename = "showscale")]
show_scale: Option<bool>,
text: Option<Vec<String>>,
#[field_setter(with_matrix)]
text: Option<Dim<String>>,
transpose: Option<bool>,
visible: Option<Visible>,
x: Option<Vec<X>>,
Expand Down Expand Up @@ -214,15 +216,15 @@ mod tests {
.hover_on_gaps(true)
.hover_template("tmpl")
.hover_template_array(vec!["tmpl1", "tmpl2"])
.hover_text(vec!["hov", "er"])
.hover_text_array(vec!["hov", "er"])
.legend_group("1")
.legend_group_title("Legend Group Title")
.name("name")
.opacity(0.99)
.reverse_scale(false)
.show_legend(true)
.show_scale(false)
.text(vec!["te", "xt"])
.text_array(vec!["te", "xt"])
.transpose(true)
.visible(Visible::LegendOnly)
.x_axis("x")
Expand Down