Easiest way to do Contour & 3D Plots of Semi-Discrete solution data?

Hi, I have a method-of-lines solution to a 2nd-order PDE, where the solution “sol” is discrete in x, has columns for discrete data points df/dt and f, and has an ODE-type solution which can be either discrete or continuous in time.
(For example, sol.u[17][5,2] is the function value at the 5th x-position at the 17th timestep, and sol(17)[5,1] is (I think) df/dt at t=17 for the 5th x-position.)

So, question: what are some simple commands to plot values in the (t,x) plane? Like contour plots, 3D plots (similar to plot3D in Mathematica, and so on)? Thanks for any info!

You probably want contour plots from the Plots package. There are some examples here: Filled contour plots in Plots.jl without contour lines and smooth interpolation (GR backend)

Hi Leandro, thanks for the response!

contour does seem to produce better looking plots for my stuff than heatmap, histogram2d, or surface.

But… does anyone know the difference between contour and contourf ??
I’ve looked all around and can’t find an explanation of the distinction.

Thanks!

In one the level courves are filled, in the other they are not:

with countour:

contour

with coutourf:

contourf

2 Likes

You can (should) use ratio=1 to get equal aspect ratio. And/or set size=(400, 400)

Hmm, weird, my plots didn’t show any difference at all between contour and contourf.
Here’s my command:

contour(xArr, sol2ndOrd.t, FofTvsX, fill=true, linewidth=0.5, color=cgrad([:red,:white,:blue]), nlevels=15)

The suggestions of using ratio and size are good ones; I suppose I could specify other y/x ratios that way too.

Aha, apparently contour with fill=true produces the same plot as contourf.