• Home
  • Raw
  • Download

Lines Matching +full:set +full:- +full:version

10 //! - Simple "curves" (based on [`simple.dem`](http://gnuplot.sourceforge.net/demo/simple.html))
20 //! # if let Err(_) = criterion_plot::version() {
23 //! let ref xs = linspace::<f64>(-10., 10., 51).collect::<Vec<_>>();
28 //! # .set(Font("Helvetica"))
29 //! # .set(FontSize(12.))
30 //! # .set(Output(Path::new("target/doc/criterion_plot/curve.svg")))
31 //! # .set(Size(1280, 720))
33 //! k.set(Boxed::Yes)
34 //! .set(Position::Inside(Vertical::Top, Horizontal::Left))
41 //! lp.set(Color::DarkViolet)
42 //! .set(Label("sin(x)"))
43 //! .set(LineType::Dash)
44 //! .set(PointSize(1.5))
45 //! .set(PointType::Circle)
52 //! s.set(Color::Rgb(0, 158, 115))
53 //! .set(Label("atan(x)"))
54 //! .set(LineWidth(2.))
61 //! i.set(Color::Rgb(86, 180, 233))
62 //! .set(Label("cos(atan(x))"))
71 //! - error bars (based on
72 //! [Julia plotting tutorial](https://plot.ly/julia/error-bars/#Colored-and-Styled-Error-Bars))
85 //! fn sinc(mut x: f64) -> f64 {
94 //! # if let Err(_) = criterion_plot::version() {
97 //! let ref xs_ = linspace::<f64>(-4., 4., 101).collect::<Vec<_>>();
101 //! let xs = linspace::<f64>(-4., 4., 13).skip(1).take(11);
102 //! let ys = xs.map(|x| sinc(x) + 0.05 * rng.gen::<f64>() - 0.025).collect::<Vec<_>>();
103 //! let y_low = ys.iter().map(|&y| y - 0.025 - 0.075 * rng.gen::<f64>()).collect::<Vec<_>>();
105 //! let xs = linspace::<f64>(-4., 4., 13).skip(1).take(11);
106 //! let xs = xs.map(|x| x + 0.2 * rng.gen::<f64>() - 0.1);
111 //! # .set(Font("Helvetica"))
112 //! # .set(FontSize(12.))
113 //! # .set(Output(Path::new("target/doc/criterion_plot/error_bar.svg")))
114 //! # .set(Size(1280, 720))
116 //! a.set(TicLabels {
117 //! labels: &["-π", "0", "π"],
118 //! positions: &[-PI, 0., PI],
122 //! |k| k.set(Position::Outside(Vertical::Top, Horizontal::Right)))
128 //! l.set(Color::Rgb(0, 158, 115))
129 //! .set(Label("sinc(x)"))
130 //! .set(LineWidth(2.))
139 //! eb.set(Color::DarkViolet)
140 //! .set(LineWidth(2.))
141 //! .set(PointType::FilledCircle)
142 //! .set(Label("measured"))
151 //! - Candlesticks (based on
162 //! # if let Err(_) = criterion_plot::version() {
171 //! let wh = bh.iter().map(|&y| y + (10. - y) * rng.gen::<f64>()).collect::<Vec<_>>();
173 //! let m = bm.iter().zip(bh.iter()).map(|(&l, &h)| (h - l) * rng.gen::<f64>() + l)
179 //! # .set(Font("Helvetica"))
180 //! # .set(FontSize(12.))
181 //! # .set(Output(Path::new("target/doc/criterion_plot/candlesticks.svg")))
182 //! # .set(Size(1280, 720))
183 //! .set(BoxWidth(0.2))
184 //! .configure(Axis::BottomX, |a| a.set(Range::Limits(0., 11.)))
193 //! cs.set(Color::Rgb(86, 180, 233))
194 //! .set(Label("Quartiles"))
195 //! .set(LineWidth(2.))
206 //! cs.set(Color::Black)
207 //! .set(LineWidth(2.))
216 //! - Multiaxis (based on [`multiaxis.dem`](http://gnuplot.sourceforge.net/demo/multiaxis.html))
229 //! fn tf(x: f64) -> Complex<f64> {
233 //! # if let Err(_) = criterion_plot::version() {
244 //! # set(Font("Helvetica")).
245 //! # set(FontSize(12.)).
246 //! # set(Output(Path::new("target/doc/criterion_plot/multiaxis.svg"))).
247 //! # set(Size(1280, 720)).
248 //! set(Title("Frequency response")).
252 //! set(Label("Angular frequency (rad/s)")).
253 //! set(Range::Limits(start, end)).
254 //! set(Scale::Logarithmic)).
256 //! set(Label("Gain")).
257 //! set(Scale::Logarithmic)).
261 //! set(Label("Phase shift (°)"))).
263 //! set(Position::Inside(Vertical::Top, Horizontal::Center)).
264 //! set(Title(" "))).
269 //! set(Color::DarkViolet).
270 //! set(Label("Magnitude")).
271 //! set(LineWidth(2.))).
276 //! set(Axes::BottomXRightY).
277 //! set(Color::Rgb(0, 158, 115)).
278 //! set(Label("Phase")).
279 //! set(LineWidth(2.))).
287 //! - Filled curves (based on
301 //! # if let Err(_) = criterion_plot::version() {
304 //! let (start, end) = (-5., 5.);
308 //! fn gaussian(x: f64, mu: f64, sigma: f64) -> f64 {
309 //! 1. / (((x - mu).powi(2) / 2. / sigma.powi(2)).exp() * sigma * (2. * PI).sqrt())
315 //! # .set(Font("Helvetica"))
316 //! # .set(FontSize(12.))
317 //! # .set(Output(Path::new("target/doc/criterion_plot/filled_curve.svg")))
318 //! # .set(Size(1280, 720))
319 //! .set(Title("Transparent filled curve"))
320 //! .configure(Axis::BottomX, |a| a.set(Range::Limits(start, end)))
321 //! .configure(Axis::LeftY, |a| a.set(Range::Limits(0., 1.)))
323 //! k.set(Justification::Left)
324 //! .set(Order::SampleText)
325 //! .set(Position::Inside(Vertical::Top, Horizontal::Left))
326 //! .set(Title("Gaussian Distribution"))
334 //! fc.set(Color::ForestGreen)
335 //! .set(Label("μ = 0.5 σ = 0.5"))
343 //! fc.set(Color::Gold)
344 //! .set(Label("μ = 2.0 σ = 1.0"))
345 //! .set(Opacity(0.5))
349 //! y1: xs.iter().map(|&x| gaussian(x, -1.0, 2.0)),
353 //! fc.set(Color::Red)
354 //! .set(Label("μ = -1.0 σ = 2.0"))
355 //! .set(Opacity(0.5))
368 // https://github.com/Manishearth/rust-clippy/issues/761
369 #![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
371 #![cfg_attr(feature = "cargo-clippy", allow(clippy::doc_markdown))]
372 #![cfg_attr(feature = "cargo-clippy", allow(clippy::many_single_char_names))]
388 use crate::traits::{Configure, Set};
424 pub fn new() -> Figure { in new()
444 fn script(&self) -> Vec<u8> { in script()
448 "set output '{}'\n", in script()
453 s.push_str(&format!("set boxwidth {}\n", width)) in script()
457 s.push_str(&format!("set title '{}'\n", title)) in script()
473 s.push_str(&format!("set style fill transparent solid {}\n", alpha)) in script()
476 s.push_str(&format!("set terminal {} dashed", self.terminal.display())); in script()
509 "'-' binary endian=little record={} format='%float64' using ", in script()
543 pub fn draw(&mut self) -> io::Result<Child> { in draw()
556 pub fn dump<W>(&mut self, sink: &mut W) -> io::Result<&mut Figure> in dump()
565 pub fn save(&self, path: &Path) -> io::Result<&Figure> { in save()
577 fn configure<F>(&mut self, axis: Axis, configure: F) -> &mut Figure in configure()
579 F: FnOnce(&mut axis::Properties) -> &mut axis::Properties, in configure()
596 fn configure<F>(&mut self, _: Key, configure: F) -> &mut Figure in configure()
598 F: FnOnce(&mut key::Properties) -> &mut key::Properties, in configure()
611 impl Set<BoxWidth> for Figure {
619 fn set(&mut self, width: BoxWidth) -> &mut Figure { in set() method
629 impl Set<Font> for Figure {
631 fn set(&mut self, font: Font) -> &mut Figure { in set() method
637 impl Set<FontSize> for Figure {
642 /// Panics if `size` is a non-positive value
643 fn set(&mut self, size: FontSize) -> &mut Figure { in set() method
653 impl Set<Output> for Figure {
657 fn set(&mut self, output: Output) -> &mut Figure { in set() method
663 impl Set<Size> for Figure {
665 fn set(&mut self, size: Size) -> &mut Figure { in set() method
671 impl Set<Terminal> for Figure {
674 /// **Note** By default, the terminal is set to `Svg`
675 fn set(&mut self, terminal: Terminal) -> &mut Figure { in set() method
681 impl Set<Title> for Figure {
683 fn set(&mut self, title: Title) -> &mut Figure { in set() method
690 fn default() -> Self { in default()
695 /// Box width for box-related plots: bars, candlesticks, etc
733 /// Set the limits of the axis
776 fn next(self) -> Option<Axis> { in next()
818 fn next(self) -> Option<Grid> { in next()
876 /// Not public version of `std::default::Default`, used to not leak default constructors into the
880 fn default() -> Self; in default()
886 fn display(&self) -> S; in display()
892 fn default(s: S) -> Self; in default()
898 fn default(s: S) -> Self; in default()
904 fn script(&self) -> String; in script()
914 fn new<S>(data: Matrix, script: &S) -> Plot in new()
924 fn data(&self) -> &Matrix { in data()
928 fn script(&self) -> &str { in script()
933 /// Possible errors when parsing gnuplot's version string
940 /// The `gnuplot` command returned invalid utf-8
946 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { in fmt()
948 VersionError::Exec(err) => write!(f, "`gnuplot --version` failed: {}", err), in fmt()
950 write!(f, "`gnuplot --version` failed with error message:\n{}", msg) in fmt()
952 VersionError::OutputError => write!(f, "`gnuplot --version` returned invalid utf-8"), in fmt()
955 "`gnuplot --version` returned an unparseable version string: {}", in fmt()
962 fn description(&self) -> &str { in description()
971 fn cause(&self) -> Option<&dyn ::std::error::Error> { in cause()
979 /// Structure representing a gnuplot version number.
980 pub struct Version { struct
981 /// The major version number
983 /// The minor version number
989 /// Returns `gnuplot` version
990 pub fn version() -> Result<Version, VersionError> { in version() argument
992 .arg("--version") in version()
1006 fn parse_version(version_str: &str) -> Result<Version, Option<ParseIntError>> { in parse_version() argument
1008 let mut version = words.next().ok_or(None)?.split('.'); in parse_version() localVariable
1009 let major = version.next().ok_or(None)?.parse()?; in parse_version()
1010 let minor = version.next().ok_or(None)?.parse()?; in parse_version()
1013 Ok(Version { in parse_version()
1020 fn scale_factor(map: &map::axis::Map<axis::Properties>, axes: Axes) -> (f64, f64) { in scale_factor()
1044 // XXX :-1: to intra-crate privacy rules
1048 fn scale_factor(&self) -> f64; in scale_factor()
1054 fn version() { in version() function
1055 if let Ok(version) = super::version() { in version()
1056 assert!(version.major >= 4); in version()
1065 let version = super::parse_version(&string).unwrap(); in test_parse_version_on_valid_string() localVariable
1066 assert_eq!(5, version.major); in test_parse_version_on_valid_string()
1067 assert_eq!(0, version.minor); in test_parse_version_on_valid_string()
1068 assert_eq!("7", &version.patch); in test_parse_version_on_valid_string()
1074 let version = super::parse_version(&string).unwrap(); in test_parse_gentoo_version() localVariable
1075 assert_eq!(5, version.major); in test_parse_gentoo_version()
1076 assert_eq!(2, version.minor); in test_parse_gentoo_version()
1077 assert_eq!("5a", &version.patch); in test_parse_gentoo_version()