Best way to convert tricontourf to Plotly for very large datasets?

I have this simple working plot in matplotlib that I want to convert to Plotly:

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
import json


model = json.load(open('test_geometry.json'))
values = json.load(open('test_values.json'))

figure = plt.figure()
axis1 = figure.add_subplot(211)
axis2 = figure.add_subplot(212)

caxis1 = make_axes_locatable(axis1).append_axes("right")
caxis2 = make_axes_locatable(axis2).append_axes("right")

indices = np.array(model.get("indices")) - 1
nodes = np.asarray(model.get("nodes"))
x, y = nodes.T
elements = np.asarray(model.get("elements"))

model_values_a = np.array(values.get("values_a"))
model_values_b = np.array(values.get("values_b"))

model_a_plot = axis1.tricontourf(x, y, elements, model_values_a[indices])
model_b_plot = axis1.tricontourf(x, y, elements, model_values_b[indices])

figure.colorbar(model_a_plot, cax=caxis1)
figure.colorbar(model_b_plot, cax=caxis2)

plt.show()

This plot basically displays 2 different sets of temperature values mapped on the geometry of the same model, which is done with tricontourf. What would be the best way to achieve this with Plotly on the web?

Another issue here is that the length of the data set is around ~400k points, so SVG figures are out of the question. Is there any way to get the same functionality using WebGL figures?

1 Like

I am encountering the same situation: previous implementation in Matplotlib with tricontourf and now wanting to switch over to Plotly. Any ideas so far?

I’m also interested in seeing a Plotly version of tricontourf. Regular contour plots don’t give the same mesh control over the structure. The ability to mask specific elements/cells is also very useful.