Hi! I’ve encountered an issue when visualizing functions with polynomial order greater than 2 in Paraview. While the surface visualization (shown in the attached images using “Warp By Scalar”) works correctly for both 2nd and 3rd order functions, the “Plot Over Line” filter produces broken plots for functions with degree greater than two. This behavior occurs with both VTKFile and VTXWriter outputs.
Here’s a minimal working example that demonstrates the problem:
import dolfinx
from mpi4py import MPI
# Create mesh
mesh = dolfinx.mesh.create_unit_square(MPI.COMM_WORLD, 4, 4, dolfinx.mesh.CellType.quadrilateral)
# Define functionspace and function with order 3
V = dolfinx.fem.functionspace(mesh, ("Lagrange", 3))
u = dolfinx.fem.Function(V)
# Interpolate cubic function
u.interpolate(lambda x: x[0] ** 3 * x[1] ** 3)
# Export using VTX
bp_writer_u = dolfinx.io.VTXWriter(mesh.comm, "results/u.bp", [u], engine="BP4")
bp_writer_u.write(0)
# Export using VTK
vtk_writer_u = dolfinx.io.VTKFile(mesh.comm, "results/u.pvd", "w")
vtk_writer_u.write_mesh(mesh, 0.0)
vtk_writer_u.write_function(u, 0.0)
When visualizing the results in Paraview:
- The surface plot using “Warp By Scalar” looks reasonable
- However, when plotting along the diagonal line from (0,0) to (1,1) using the “Plot Over Line” filter, the result shows a dotted, discontinuous representation which is not the exact cubic function that was interpolated
- The same setup with 2nd order elements produces smooth, continuous plots along this diagonal
With order=2:
With order:3:
Is this a known limitation of the VTK/VTX export, or am I missing something? Is there a way to achieve smooth visualization for higher-order elements?
My dolfinx version is 0.9.0, and I am using WSL. I have tested this on both the Windows and Linux versions of ParaView (6.0.0), and the issue persists in both environments.
Any insights would be appreciated! Thanks in advance.

