Skip to content

Commit

Permalink
Merge pull request #255 from Nick-Pearson/general-book-improvements
Browse files Browse the repository at this point in the history
Fix broken links and incorrect graphs in book
  • Loading branch information
andrei-ng authored Nov 24, 2024
2 parents 5f79fad + 5dd45ac commit 7aecfa7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo install mdbook
- run: cargo install mdbook --no-default-features --features search --vers "^0.4" --locked --quiet
- name: Build examples
run: |
cd ${{ github.workspace }}/examples/basic_charts && cargo run
Expand All @@ -40,5 +40,9 @@ jobs:
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add content
git commit --allow-empty -m 'Deploy to GitHub Pages'
if [ "${{ github.ref_type }}" == "tag" ]; then
git commit --allow-empty -m "update book for release ${{ github.ref }}"
else
git commit --allow-empty -m 'update book from commit ${{ github.sha }}'
fi
git push origin gh-pages
2 changes: 1 addition & 1 deletion docs/book/src/fundamentals/ndarray_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This extends the [Plotly.rs](https://github.com/plotly/plotly.rs) API in two way
* `Scatter` traces can now be created using the `Scatter::from_ndarray` constructor,
* and also multiple traces can be created with the `Scatter::to_traces` method.

The full source code for the examples below can be found [here](https://github.com/plotly/plotly.rs/tree/main/examples/ndarray_support).
The full source code for the examples below can be found [here](https://github.com/plotly/plotly.rs/tree/main/examples/ndarray).

## `ndarray` Traces

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ plot.show_image(ImageFormat::PNG, 1280, 900);

will display in the browser the rasterised plot; 1280 pixels wide and 900 pixels tall, in png format.

Once a satisfactory result is achieved, and assuming the [`kaleido`](getting_started#saving-plots) feature is enabled, the plot can be saved using the following:
Once a satisfactory result is achieved, and assuming the [`kaleido`](#saving-plots) feature is enabled, the plot can be saved using the following:

```rust
plot.write_image("/home/user/plot_name.ext", ImageFormat::PNG, 1280, 900, 1.0);
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/plotly_rs.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ Contributions are always welcomed, no matter how large or small. Refer to the [c

Plotly.rs is distributed under the terms of the MIT license.

See [LICENSE-MIT](https://github.com/plotly/plotly.rs/tree/main/LICENSE-MIT), and [COPYRIGHT](https://github.com/plotly/plotly.rs/tree/main/COPYRIGHT) for details.
See [LICENSE](https://github.com/plotly/plotly.rs/tree/main/LICENSE)
2 changes: 1 addition & 1 deletion docs/book/src/recipes/3dcharts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 3D Charts

The complete source code for the following examples can also be found [here](https://github.com/plotly/plotly.rs/tree/main/examples/plot3d).
The complete source code for the following examples can also be found [here](https://github.com/plotly/plotly.rs/tree/main/examples/3d_charts).

Kind | Link
:---|:----:
Expand Down
15 changes: 11 additions & 4 deletions examples/statistical_charts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,19 @@ fn box_plot_that_displays_the_underlying_data(show: bool) -> Plot {

// ANCHOR: horizontal_box_plot
fn horizontal_box_plot(show: bool) -> Plot {
let trace1 = BoxPlot::new(vec![1, 2, 3, 4, 4, 4, 8, 9, 10]).name("Set 1");
let trace2 = BoxPlot::new(vec![2, 3, 3, 3, 3, 5, 6, 6, 7]).name("Set 2");
let x = vec![
"Set 1", "Set 1", "Set 1", "Set 1", "Set 1", "Set 1", "Set 1", "Set 1", "Set 1", "Set 2",
"Set 2", "Set 2", "Set 2", "Set 2", "Set 2", "Set 2", "Set 2", "Set 2",
];

let trace = BoxPlot::new_xy(
vec![1, 2, 3, 4, 4, 4, 8, 9, 10, 2, 3, 3, 3, 3, 5, 6, 6, 7],
x.clone(),
)
.orientation(Orientation::Horizontal);

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

if show {
plot.show();
Expand Down

0 comments on commit 7aecfa7

Please sign in to comment.