Hello,
I try to convert an existing code in python to make contour plot because it’s interesting to interact with data on website with Plot.js
Because what we want to see is not linear, I defined levels used by Python to show corresponding lines in contour plot.
The python code :
import numpy as np from matplotlib import pyplot import mpl_toolkits.axes_grid1 as ag x = np.array(...) y = np.array(...) z = np.array(...) levels = np.array([0.,0.00005,0.0001,0.0002,0.00033,0.00076,0.001,0.003]) fig = pyplot.figure(num=1,figsize=(12, 8),dpi=300,facecolor='w',edgecolor='k') ax = fig.add_subplot(111, aspect="equal") pltcf = ax.contourf(x, y, z, levels=levels, cmap="gnuplot2_r", extend="both", origin='lower') pltct = ax.contour(x, y, z, levels, colors='k', linewidths=0.5, origin='lower') divider = ag.make_axes_locatable(ax) cax = divider.append_axes("right", size="5%", pad=0.1) fig.colorbar(pltcf, cax=cax, orientation='vertical', format='%.1g') fig.show()
And the result with Python :
Is it possible to do the same thing with Plot.js ? Actually, I saw variables in contours object to define start, end and step, but nothing with personal values.
The result with Plot.js (same datas) : https://codepen.io/nl78/pen/NYxoyp
Thanks in advance for your help.