Having trouble with an Echart pane using pyecharts
. Specifically, it is remembering a prior state of the plot, and I don’t know how to disable it.
Consider this simple multiline example. I can add new lines to the plot with a widget, but I cannot remove lines from the plot that were added from a previous render.
import numpy as np
import panel as pn
from pyecharts.charts import Line
from pyecharts import options as opts
x = np.linspace(0,10,9)
y1 = np.cos(x)
y2 = np.sin(x)
y3 = np.cosh(x) # Much larger y_lim
y = [y1, y2, y3]
count = pn.widgets.Select(options=[1,2,3], value=1, name='Number of Lines to display')
@pn.depends(count)
def plot_multiline(count):
plot = Line().add_xaxis(xaxis_data=list(x))
for i in range(count):
plot.add_yaxis(series_name=str(i+1), y_axis=list(y[i]))
return pn.pane.ECharts(plot)
pn.Column(count, plot_multiline)