I have a data set of x,y,z values and I fit a function of x,y to the data. This works, but I can't come up with a nice way to visualize the data. 3D plots are not very clear on paper and a contour plot of two data sets doesn't work either. What would be a clear and simple way to show the data and the fit?
data = Import["https://pastebin.com/raw/mTUJAZrM"]; fit = NonlinearModelFit[ data, A*Exp[-(y - y0 - y1 Cos[2 (x/180*Pi)])^2/(w0 + w1 Cos[2 x/180*Pi])^2], {A, {y0, 0.04}, {y1, 0.00}, {w0, 0.03}, {w1, 0.01}}, {x, y} ]; Show[ ListPointPlot3D[data], Plot3D[fit["BestFit"], {x, 0, 180}, {y, 0, 0.1}] ] EDIT:
What I decided to do for now is using a DensityPlot of the data with the ContourPlot of the fit (similar to Rahul Narain's answer). This does not really show the quality of the model, so I will add other plots, candidates are
- residuals vs. predicted values (similar to chris's answer)
- distribution of residuals (chris's answer)
- Q-Q plot using
QuantilePlot[fit["FitResiduals"]] - the plot Rahul Narain suggested










PlotStyle -> Directive[Yellow, Specularity[White, 20], Opacity[0.3]]and possiblyBoxRatios -> {1, 1, 1}$\endgroup$