Skip to content

Commit 80cf0de

Browse files
authored
Merge pull request #245 from rmburg/f64-contour-size
Change Contours size to be `f64` instead of `usize`
2 parents 78fddde + 7a93b07 commit 80cf0de

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
## [0.11.0] - 2024-11-x
7+
### Changed
8+
- [[#245](https://github.com/plotly/plotly.rs/pull/245)] Change Contours size to be `f64` instead of `usize`
9+
610
## [0.10.1] - 2024-11-x
711
### Added
812
- [[#243](https://github.com/plotly/plotly.rs/pull/243)] Made `plotly_embed_js` embed all JS scripts when enabled.

Diff for: docs/book/src/recipes/scientific_charts/contour_plots.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn customizing_size_and_range_of_a_contour_plots_contours(show: bool) {
113113
let trace = Contour::new_z(z)
114114
.color_scale(ColorScale::Palette(ColorScalePalette::Jet))
115115
.auto_contour(false)
116-
.contours(Contours::new().start(0.0).end(8.0).size(2));
116+
.contours(Contours::new().start(0.0).end(8.0).size(2.0));
117117

118118
let layout = Layout::new().title(Title::with_text("Customizing Size and Range of Contours"));
119119
let mut plot = Plot::new();
@@ -136,7 +136,7 @@ fn customizing_size_and_range_of_a_contour_plots_contours(show: bool) {
136136
if (document.getElementById("customizing_size_and_range_of_a_contour_plots_contours")) {
137137
var d3 = Plotly.d3;
138138
var image_element= d3.select('#image-export');
139-
var trace_0 = {"type":"contour","z":[[10.0,10.625,12.5,15.625,20.0],[5.625,6.25,8.125,11.25,15.625],[2.5,3.125,5.0,8.125,12.5],[0.625,1.25,3.125,6.25,10.625],[0.0,0.625,2.5,5.625,10.0]],"colorscale":"Jet","autocontour":false,"contours":{"start":0.0,"end":8.0,"size":2}};
139+
var trace_0 = {"type":"contour","z":[[10.0,10.625,12.5,15.625,20.0],[5.625,6.25,8.125,11.25,15.625],[2.5,3.125,5.0,8.125,12.5],[0.625,1.25,3.125,6.25,10.625],[0.0,0.625,2.5,5.625,10.0]],"colorscale":"Jet","autocontour":false,"contours":{"start":0.0,"end":8.0,"size":2.0}};
140140
var data = [trace_0];
141141
var layout = {"title":{"text":"Customizing Size and Range of Contours"}};
142142
Plotly.newPlot('customizing_size_and_range_of_a_contour_plots_contours', data, layout, {"responsive": true});

Diff for: examples/scientific_charts/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn customizing_size_and_range_of_a_contour_plots_contours() {
6666
let trace = Contour::new_z(z)
6767
.color_scale(ColorScale::Palette(ColorScalePalette::Jet))
6868
.auto_contour(false)
69-
.contours(Contours::new().start(0.0).end(8.0).size(2));
69+
.contours(Contours::new().start(0.0).end(8.0).size(2.0));
7070

7171
let layout = Layout::new().title("Customizing Size and Range of Contours");
7272
let mut plot = Plot::new();

Diff for: plotly/src/traces/contour.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub struct Contours {
5353
r#type: Option<ContoursType>,
5454
start: Option<f64>,
5555
end: Option<f64>,
56-
size: Option<usize>,
56+
size: Option<f64>,
5757
coloring: Option<Coloring>,
5858
#[serde(rename = "showlines")]
5959
show_lines: Option<bool>,
@@ -522,7 +522,7 @@ mod tests {
522522
.type_(ContoursType::Levels)
523523
.start(0.0)
524524
.end(10.0)
525-
.size(5)
525+
.size(5.0)
526526
.coloring(Coloring::HeatMap)
527527
.show_lines(true)
528528
.show_labels(false)
@@ -535,7 +535,7 @@ mod tests {
535535
"type": "levels",
536536
"start": 0.0,
537537
"end": 10.0,
538-
"size": 5,
538+
"size": 5.0,
539539
"coloring": "heatmap",
540540
"showlines": true,
541541
"showlabels": false,

0 commit comments

Comments
 (0)