Just to add to what David has already said, if your function is in CG2
(piecewise quadratic approximation), then it’s gradient should be in DG1
(piecewise linear discontinuous). This is what you should see in your results. I don’t know right off the bat, but plot
may/may not handle DG1
functions. The best way to visualize is by writing them using write_checkpoint to a xdmf
file and open in Paraview.
Also, others would be able to help you better, if you enclose your code withing triple fences ```
such that it is reproducible.