Skip to content

Commit

Permalink
Make set ticks backward compatible with prev Matplotlib version (Rock…
Browse files Browse the repository at this point in the history
…y Linux)
  • Loading branch information
cpmech committed Sep 3, 2024
1 parent 3bad8c3 commit ab61f7d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,11 @@ impl Plot {
assert_eq!(ticks.vec_size(), labels.len());
vector_to_array(&mut self.buffer, "tx", ticks);
vector_to_strings(&mut self.buffer, "lx", labels);
write!(&mut self.buffer, "plt.gca().set_xticks(tx,labels=lx)\n").unwrap();
write!(
&mut self.buffer,
"plt.gca().set_xticks(tx)\nplt.gca().set_xticklabels(lx)\n"
)
.unwrap();
self
}

Expand All @@ -724,7 +728,11 @@ impl Plot {
assert_eq!(ticks.vec_size(), labels.len());
vector_to_array(&mut self.buffer, "ty", ticks);
vector_to_strings(&mut self.buffer, "ly", labels);
write!(&mut self.buffer, "plt.gca().set_yticks(ty,labels=ly)\n").unwrap();
write!(
&mut self.buffer,
"plt.gca().set_yticks(ty)\nplt.gca().set_yticklabels(ly)\n"
)
.unwrap();
self
}

Expand Down

0 comments on commit ab61f7d

Please sign in to comment.