What is this new feature?
Add plotly
as supported library.
Why should this feature be added?
Additional data visualization package to matplotlib
. Give users more options with supported libraries. Potentially allows for use of interactive plots.
Who will use this new feature?
weichen
November 17, 2022, 3:36pm
2
Hi @tommy-mikalson1 .
Your feature request has been granted as it meets our guidelines for adding libraries:
Plotly will add functionality that is not supported by existing libraries. Eg. interactive plots
Plotly is popular, well-documented, and widely used
Here is an example on how to use Plotly in MecSimCalc:
Code
import plotly.express as px
import pandas as pd
def main(inputs):
# Create Plotly figure
df = pd.DataFrame(dict(
x=[1, 3, 2, 4],
y=[1, 2, 3, 4]
))
fig = px.line(df, x="x", y="y", title="Plotly Line Chart")
# Convert figure to html code
plotly_html = fig.to_html(full_html=False, include_plotlyjs=True)
return {"plot": plotly_html}
Output
{{ outputs.plot }}