You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Before spending time and effort in making changes to the library, it's a good id
16
16
17
17
Fork [plotly](https://igiagkiozis.github.io/plotly/) to your own account and create a new branch for your feature. Remember to update the [changelog](CHANGELOG.md) - use previous entries as a template.
18
18
19
-
When your contribution is ready for review, make a pull request with your changes directly to the `master` branch. One of the maintainers will have a look at what you've done, suggest any necessary changes and, when everyone is happy, merge the pull request.
19
+
When your contribution is ready for review, make a pull request with your changes directly to the `main` branch. One of the maintainers will have a look at what you've done, suggest any necessary changes and, when everyone is happy, merge the pull request.
A plotting library for Rust powered by [Plotly.js](https://plot.ly/javascript/).
46
46
47
-
Documentation and numerous interactive examples are available in the [Plotly.rs Book](https://igiagkiozis.github.io/plotly/content/getting_started.html), the [examples/](https://github.com/igiagkiozis/plotly/tree/master/examples) directory and [docs.rs](https://docs.rs/crate/plotly).
47
+
Documentation and numerous interactive examples are available in the [Plotly.rs Book](https://igiagkiozis.github.io/plotly/content/getting_started.html), the [examples/](https://github.com/igiagkiozis/plotly/tree/main/examples) directory and [docs.rs](https://docs.rs/crate/plotly).
48
48
49
49
50
-
For changes since the last version, please consult the [changelog](https://github.com/igiagkiozis/plotly/blob/master/CHANGELOG.md).
50
+
For changes since the last version, please consult the [changelog](https://github.com/igiagkiozis/plotly/blob/main/CHANGELOG.md).
51
51
52
52
# Basic Usage
53
53
@@ -163,21 +163,21 @@ pub fn plot_component() -> Html {
163
163
}
164
164
});
165
165
166
-
166
+
167
167
use_effect_with_deps(move|_| {
168
168
p.run();
169
169
|| ()
170
170
}, (),
171
171
);
172
-
172
+
173
173
174
174
html! {
175
175
<divid="plot-div"></div>
176
176
}
177
177
}
178
178
```
179
179
180
-
More detailed standalone examples can be found in the [examples/](https://github.com/igiagkiozis/plotly/tree/master/examples) directory.
180
+
More detailed standalone examples can be found in the [examples/](https://github.com/igiagkiozis/plotly/tree/main/examples) directory.
181
181
182
182
# Crate Feature Flags
183
183
@@ -203,10 +203,10 @@ Enables compilation for the `wasm32-unknown-unknown` target and provides access
203
203
204
204
* If you've spotted a bug or would like to see a new feature, please submit an issue on the [issue tracker](https://github.com/igiagkiozis/plotly/issues).
205
205
206
-
* Pull requests are welcome, see the [contributing guide](https://github.com/igiagkiozis/plotly/blob/master/CONTRIBUTING.md) for more information.
206
+
* Pull requests are welcome, see the [contributing guide](https://github.com/igiagkiozis/plotly/blob/main/CONTRIBUTING.md) for more information.
207
207
208
208
# License
209
209
210
210
`Plotly.rs` is distributed under the terms of the MIT license.
211
211
212
-
See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/master/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/master/COPYRIGHT) for details.
212
+
See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/main/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/main/COPYRIGHT) for details.
Copy file name to clipboardExpand all lines: docs/book/src/fundamentals/jupyter_support.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
# Jupyter Support
2
2
3
-
As of version `0.7.0`, [Plotly.rs](https://github.com/igiagkiozis/plotly) has native support for the [EvCxR Jupyter Kernel](https://github.com/google/evcxr/tree/master/evcxr_jupyter).
3
+
As of version `0.7.0`, [Plotly.rs](https://github.com/igiagkiozis/plotly) has native support for the [EvCxR Jupyter Kernel](https://github.com/google/evcxr/tree/master/evcxr_jupyter).
4
4
5
5
Once you've installed the required packages you'll be able to run all the examples shown here as well as all [the recipes](../recipes.md) in Jupyter Lab!
6
6
7
7
8
8
## Installation
9
-
It is assumed that an installation of the [Anaconda](https://www.anaconda.com/products/individual) Python distribution is already present in the system. If that is not the case you can follow these [instructions](https://www.anaconda.com/products/individual) to get up and running with `Anaconda`.
9
+
It is assumed that an installation of the [Anaconda](https://www.anaconda.com/products/individual) Python distribution is already present in the system. If that is not the case you can follow these [instructions](https://www.anaconda.com/products/individual) to get up and running with `Anaconda`.
10
10
11
11
```shell script
12
12
conda install -c plotly plotly=4.9.0
@@ -20,17 +20,17 @@ conda install notebook
20
20
21
21
Although there are alternative methods to enable support for the [EvCxR Jupyter Kernel](https://github.com/google/evcxr/tree/master/evcxr_jupyter), we have elected to keep the requirements consistent with what those of other languages, e.g. Julia, Python and R. This way users know what to expect; and also the folks at [Plotly](https://plotly.com/python/getting-started/#jupyter-notebook-support) have done already most of the heavy lifting to create an extension for Jupyter Lab that works very well.
22
22
23
-
Run the following to install the Plotly Jupyter Lab extension:
23
+
Run the following to install the Plotly Jupyter Lab extension:
For Jupyter Lab there are two ways to display a plot in the `EvCxR` kernel, either have the plot object be in the last line without a semicolon or directly invoke the `Plot::lab_display` method on it; both have the same result. You can also find an example notebook [here](https://github.com/igiagkiozis/plotly/blob/master/examples/jupyter/jupyter_lab.ipynb) that will periodically be updated with examples.
107
+
For Jupyter Lab there are two ways to display a plot in the `EvCxR` kernel, either have the plot object be in the last line without a semicolon or directly invoke the `Plot::lab_display` method on it; both have the same result. You can also find an example notebook [here](https://github.com/igiagkiozis/plotly/blob/main/examples/jupyter/jupyter_lab.ipynb) that will periodically be updated with examples.
108
108
109
-
The process for Jupyter Notebook is very much the same with one exception; the `Plot::notebook_display` method must be used to display the plot. You can find an example notebook [here](https://github.com/igiagkiozis/plotly/blob/master/examples/jupyter/jupyter_notebook.ipynb)
109
+
The process for Jupyter Notebook is very much the same with one exception; the `Plot::notebook_display` method must be used to display the plot. You can find an example notebook [here](https://github.com/igiagkiozis/plotly/blob/main/examples/jupyter/jupyter_notebook.ipynb)
Copy file name to clipboardExpand all lines: docs/book/src/fundamentals/ndarray_support.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
-
# `ndarray` Support
1
+
# `ndarray` Support
2
2
3
3
To enable [ndarray](https://github.com/rust-ndarray/ndarray) support in [Plotly.rs](https://github.com/igiagkiozis/plotly) add the following feature to your `Cargo.toml` file:
4
4
```toml
5
5
[dependencies]
6
6
plotly = { version = ">=0.7.0", features = ["plotly_ndarray"] }
7
7
```
8
8
9
-
This extends the [Plotly.rs](https://github.com/igiagkiozis/plotly) API in two ways:
9
+
This extends the [Plotly.rs](https://github.com/igiagkiozis/plotly) API in two ways:
10
10
*`Scatter` traces can now be created using the `Scatter::from_ndarray` constructor,
11
11
* and also multiple traces can be created with the `Scatter::to_traces` method.
12
12
13
-
The full source code for the examples below can be found [here](https://github.com/igiagkiozis/plotly/blob/master/plotly/examples/ndarray_support.rs).
13
+
The full source code for the examples below can be found [here](https://github.com/igiagkiozis/plotly/blob/main/plotly/examples/ndarray_support.rs).
14
14
15
15
## `ndarray` Traces
16
16
@@ -55,7 +55,7 @@ var layout = {};
55
55
</script>
56
56
57
57
### Multiple Traces
58
-
To display a `2D` array (`Array<_, Ix2>`) you can use the `Scatter::to_traces` method. The first argument of the method represents the common axis for the traces (`x` axis) whilst the second argument contains a collection of traces. At this point it should be noted that there is some ambiguity when passing a `2D` array; namely are the traces arranged along the columns or the rows of the matrix? This ambiguity is resolved by the third argument of the `Scatter::to_traces` method. If that argument is set to `ArrayTraces::OverColumns` then the library assumes that every column represents an individual trace, alternatively if this is set to `ArrayTraces::OverRows` the assumption is that every row represents a trace.
58
+
To display a `2D` array (`Array<_, Ix2>`) you can use the `Scatter::to_traces` method. The first argument of the method represents the common axis for the traces (`x` axis) whilst the second argument contains a collection of traces. At this point it should be noted that there is some ambiguity when passing a `2D` array; namely are the traces arranged along the columns or the rows of the matrix? This ambiguity is resolved by the third argument of the `Scatter::to_traces` method. If that argument is set to `ArrayTraces::OverColumns` then the library assumes that every column represents an individual trace, alternatively if this is set to `ArrayTraces::OverRows` the assumption is that every row represents a trace.
59
59
60
60
To illustrate this distinction consider the following examples:
@@ -31,13 +31,13 @@ A `Plot` struct contains one or more `Trace` objects which describe the structur
31
31
32
32
The builder pattern is used extensively throughout the library, which means you only need to specify the attributes and details you desire. Any attributes that are not set will fall back to the default value used by `plotly.js`.
33
33
34
-
All available traces (e.g. `Scatter`, `Bar`, `Histogram`, etc), the `Layout`, `Configuration` and `Plot` have been hoisted in the `plotly` namespace so that they can be imported simply using the following:
34
+
All available traces (e.g. `Scatter`, `Bar`, `Histogram`, etc), the `Layout`, `Configuration` and `Plot` have been hoisted in the `plotly` namespace so that they can be imported simply using the following:
35
35
36
36
```rust
37
37
useplotly::{Plot, Layout, Scatter};
38
38
```
39
39
40
-
The aforementioned components can be combined to produce as simple plot as follows:
40
+
The aforementioned components can be combined to produce as simple plot as follows:
The above code will generate an interactive `html` page of the `Plot` and display it in the default browser. The `html` for the plot is stored in the platform specific temporary directory. To save the `html` result, you can do so quite simply:
72
+
The above code will generate an interactive `html` page of the `Plot` and display it in the default browser. The `html` for the plot is stored in the platform specific temporary directory. To save the `html` result, you can do so quite simply:
It is often the case that plots are produced to be included in a document and a different format for the plot is desirable (e.g. png, jpeg, etc). Given that the `html` version of the plot is composed of vector graphics, the display when converted to a non-vector format (e.g. png) is not guaranteed to be identical to the one displayed in `html`. This means that some fine tuning may be required to get to the desired output. To support that iterative workflow, `Plot` has a `show_image()` method which will display the rasterised output to the target format, for example:
78
+
It is often the case that plots are produced to be included in a document and a different format for the plot is desirable (e.g. png, jpeg, etc). Given that the `html` version of the plot is composed of vector graphics, the display when converted to a non-vector format (e.g. png) is not guaranteed to be identical to the one displayed in `html`. This means that some fine tuning may be required to get to the desired output. To support that iterative workflow, `Plot` has a `show_image()` method which will display the rasterised output to the target format, for example:
79
79
80
80
```rust
81
81
plot.show_image(ImageFormat::PNG, 1280, 900);
82
82
```
83
83
84
84
will display in the browser the rasterised plot; 1280 pixels wide and 900 pixels tall, in png format.
85
85
86
-
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:
86
+
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:
@@ -93,7 +93,7 @@ The extension in the file-name path is optional as the appropriate extension (`I
93
93
94
94
## Saving Plots
95
95
96
-
To add the ability to save plots in the following formats: png, jpeg, webp, svg, pdf and eps, you can use the `kaleido` feature. This feature depends on [plotly/Kaleido](https://github.com/plotly/Kaleido): a cross-platform open source library for generating static images. All the necessary binaries have been included with `plotly_kaleido` for `Linux`, `Windows` and `MacOS`. Previous versions of [plotly.rs](https://github.com/igiagkiozis/plotly) used the `orca` feature, however, this has been deprecated as it provided the same functionality but required additional installation steps. To enable the `kaleido` feature add the following to your `Cargo.toml`:
96
+
To add the ability to save plots in the following formats: png, jpeg, webp, svg, pdf and eps, you can use the `kaleido` feature. This feature depends on [plotly/Kaleido](https://github.com/plotly/Kaleido): a cross-platform open source library for generating static images. All the necessary binaries have been included with `plotly_kaleido` for `Linux`, `Windows` and `MacOS`. Previous versions of [plotly.rs](https://github.com/igiagkiozis/plotly) used the `orca` feature, however, this has been deprecated as it provided the same functionality but required additional installation steps. To enable the `kaleido` feature add the following to your `Cargo.toml`:
@@ -27,10 +27,10 @@ Plotly.rs is free and open source. You can find the source on [GitHub](https://g
27
27
This book is intended to be a recipe index, which closely follows the [plotly.js examples](https://plotly.com/javascript/), and is complemented by the [API documentation](https://docs.rs/plotly).
28
28
29
29
## Contributing
30
-
Contributions are always welcomed, no matter how large or small. Refer to the [contributing guidelines](https://github.com/igiagkiozis/plotly/blob/master/CONTRIBUTING.md) for further pointers, and, if in doubt, [open an issue](https://github.com/igiagkiozis/plotly/issues).
30
+
Contributions are always welcomed, no matter how large or small. Refer to the [contributing guidelines](https://github.com/igiagkiozis/plotly/blob/main/CONTRIBUTING.md) for further pointers, and, if in doubt, [open an issue](https://github.com/igiagkiozis/plotly/issues).
31
31
32
32
## License
33
33
34
34
Plotly.rs is distributed under the terms of the MIT license.
35
35
36
-
See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/master/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/master/COPYRIGHT) for details.
36
+
See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/main/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/main/COPYRIGHT) for details.
0 commit comments