is it possible to plot two lines on the same graph? I am using Panel on Jupyter. However, I only can plot two lines on two different graphs. I would like to have everything on the same graph to compare results while I am changing input values.
I do not care if I have to use Panel, Bokeh, Holoview, etc.
Best regards, VQ
import panel as pn
pn.extension()
import panel.widgets as pnw
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def mplplot(df, **kwargs):
fig = df.plot(title='Title - Convert temperature from degree Celsius to Kelvin')
fig.legend(["Temperature"]);
fig.set_xlabel("Celcius")
fig.set_ylabel("Kelvin")
fig= fig.get_figure()
plt.close(fig)
return fig
def Celsius_to_Kelvin(C=100, view_fn=mplplot):
C = np.arange(0,C, 1)
K = (C + 273.15)
df = pd.DataFrame(dict(y=K), index=C)
return view_fn(df, K=K, C=C)
def Celsius_to_Kelvin1(C=100, view_fn=mplplot):
C = np.arange(0,C, 1)
K = (C + 273.15)
df = pd.DataFrame(dict(y=K), index=C)
return view_fn(df, K=K, C=C)
C = pnw.FloatSlider(name='C', value=50, start=0, end=100)
C1 = pnw.FloatSlider(name='C1', value=40, start=0, end=100)
@pn.depends(C.param.value)
def Celsius_to_Kelvin_variables(C):
return Celsius_to_Kelvin(C)
@pn.depends(C1.param.value)
def Celsius_to_Kelvin_variables1(C1):
return Celsius_to_Kelvin1(C1)
widgets = pn.Column("<br>\n#### Variable configuration", C, C1)
Celsius_to_Kelvin_panel = pn.Row(Celsius_to_Kelvin_variables, Celsius_to_Kelvin_variables1, widgets)
Celsius_to_Kelvin_panel
