Skip to content

Commit 4c8b3bc

Browse files
committed
hardcode HeatMap zmin/zmax/zmid type to f64
Signed-off-by: Andrei Gherghescu <[email protected]>
1 parent cd7a1be commit 4c8b3bc

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

examples/custom_controls/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn bar_plot_with_dropdown_for_different_data() {
4444
/// Display a heat map, with buttons to allow for toggling of different
4545
/// colorscales.
4646
fn heat_map_with_modifiable_colorscale() {
47-
type HeatMapType = HeatMap<f64, f64, f64>;
47+
type HeatMapType = HeatMap<f64, f64, Vec<f64>>;
4848
let gauss = |v: i32| (-v as f64 * v as f64 / 200.0).exp();
4949
let z = (-30..30)
5050
.map(|x| (-30..30).map(|y| gauss(x) * gauss(y)).collect_vec())

examples/scientific_charts/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn customizing_spacing_between_x_and_y_ticks() {
102102
// Heatmaps
103103
fn basic_heat_map() {
104104
let z = vec![vec![1, 20, 30], vec![20, 1, 60], vec![30, 60, 1]];
105-
let trace = HeatMap::new_z(z);
105+
let trace = HeatMap::new_z(z).zmin(1.0).zmax(60.0);
106106
let mut plot = Plot::new();
107107
plot.add_trace(trace);
108108

plotly/src/traces/heat_map.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ where
106106
y_axis: Option<String>,
107107
#[serde(rename = "ycalendar")]
108108
y_calendar: Option<Calendar>,
109-
z: Option<Vec<Vec<Z>>>,
109+
z: Option<Vec<Z>>,
110110
zauto: Option<bool>,
111111
#[serde(rename = "zhoverformat")]
112112
zhover_format: Option<String>,
113-
zmax: Option<Z>,
114-
zmid: Option<Z>,
115-
zmin: Option<Z>,
113+
zmax: Option<f64>,
114+
zmid: Option<f64>,
115+
zmin: Option<f64>,
116116
zsmooth: Option<Smoothing>,
117117
}
118118

119119
impl<Z> HeatMap<f64, f64, Z>
120120
where
121121
Z: Serialize + Clone,
122122
{
123-
pub fn new_z(z: Vec<Vec<Z>>) -> Box<Self> {
123+
pub fn new_z(z: Vec<Z>) -> Box<Self> {
124124
Box::new(Self {
125125
z: Some(z),
126126
..Default::default()
@@ -134,7 +134,7 @@ where
134134
Y: Serialize + Clone,
135135
Z: Serialize + Clone,
136136
{
137-
pub fn new(x: Vec<X>, y: Vec<Y>, z: Vec<Vec<Z>>) -> Box<Self> {
137+
pub fn new(x: Vec<X>, y: Vec<Y>, z: Vec<Z>) -> Box<Self> {
138138
Box::new(Self {
139139
x: Some(x),
140140
y: Some(y),

0 commit comments

Comments
 (0)