From 42065b3f48368a93733816f0de25c53b70c75f4b Mon Sep 17 00:00:00 2001 From: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com> Date: Fri, 6 Feb 2026 18:25:39 +0100 Subject: [PATCH] make Plot::default() behave like Plot::new() Closes #380 Signed-off-by: Andrei Gherghescu <8067229+andrei-ng@users.noreply.github.com> --- plotly/src/plot.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plotly/src/plot.rs b/plotly/src/plot.rs index d16d9284..7741d3c7 100644 --- a/plotly/src/plot.rs +++ b/plotly/src/plot.rs @@ -156,7 +156,7 @@ impl Traces { /// Ok(()) /// } /// ``` -#[derive(Default, Serialize, Clone)] +#[derive(Serialize, Clone)] pub struct Plot { #[serde(rename = "data")] traces: Traces, @@ -169,13 +169,21 @@ pub struct Plot { js_scripts: String, } +impl Default for Plot { + fn default() -> Self { + Self::new() + } +} + impl Plot { /// Create a new `Plot`. pub fn new() -> Plot { Plot { traces: Traces::new(), + layout: Layout::default(), + configuration: Configuration::default(), + frames: None, js_scripts: Self::js_scripts(), - ..Default::default() } }