Skip to content

Commit

Permalink
wip: update default branch name throughout repo
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Gherghescu <[email protected]>
  • Loading branch information
Andrei N.G. authored and andrei-ng committed Apr 26, 2024
1 parent 67ecabc commit 25a3496
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 53 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Before spending time and effort in making changes to the library, it's a good id

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.

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.
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.

## Code of Conduct

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<h1>Plotly.rs</h1>
<p><strong>Plotly for Rust</strong></p>
<p>
<a href="https://github.com/igiagkiozis/plotly/actions?query=branch%3Amaster" style="text-decoration: none!important;">
<img src="https://img.shields.io/github/actions/workflow/status/igiagkiozis/plotly/ci.yml?branch=master" alt="Build status">
<a href="https://github.com/igiagkiozis/plotly/actions?query=branch%3Amain" style="text-decoration: none!important;">
<img src="https://img.shields.io/github/actions/workflow/status/igiagkiozis/plotly/ci.yml?branch=main" alt="Build status">
</a>
<a href="https://crates.io/crates/plotly" style="text-decoration: none!important;">
<img src="https://img.shields.io/crates/v/plotly.svg" alt="Crates.io">
Expand All @@ -25,7 +25,7 @@
<span> | </span>
<a href="https://docs.rs/crate/plotly/">API Docs</a>
<span> | </span>
<a href="https://github.com/igiagkiozis/plotly/blob/master/CHANGELOG.md">Changelog</a>
<a href="https://github.com/igiagkiozis/plotly/blob/main/CHANGELOG.md">Changelog</a>
</h4>
</div>

Expand All @@ -44,10 +44,10 @@

A plotting library for Rust powered by [Plotly.js](https://plot.ly/javascript/).

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).
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).


For changes since the last version, please consult the [changelog](https://github.com/igiagkiozis/plotly/blob/master/CHANGELOG.md).
For changes since the last version, please consult the [changelog](https://github.com/igiagkiozis/plotly/blob/main/CHANGELOG.md).

# Basic Usage

Expand Down Expand Up @@ -163,21 +163,21 @@ pub fn plot_component() -> Html {
}
});


use_effect_with_deps(move |_| {
p.run();
|| ()
}, (),
);


html! {
<div id="plot-div"></div>
}
}
```

More detailed standalone examples can be found in the [examples/](https://github.com/igiagkiozis/plotly/tree/master/examples) directory.
More detailed standalone examples can be found in the [examples/](https://github.com/igiagkiozis/plotly/tree/main/examples) directory.

# Crate Feature Flags

Expand All @@ -203,10 +203,10 @@ Enables compilation for the `wasm32-unknown-unknown` target and provides access

* 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).

* Pull requests are welcome, see the [contributing guide](https://github.com/igiagkiozis/plotly/blob/master/CONTRIBUTING.md) for more information.
* Pull requests are welcome, see the [contributing guide](https://github.com/igiagkiozis/plotly/blob/main/CONTRIBUTING.md) for more information.

# License

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

See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/master/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/master/COPYRIGHT) for details.
See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/main/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/main/COPYRIGHT) for details.
6 changes: 3 additions & 3 deletions docs/book/src/fundamentals.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<a href="https://github.com/igiagkiozis/plotly/tree/master">
<img src="https://img.shields.io/badge/Plotly.rs-master-brightgreen" alt="build status">
<a href="https://github.com/igiagkiozis/plotly/tree/main">
<img src="https://img.shields.io/badge/Plotly.rs-main-brightgreen" alt="build status">
</a>
<a href="https://github.com/igiagkiozis/plotly/actions">
<img src="https://github.com/igiagkiozis/plotly/workflows/build/badge.svg" alt="build status">
Expand All @@ -18,4 +18,4 @@

# Fundamentals

Functionality that applies to the library as a whole is described in the next sections.
Functionality that applies to the library as a whole is described in the next sections.
16 changes: 8 additions & 8 deletions docs/book/src/fundamentals/jupyter_support.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Jupyter Support

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).
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).

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!


## Installation
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`.
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`.

```shell script
conda install -c plotly plotly=4.9.0
Expand All @@ -20,17 +20,17 @@ conda install notebook

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.

Run the following to install the Plotly Jupyter Lab extension:
Run the following to install the Plotly Jupyter Lab extension:
```shell script
jupyter labextension install [email protected]
```

Once this step is complete to make sure the installation so far was successful, run the following command:
Once this step is complete to make sure the installation so far was successful, run the following command:
```shell script
jupyter lab
```

Open a `Python 3` kernel copy/paste the following code in a cell and run it:
Open a `Python 3` kernel copy/paste the following code in a cell and run it:
```python
import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(x=['a', 'b', 'c'], y=[11, 22, 33]))
Expand Down Expand Up @@ -62,7 +62,7 @@ If you're not familiar with the EvCxR kernel it would be good that you at least

## Usage

Launch Jupyter Lab:
Launch Jupyter Lab:
```shell script
jupyter lab
```
Expand Down Expand Up @@ -104,6 +104,6 @@ plot.set_layout(layout);
plot.lab_display();
format!("EVCXR_BEGIN_CONTENT application/vnd.plotly.v1+json\n{}\nEVCXR_END_CONTENT", plot.to_json())
```
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.
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.
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)
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)
8 changes: 4 additions & 4 deletions docs/book/src/fundamentals/ndarray_support.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# `ndarray` Support
# `ndarray` Support

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:
```toml
[dependencies]
plotly = { version = ">=0.7.0", features = ["plotly_ndarray"] }
```

This extends the [Plotly.rs](https://github.com/igiagkiozis/plotly) API in two ways:
This extends the [Plotly.rs](https://github.com/igiagkiozis/plotly) API in two ways:
* `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/igiagkiozis/plotly/blob/master/plotly/examples/ndarray_support.rs).
The full source code for the examples below can be found [here](https://github.com/igiagkiozis/plotly/blob/main/plotly/examples/ndarray_support.rs).

## `ndarray` Traces

Expand Down Expand Up @@ -55,7 +55,7 @@ var layout = {};
</script>

### Multiple Traces
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.
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.

To illustrate this distinction consider the following examples:
```rust
Expand Down
18 changes: 9 additions & 9 deletions docs/book/src/getting_started.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<a href="https://github.com/igiagkiozis/plotly/tree/master">
<img src="https://img.shields.io/badge/Plotly.rs-master-brightgreen" alt="build status">
<a href="https://github.com/igiagkiozis/plotly/tree/main">
<img src="https://img.shields.io/badge/Plotly.rs-main-brightgreen" alt="build status">
</a>
<a href="https://github.com/igiagkiozis/plotly/actions">
<img src="https://github.com/igiagkiozis/plotly/workflows/build/badge.svg" alt="build status">
Expand Down Expand Up @@ -31,13 +31,13 @@ A `Plot` struct contains one or more `Trace` objects which describe the structur

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`.

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:
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:

```rust
use plotly::{Plot, Layout, Scatter};
```

The aforementioned components can be combined to produce as simple plot as follows:
The aforementioned components can be combined to produce as simple plot as follows:

```rust
use plotly::common::Mode;
Expand Down Expand Up @@ -65,25 +65,25 @@ fn main() -> std::io::Result<()> {
}
```

which results in the following figure (displayed here as a static png file):
which results in the following figure (displayed here as a static png file):

![line_and_scatter_plot](img/line_and_scatter_plot.png)

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:
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:

```rust
plot.write_html("/home/user/line_and_scatter_plot.html");
```

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:
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:

```rust
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`](getting_started#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 All @@ -93,7 +93,7 @@ The extension in the file-name path is optional as the appropriate extension (`I

## Saving Plots

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`:
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`:

```toml
[dependencies]
Expand Down
8 changes: 4 additions & 4 deletions docs/book/src/plotly_rs.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<a href="https://github.com/igiagkiozis/plotly/tree/master">
<img src="https://img.shields.io/badge/Plotly.rs-master-brightgreen" alt="build status">
<a href="https://github.com/igiagkiozis/plotly/tree/main">
<img src="https://img.shields.io/badge/Plotly.rs-main-brightgreen" alt="build status">
</a>
<a href="https://github.com/igiagkiozis/plotly/actions">
<img src="https://github.com/igiagkiozis/plotly/workflows/build/badge.svg" alt="build status">
Expand All @@ -27,10 +27,10 @@ Plotly.rs is free and open source. You can find the source on [GitHub](https://g
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).

## Contributing
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).
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).

## License

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

See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/master/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/master/COPYRIGHT) for details.
See [LICENSE-MIT](https://github.com/igiagkiozis/plotly/blob/main/LICENSE-MIT), and [COPYRIGHT](https://github.com/igiagkiozis/plotly/blob/main/COPYRIGHT) for details.
Loading

0 comments on commit 25a3496

Please sign in to comment.