From 054986d4bc47600455b94b8c642a6dc1773d2292 Mon Sep 17 00:00:00 2001 From: Falko Schindler Date: Thu, 27 Jun 2024 09:42:51 +0200 Subject: [PATCH] let SVG of `ui.pyplot` fill its container (#3289) --- nicegui/elements/pyplot.py | 1 + nicegui/static/nicegui.css | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/nicegui/elements/pyplot.py b/nicegui/elements/pyplot.py index 08c2f9042..7b8e3db31 100644 --- a/nicegui/elements/pyplot.py +++ b/nicegui/elements/pyplot.py @@ -47,6 +47,7 @@ def __init__(self, *, close: bool = True, **kwargs: Any) -> None: raise ImportError('Matplotlib is not installed. Please run "pip install matplotlib".') super().__init__('div') + self._classes.append('nicegui-pyplot') self.close = close self.fig = plt.figure(**kwargs) self._convert_to_html() diff --git a/nicegui/static/nicegui.css b/nicegui/static/nicegui.css index 5af46728f..c94523515 100644 --- a/nicegui/static/nicegui.css +++ b/nicegui/static/nicegui.css @@ -246,6 +246,10 @@ h6.q-timeline__title { .nicegui-code .codehilite { padding: 0 0.5rem; } +.nicegui-pyplot > svg { + width: 100%; + height: 100%; +} /* CodeMirror */ .nicegui-codemirror .cm-editor.cm-focused {