SharpPlot Reference > SharpPlot Methods > DrawContourPlot Method

SharpPlot.DrawContourPlot Method

Generate contour plot from xyz values passed as 3 arrays.


sp = new SharpPlot(180,120);
sp.ContourPlotStyle = ContourPlotStyles.GridLines|ContourPlotStyles.Curves;
sp.MeshDensity = 5;
ydata = new int[] {190,270,310,120,190,230};
xdata = new int[] {17,31,29,14,16,24};
elevation = new int[] {12,65,77,7,9,112};

The short tutorial develops several examples, showing various strategies for contour fitting.



Contour plots are often an excellent alternative to 3D presentations where the object is to model three-dimensional data. Obviously, they can be used ‘just like a map’ where you may have a set of spot-heights (z-values) at various locations on the xy-plane. In this case, there is no particular shape assumed for the landscape, and the contours would simply be drawn to give the best ‘smooth interpretation’ of the recorded heights.

Another good use of contour plots is to fit some kind of model to the results from any experiment where two factors are systematically altered, and a third one is measured. In this case, the contours represent the model (they will simply be angled lines if the model is linear in both x and y directions) and make it very easy to read off the predicted result for any combination of input variables.

Several examples of various types of fitted contours are given in the tutorial. You will almost certainly need to experiment with the Order of fit and Flexibility properties to get the best results for your particular data.

See also ...

Contour plots for XYZ interpolation | SharpPlot Members | SharpPlot.Flexibility Property | SharpPlot.ScatterPlotStyle Property | SharpPlot.SetOrderOfFit Method

Send comments on this topic
© Dyalog Ltd 2021