[−][src]Struct gnuplot::Figure
A figure that may contain multiple axes
Methods
impl Figure
[src]
pub fn new() -> Figure
[src]
Creates a new figure
pub fn set_terminal<'l>(
&'l mut self,
terminal: &str,
output_file: &str
) -> &'l mut Figure
[src]
&'l mut self,
terminal: &str,
output_file: &str
) -> &'l mut Figure
Sets the terminal for gnuplot to use, as well as the file to output the figure to. Terminals that spawn a GUI don't need an output file, so pass an empty string for those.
There are a quite a number of terminals, here are some commonly used ones:
- wxt - Interactive GUI
- pdfcairo - Saves the figure as a PDF file
- epscairo - Saves the figure as a EPS file
- pngcairo - Saves the figure as a PNG file
- svg - Saves the figure as a SVG file
- canvas - Saves the figure as an HTML5 canvas element
As of now you can hack the canvas size in by using "pngcairo size 600, 400" for terminal
.
Be prepared for that kludge to go away, though.
pub fn set_enhanced_text<'l>(&'l mut self, enhanced: bool) -> &'l mut Figure
[src]
Set or unset text enhancements
pub fn set_post_commands<'l>(
&'l mut self,
post_commands: &str
) -> &'l mut Figure
[src]
&'l mut self,
post_commands: &str
) -> &'l mut Figure
Sets commands to send to gnuplot after all the plotting commands.
pub fn set_pre_commands<'l>(&'l mut self, pre_commands: &str) -> &'l mut Figure
[src]
Sets commands to send to gnuplot before any plotting commands.
pub fn set_gnuplot_version(
&mut self,
version: Option<GnuplotVersion>
) -> &mut Figure
[src]
&mut self,
version: Option<GnuplotVersion>
) -> &mut Figure
Sets the Gnuplot version.
By default, we assume version 5.0. If show
is called, it will attempt
to parse Gnuplot's version string as well.
pub fn get_gnuplot_version(&self) -> GnuplotVersion
[src]
Returns the Gnuplot version.
pub fn axes2d(&mut self) -> &mut Axes2D
[src]
Creates a set of 2D axes
pub fn axes3d(&mut self) -> &mut Axes3D
[src]
Creates a set of 3D axes
pub fn new_page(&mut self) -> &mut Figure
[src]
Creates a new page.
Some terminals support multiple pages or frames, e.g. to create an
animation. Call this function between sets of plots to indicate that a
new page should be started. Note that this is implicit before any
axes2d
/axes3d
calls, so make sure to call this only between pages
(not once before every page).
pub fn show(&mut self) -> Result<&mut Figure, GnuplotInitError>
[src]
Launch a gnuplot process, if it hasn't been spawned already by a call to this function, and display the figure on it.
pub fn save_to_png(
&mut self,
file_path: &str,
width_px: u32,
height_px: u32
) -> Result<(), GnuplotInitError>
[src]
&mut self,
file_path: &str,
width_px: u32,
height_px: u32
) -> Result<(), GnuplotInitError>
Save the figure to a png file.
Arguments
file_path
- Path to the output file (png)width_px
- output image width (in pixels)height_px
- output image height (in pixels)
pub fn save_to_svg(
&mut self,
file_path: &str,
width_px: u32,
height_px: u32
) -> Result<(), GnuplotInitError>
[src]
&mut self,
file_path: &str,
width_px: u32,
height_px: u32
) -> Result<(), GnuplotInitError>
Save the figure to a svg file.
Arguments
file_path
- Path to the output file (svg)width_px
- output image width (in pixels)height_px
- output image height (in pixels)
pub fn save_to_pdf(
&mut self,
file_path: &str,
width_in: u32,
height_in: u32
) -> Result<(), GnuplotInitError>
[src]
&mut self,
file_path: &str,
width_in: u32,
height_in: u32
) -> Result<(), GnuplotInitError>
Save the figure to a pdf file.
Arguments
file_path
- Path to the output file (pdf)width_in
- output image width (in inches)height_in
- output image height (in inches)
pub fn save_to_eps(
&mut self,
file_path: &str,
width_in: u32,
height_in: u32
) -> Result<(), GnuplotInitError>
[src]
&mut self,
file_path: &str,
width_in: u32,
height_in: u32
) -> Result<(), GnuplotInitError>
Save the figure to an eps file
Arguments
file_path
- Path to the output file (eps)width_in
- output image width (in inches)height_in
- output image height (in inches)
pub fn save_to_canvas(
&mut self,
file_path: &str,
width_px: u32,
height_px: u32
) -> Result<(), GnuplotInitError>
[src]
&mut self,
file_path: &str,
width_px: u32,
height_px: u32
) -> Result<(), GnuplotInitError>
Save the figure to a HTML5 canvas file
Arguments
file_path
- Path to the output file (canvas)width_px
- output image width (in pixels)height_px
- output image height (in pixels)
pub fn close(&mut self) -> &mut Figure
[src]
Closes the gnuplot process.
This can be useful if you're your plot output is a file and you need to that it was written.
pub fn clear_axes(&mut self) -> &mut Figure
[src]
Clears all axes on this figure.
pub fn echo<'l, T: Writer>(&'l self, writer: &mut T) -> &'l Figure
[src]
Echo the commands that if piped to a gnuplot process would display the figure
Arguments
writer
- A function pointer that will be called multiple times with the command text and data
pub fn echo_to_file<'l>(&'l self, filename: &str) -> &'l Figure
[src]
Save to a file the the commands that if piped to a gnuplot process would display the figure
Arguments
filename
- Name of the file
Auto Trait Implementations
impl Send for Figure
impl Unpin for Figure
impl !Sync for Figure
impl UnwindSafe for Figure
impl !RefUnwindSafe for Figure
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,