Skip to content

Commit badc5ad

Browse files
committed
Merge branch 'main' of https://github.com/plotly/plotly.rs into multiples-axis
2 parents 1fc5ab2 + 4e47e85 commit badc5ad

File tree

6 files changed

+35
-29
lines changed

6 files changed

+35
-29
lines changed

.github/workflows/ci.yml

+4-6
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,13 @@ jobs:
3838
components: clippy
3939
targets: wasm32-unknown-unknown
4040
# lint the main library workspace excluding the wasm feature
41-
# Rust 1.79 generates a new lint in autogenerated code:
42-
# Added clippy allow at the command line until it is fixed. See: https://github.com/rust-lang/rust-clippy/issues/12643 and https://github.com/TedDriggs/darling/issues/293
43-
- run: cargo clippy --features plotly_ndarray,plotly_image,kaleido -- -D warnings -Aclippy::manual_unwrap_or_default
41+
- run: cargo clippy --features plotly_ndarray,plotly_image,kaleido -- -D warnings
4442
# lint the plotly library with wasm enabled
45-
- run: cargo clippy --package plotly --features wasm --target wasm32-unknown-unknown -- -D warnings -Aclippy::manual_unwrap_or_default
43+
- run: cargo clippy --package plotly --features wasm --target wasm32-unknown-unknown -- -D warnings
4644
# lint the non-wasm examples
47-
- run: cd ${{ github.workspace }}/examples && cargo clippy --workspace --exclude "wasm*" -- -D warnings -Aclippy::manual_unwrap_or_default
45+
- run: cd ${{ github.workspace }}/examples && cargo clippy --workspace --exclude "wasm*" -- -D warnings
4846
# lint the wasm examples
49-
- run: cd ${{ github.workspace }}/examples && cargo clippy --target wasm32-unknown-unknown --package "wasm*" -- -Aclippy::manual_unwrap_or_default
47+
- run: cd ${{ github.workspace }}/examples && cargo clippy --target wasm32-unknown-unknown --package "wasm*"
5048

5149
semver:
5250
name: semver

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ When your contribution is ready for review, make a pull request with your change
2020

2121
## Code of Conduct
2222

23-
In all forums, we follow the [Rust Code of Conduct]. For escalation or moderation issues please contact Ioannis ([email protected]) instead of the Rust moderation team.
23+
In all forums, we follow the [Rust Code of Conduct]. For escalation or moderation issues please reach out to @andrei-ng or the Plotly official community at [[email protected]](mailto:[email protected]) instead of the Rust moderation team.
2424

2525
[Rust Code of Conduct]: https://www.rust-lang.org/conduct.html
2626

plotly/src/plot.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,19 @@ impl Plot {
275275
Plot::show_with_default_app(temp_path);
276276
}
277277

278+
/// Display the fully rendered HTML `Plot` in the default system browser.
279+
///
280+
/// The HTML file is generated and saved in the provided filename as long as
281+
/// the path already exists, after the file is saved, it is read and
282+
/// displayed by the browser.
283+
#[cfg(not(target_family = "wasm"))]
284+
pub fn show_html<P: AsRef<Path> + std::clone::Clone>(&self, filename: P) {
285+
let path = filename.as_ref().to_str().unwrap();
286+
self.write_html(filename.clone());
287+
// Hand off the job of opening the browser to an OS-specific implementation.
288+
Plot::show_with_default_app(path);
289+
}
290+
278291
/// Display the fully rendered `Plot` as a static image of the given format
279292
/// in the default system browser.
280293
#[cfg(not(target_family = "wasm"))]
@@ -311,7 +324,8 @@ impl Plot {
311324
pub fn write_html<P: AsRef<Path>>(&self, filename: P) {
312325
let rendered = self.to_html();
313326

314-
let mut file = File::create(filename).unwrap();
327+
let mut file =
328+
File::create(filename).expect("Provided filepath does not exist or is not accessible");
315329
file.write_all(rendered.as_bytes())
316330
.expect("failed to write html output");
317331
file.flush().unwrap();

plotly/src/traces/histogram.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,13 @@ where
200200
/// `ndarray` feature.
201201
///
202202
/// # Arguments
203-
/// * `x` - One dimensional array (or view) that represents the
204-
/// `x` axis coordinates.
203+
/// * `x`- One dimensional array (or view) that represents the `x` axis
204+
/// coordinates.
205205
/// * `traces_matrix` - Two dimensional array (or view) containing the `y`
206-
/// axis coordinates of
207-
/// the traces.
206+
/// axis coordinates of the traces.
208207
/// * `array_traces` - Determines whether the traces are arranged in the
209-
/// matrix over the
210-
/// columns (`ArrayTraces::OverColumns`) or over the rows
211-
/// (`ArrayTraces::OverRows`).
208+
/// matrix over the columns (`ArrayTraces::OverColumns`) or over the rows
209+
/// (`ArrayTraces::OverRows`).
212210
///
213211
/// # Examples
214212
///

plotly/src/traces/scatter.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,13 @@ where
315315
/// indexed by `x`. This function requires the `ndarray` feature.
316316
///
317317
/// # Arguments
318-
/// * `x` - One dimensional array (or view) that represents the
319-
/// `x` axis coordinates.
318+
/// * `x`- One dimensional array (or view) that represents the `x` axis
319+
/// coordinates.
320320
/// * `traces_matrix` - Two dimensional array (or view) containing the `y`
321-
/// axis coordinates of
322-
/// the traces.
321+
/// axis coordinates of the traces.
323322
/// * `array_traces` - Determines whether the traces are arranged in the
324-
/// matrix over the
325-
/// columns (`ArrayTraces::OverColumns`) or over the rows
326-
/// (`ArrayTraces::OverRows`).
323+
/// matrix over the columns (`ArrayTraces::OverColumns`) or over the rows
324+
/// (`ArrayTraces::OverRows`).
327325
///
328326
/// # Examples
329327
///

plotly/src/traces/scatter_polar.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,13 @@ where
246246
/// `ndarray` feature.
247247
///
248248
/// # Arguments
249-
/// * `x` - One dimensional array (or view) that represents the
250-
/// `x` axis coordinates.
249+
/// * `x` - One dimensional array (or view) that represents the `x` axis
250+
/// coordinates.
251251
/// * `traces_matrix` - Two dimensional array (or view) containing the `y`
252-
/// axis coordinates of
253-
/// the traces.
252+
/// axis coordinates of the traces.
254253
/// * `array_traces` - Determines whether the traces are arranged in the
255-
/// matrix over the
256-
/// columns (`ArrayTraces::OverColumns`) or over the rows
257-
/// (`ArrayTraces::OverRows`).
254+
/// matrix over the columns (`ArrayTraces::OverColumns`) or over the rows
255+
/// (`ArrayTraces::OverRows`).
258256
///
259257
/// # Examples
260258
///

0 commit comments

Comments
 (0)