Hello there. Following are contour plots corresponding to the same data. In the first case, the plot is directly output by Matplolib, and in the second case, it is the plot published by Streamlit. When the plot is transferred to Streamlit, some blemishes appear along with degradation of quality.
For more complex plots, these blemishes would become problematic, so I was wondering if there are ways to prevent these blemishes and maintain the quality.
Following is my code:
import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.colors as colors mygreens = colors.LinearSegmentedColormap.from_list('mygreens', ['#000000', '#00FF00']) def f(r): return ((r**2 - 1)**2) n1,n2 = 50, 50 x11 =  y11 =  z11 =  for i in range(n1): tmpx= tmpy= tmpz= for j in range(n2): tmpx.append(r11[i] * np.cos(phi11[j])) tmpy.append(r11[i] * np.sin(phi11[j])) tmpz.append(f(r11[i])) x11.append(tmpx) y11.append(tmpy) z11.append(tmpz) fig1 = plt.figure() ax1 = fig1.add_subplot() ax1.set_title('The output of st.pyplot()') surf = ax1.contourf(np.array(x11), np.array(y11), np.array(z11), 200, cmap=mygreens, vmin=np.amin(z11), vmax=np.amax(z11)) fig1.colorbar(surf) st.pyplot(fig1)