- matplotlib

Line Chart





import matplotlib.pyplot as plt def my_function(*args, **kwargs): text = Element('test-input').element.value text_2 = Element('test-input-2').element.value text_3 = Element('test-input-3').element.value text_4 = Element('test-input-4').element.value text_5 = Element('test-input-5').element.value input_x = text list_x = input_x.split() map_object_x = map(int, list_x) listofint_x = list(map_object_x) input_y = text_2 list_y = input_y.split() map_object_y = map(int, list_y) listofint_y = list(map_object_y) Element('test-output').element.innerText = listofint_x Element('test-output-1').element.innerText = listofint_y Element('test-output-2').element.innerText = text_3 Element('test-output-3').element.innerText = text_4 Element('test-output-4').element.innerText = text_5 fig,ax = plt.subplots() title = text_3 plt.title(title) xlabel = text_4 plt.xlabel(xlabel) ylabel = text_5 plt.ylabel(ylabel) plt.plot(listofint_x, listofint_y, linestyle="-", linewidth="2", markersize="16", marker=".") ax.set_xticks(listofint_x) fig buffer = io.BytesIO() plt.savefig(buffer, format='png') buffer.seek(0) image_data = buffer.getvalue() base64_image = base64.b64encode(image_data).decode('utf-8') image_url = f'data:image/png;base64,{base64_image}' Element('quad').element.innerText = image_url