gnuplot_wrapper/commands/
set.rs

1use crate::{command::Command, script::Script};
2
3/// http://gnuplot.info/docs_5.5/loc10058.html
4pub struct Set {
5    value: String,
6}
7
8impl Set {
9    pub fn new(str: &str) -> Self {
10        return Set {
11            value: str.to_string(),
12        };
13    }
14}
15
16impl Command for Set {
17    fn to_raw(&self) -> String {
18        return format!("set {}", self.value);
19    }
20}
21
22impl Script {
23    pub fn set(&mut self, str: &str) {
24        self.add_command(Set::new(str));
25    }
26
27    pub fn set_grid(&mut self) {
28        self.add_command(Set::new("grid"));
29    }
30    
31    pub fn set_logscale(&mut self, axes: &str) {
32        self.add_command(Set::new(&format!("logscale {}", axes)));
33    }
34}