Need help understanding how contour plots work in plotly

Hello everyone,

I try to convert a code matplotlib python into contour plots within the dash-plotly framework. However, I don’t really understand what is happening and how I can solve the issue I’m having.

For example, I get the following plot contour_1
with this code:

    # Plot
    fig, axes = plt.subplots(nrows=1)
    cmap = plt.get_cmap('jet')
    # add axis labels
    fig.text(0.5, 0.04, 'Vertical length in meters', ha='center', va='center', fontsize=10)
    fig.text(0.06, 0.5, 'Horizontal length in meters', ha='center', va='center', rotation='vertical', fontsize=10)

    cs = axes.contourf(Ev, Eh, Eq, levels=E_levels, cmap=cmap)
    # plot the [1, 3, 5] lx isolux lines
    cs1 = axes.contour(cs, levels=[E_levels[0]], norm=norm, colors='w', linestyles='-', linewidths=0.5)
    cs3 = axes.contour(cs, levels=[E_levels[1]], norm=norm, colors='w', linestyles='-', linewidths=0.5)
    cs5 = axes.contour(cs, levels=[E_levels[2]], norm=norm, colors='w', linestyles='-', linewidths=0.5)


    axes.set_ylim([y_min, y_max])
    axes.set_xlim([0, x_max])

    axes.plot([0, x_max], [1.5,1.5], color='k', linewidth=1.5)
    axes.plot([0, x_max], [-1.5,-1.5], color='k', linestyle='--', linewidth=1.5)
    axes.plot([0, x_max], [-4.5,-4.5], color='k', linewidth=1.5)
    cbar = fig.colorbar(cs, ax=axes)
    cbar.ax.set_title('E in Lux', fontsize=9)
    plt.gca().invert_yaxis()

where Ev, Eh, and Eq are 2D arrays with the shape of (2400,7300) or something like that !

When I try to use the density_contour function in plotly I get the following plot contour_2

When zooming in I get this contour_3
which is clearly far from the version Matplotlib is doing.
I used the following code

    Eq = Eq[~np.all(np.around(Eq) == 0, axis=1)]
    Ev = Ev[:Eq.shape[0]]
    Eh = Eh[:Eq.shape[0]]

    df = pd.DataFrame(data={'Eq': Eq.flatten(), 'Ev': Ev.flatten(), 'Eh': Eh.flatten()})
    df['Eq'].replace(0, np.NaN)
    fig = px.density_contour(df, x="Ev", y="Eh", )
    fig.update_traces(contours_coloring="fill", contours_showlabels = True)

Is it possible to achieve the same behaviour or in this case plot with plotly.py?
Thanks in advance for your help.