MCPcopy Create free account
hub / github.com/alceal/plotlars / plot

Method plot

crates/plotlars-plotly/src/subplot_grid/mod.rs:126–146  ·  view source on GitHub ↗

Display the subplot grid in the default browser or Jupyter notebook.

(&self)

Source from the content-addressed store, hash-verified

124impl SubplotGrid {
125 /// Display the subplot grid in the default browser or Jupyter notebook.
126 pub fn plot(&self) {
127 use std::env;
128
129 match env::var("EVCXR_IS_RUNTIME") {
130 Ok(_) => {
131 let mut plotly_plot = plotly::Plot::new();
132 plotly_plot.set_layout(self.layout.clone());
133 for trace in self.traces.clone() {
134 plotly_plot.add_trace(trace);
135 }
136 plotly_plot.evcxr_display();
137 }
138 _ => {
139 let html = self.to_html();
140 let dir = std::env::temp_dir();
141 let path = dir.join("plotlars_subplot_grid.html");
142 std::fs::write(&path, &html).expect("Failed to write HTML file");
143 crate::render::open_html_file(&path);
144 }
145 }
146 }
147
148 /// Write the subplot grid to an HTML file.
149 pub fn write_html(&self, path: impl Into<String>) {

Callers 15

mainFunction · 0.45
mainFunction · 0.45
regular_grid_exampleFunction · 0.45
irregular_grid_exampleFunction · 0.45
mixed_grid_exampleFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 2

open_html_fileFunction · 0.85
to_htmlMethod · 0.45

Tested by

no test coverage detected