[−][src]Struct plotly::plot::Plot
Plot is a container for structs that implement the Trace trait. Optionally a Layout can
also be specified. Its function is to serialize Traces and the Layout in html format and
display and/or persist the resulting plot.
Examples
extern crate plotly; use plotly::common::Mode; use plotly::{Plot, Scatter}; fn line_and_scatter_plot() { let trace1 = Scatter::new(vec![1, 2, 3, 4], vec![10, 15, 13, 17]) .name("trace1") .mode(Mode::Markers); let trace2 = Scatter::new(vec![2, 3, 4, 5], vec![16, 5, 11, 9]) .name("trace2") .mode(Mode::Lines); let trace3 = Scatter::new(vec![1, 2, 3, 4], vec![12, 9, 15, 12]).name("trace3"); let mut plot = Plot::new(); plot.add_trace(trace1); plot.add_trace(trace2); plot.add_trace(trace3); plot.show(); } fn main() -> std::io::Result<()> { line_and_scatter_plot(); Ok(()) }
Methods
impl Plot[src]
pub fn new() -> Plot[src]
Create a new Plot.
pub fn add_trace(&mut self, trace: Box<dyn Trace>)[src]
Add a Trace to the Plot.
pub fn set_layout(&mut self, layout: Layout)[src]
Set the Layout to be used by Plot.
pub fn show(&self)[src]
Renders the contents of the Plot and displays them in the system default browser.
This will serialize the Traces and Layout in an html page which is saved in the temp
directory. For example on Linux it will generate a file plotly_<22 random characters>.html
in the /tmp directory.
pub fn show_png(&self, width: usize, height: usize)[src]
Renders the contents of the Plot, creates a png raster and displays it in the system default browser.
To save the resulting png right-click on the resulting image and select Save As....
pub fn show_jpeg(&self, width: usize, height: usize)[src]
Renders the contents of the Plot, creates a jpeg raster and displays it in the system default browser.
To save the resulting png right-click on the resulting image and select Save As....
pub fn to_html<P: AsRef<Path>>(&self, filename: P)[src]
Renders the contents of the Plot and displays it in the system default browser.
In contrast to Plot::show() this will save the resulting html in a user specified location
instead of the system temp directory.
Auto Trait Implementations
impl !RefUnwindSafe for Plot
impl !Send for Plot
impl !Sync for Plot
impl Unpin for Plot
impl !UnwindSafe for Plot
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,