Skip to content

Commit

Permalink
Fix issue #18. (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
DJDuque authored Jun 20, 2022
1 parent 2d72ecb commit d05b626
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgfplots"
version = "0.3.1"
version = "0.4.0" # Remember to also change this in the README.md
edition = "2021"
license = "MIT"
description = "A Rust library to generate publication-quality figures"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add the following to your `Cargo.toml` file:

```toml
[dependencies]
pgfplots = { version = "0.3", features = ["inclusive"] }
pgfplots = { version = "0.4", features = ["inclusive"] }
```

Plotting a quadratic function is as simple as:
Expand Down
12 changes: 6 additions & 6 deletions src/axis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ impl Axis {
/// let mut axis = Axis::new();
/// axis.set_title("My plot: $y = x^2$");
/// ```
pub fn set_title(&mut self, title: &str) {
self.add_key(AxisKey::Title(String::from(title)));
pub fn set_title<S: Into<String>>(&mut self, title: S) {
self.add_key(AxisKey::Title(title.into()));
}
/// Set the label of the *x* axis. This can be valid LaTeX e.g. inline math.
///
Expand All @@ -133,8 +133,8 @@ impl Axis {
/// let mut axis = Axis::new();
/// axis.set_x_label("$x$~[m]");
/// ```
pub fn set_x_label(&mut self, label: &str) {
self.add_key(AxisKey::XLabel(String::from(label)));
pub fn set_x_label<S: Into<String>>(&mut self, label: S) {
self.add_key(AxisKey::XLabel(label.into()));
}
/// Set the label of the *y* axis. This can be valid LaTeX e.g. inline math.
///
Expand All @@ -146,8 +146,8 @@ impl Axis {
/// let mut axis = Axis::new();
/// axis.set_y_label("$y$~[m]");
/// ```
pub fn set_y_label(&mut self, label: &str) {
self.add_key(AxisKey::YLabel(String::from(label)));
pub fn set_y_label<S: Into<String>>(&mut self, label: S) {
self.add_key(AxisKey::YLabel(label.into()));
}
/// Add a key to control the appearance of the axis. This will overwrite
/// any previous mutually exclusive key.
Expand Down

0 comments on commit d05b626

Please sign in to comment.