Skip to content
Snippets Groups Projects
Verified Commit 03ae64f3 authored by Ruben van Dijk's avatar Ruben van Dijk
Browse files

Convert to plotly.

parent 8ed5f806
Branches
No related tags found
No related merge requests found
Pipeline #13356 passed
import mpld3
import pandas as pd
import matplotlib.pyplot as plt
from mpld3 import plugins
import plotly.tools as tls
#"off":"dicht", 'on':"open"
df = pd.read_csv(r"input/input.csv")
......@@ -31,8 +30,7 @@ co2.plot(figsize=(9, 4), ax=axs[0], ylabel='Co2', xlabel='')
raam.astype(float).plot(figsize=(9, 4), ax=axs[1],
ylabel='Raam Dicht', drawstyle='steps-post', xlabel="")
plugins.connect(fig, plugins.MousePosition())
html_str = mpld3.fig_to_html(fig)
Html_file = open("output/all.html", "w")
Html_file.write(html_str)
Html_file.close()
plotly_fig = tls.mpl_to_plotly(fig)
plotly_fig.data[1].line.shape = "hv" # fix raam dicht steps
plotly_fig.data[1].xaxis = plotly_fig.data[0].xaxis #fix zoom
plotly_fig.write_html("output/all.html")
......@@ -50,20 +50,6 @@ ufo = ["fs (>=2.2.0,<3)"]
unicode = ["unicodedata2 (>=15.1.0)"]
woff = ["zopfli (>=0.1.4)", "brotlicffi (>=0.8.0)", "brotli (>=1.0.1)"]
[[package]]
name = "jinja2"
version = "3.1.4"
description = "A very fast and expressive template engine."
category = "main"
optional = false
python-versions = ">=3.7"
[package.dependencies]
MarkupSafe = ">=2.0"
[package.extras]
i18n = ["Babel (>=2.7)"]
[[package]]
name = "kiwisolver"
version = "1.4.5"
......@@ -72,14 +58,6 @@ category = "main"
optional = false
python-versions = ">=3.7"
[[package]]
name = "markupsafe"
version = "2.1.5"
description = "Safely add untrusted strings to HTML/XML markup."
category = "main"
optional = false
python-versions = ">=3.7"
[[package]]
name = "matplotlib"
version = "3.8.4"
......@@ -99,18 +77,6 @@ pillow = ">=8"
pyparsing = ">=2.3.1"
python-dateutil = ">=2.7"
[[package]]
name = "mpld3"
version = "0.5.10"
description = "D3 Viewer for Matplotlib"
category = "main"
optional = false
python-versions = "*"
[package.dependencies]
jinja2 = "*"
matplotlib = "*"
[[package]]
name = "numpy"
version = "1.26.4"
......@@ -186,6 +152,18 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa
typing = ["typing-extensions"]
xmp = ["defusedxml"]
[[package]]
name = "plotly"
version = "5.22.0"
description = "An open-source, interactive data visualization library for Python"
category = "main"
optional = false
python-versions = ">=3.8"
[package.dependencies]
packaging = "*"
tenacity = ">=6.2.0"
[[package]]
name = "pyparsing"
version = "3.1.2"
......@@ -224,6 +202,18 @@ category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "tenacity"
version = "8.3.0"
description = "Retry code until it succeeds"
category = "main"
optional = false
python-versions = ">=3.8"
[package.extras]
doc = ["reno", "sphinx"]
test = ["pytest", "tornado (>=4.5)", "typeguard"]
[[package]]
name = "tzdata"
version = "2024.1"
......@@ -235,23 +225,22 @@ python-versions = ">=2"
[metadata]
lock-version = "1.1"
python-versions = "^3.10"
content-hash = "3a725fc91fadf54e5a40d73173fe3412387e531beece90b0ab8966754fff7fa8"
content-hash = "152b3c2534c606794320bd45007852a27a0cde563982c9153e1d2882b72afea0"
[metadata.files]
contourpy = []
cycler = []
fonttools = []
jinja2 = []
kiwisolver = []
markupsafe = []
matplotlib = []
mpld3 = []
numpy = []
packaging = []
pandas = []
pillow = []
plotly = []
pyparsing = []
python-dateutil = []
pytz = []
six = []
tenacity = []
tzdata = []
......@@ -8,7 +8,7 @@ authors = ["Ruben <co2project@rubend.nl>", "Berinda"]
python = "^3.10"
matplotlib = "^3.8.4"
pandas = "^2.2.2"
mpld3 = "^0.5.10"
plotly = "^5.22.0"
[tool.poetry.dev-dependencies]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment