Triangular patches in Plots


I am learning to use Plots.jl these days, to visualise output from FEM analysis.

One thing I would like to be able to do is provide 3 “nodes” (in 2D, in my case, but 3D is an obvious extension) and 3 values or colors, and get a triangle, colored by linear interpolation. My visualisation will require hundreds or thousands of such patches.

In Matlab, this type of functionality is provided by “patch()”.

Is there a way to do this in Plots? If not, do you know whether GR could do this?


This is not an answer to your questions but for large meshes I would recommend writing to VTK files using and open them in Paraview. It is an excellent tool to learn especially if you want to go over to 3d visualizations later.


May not exactly be the fastest or best option out there but check out VTKDataTypes and VTKDataIO. You can create your data structure using VTKDataTypes and then either visualize it directly using VTKDataIO or change it to a form that can be visualized with GLVisualize using the GLMesh function.


Hi guys,

thanks. I am aware of Paraview. For now, with 100 to 1000 patches, this would be swatting a fly with a sledgehammer.

But thank you for the tip about WriteVTK.jl, I take note.

Patches in Plot or GR, anyone?


And thank you Mohamed for the tip on VTKDataTypes!


No and no. Relevant issues:

As shown in the issues. PyPlot.jl can do it directly but Plots.jl doesn’t support it yet. If I ever understand how to add attributes in Plots.jl this would be the PR I’d work on.


OK, good to know that this is the situation for now. Thanks


Sounds great :slight_smile: