#include <chplot.h>
#include <math.h>
int main() {
double x[16], y[16], z[256];
double r;
int i, j;
class CPlot subplot, *spl;
linspace(x, -10, 10);
linspace(y, -10, 10);
for(i=0; i<16; i++) {
for(j=0; j<16; j++) {
r = sqrt(x[i]*x[i]+y[j]*y[j]);
z[16*i+j] = sin(r)/r;
}
}
subplot.subplot(2,3);
spl = subplot.getSubplot(0,0);
spl->data3D(x, y, z);
spl->axisRange(PLOT_AXIS_Z, -.4, 1.2, .4);
spl->axisRange(PLOT_AXIS_XY, -10, 10, 5);
spl->plotType(PLOT_PLOTTYPE_LINES, 0);
spl->label(PLOT_AXIS_XYZ, NULL);
spl->title("PLOT_PLOTTYPE_LINES");
spl = subplot.getSubplot(0,1);
spl->data3D(x, y, z);
spl->axisRange(PLOT_AXIS_Z, -.4, 1.2, .4);
spl->axisRange(PLOT_AXIS_XY, -10, 10, 5);
spl->plotType(PLOT_PLOTTYPE_IMPULSES, 0);
spl->label(PLOT_AXIS_XYZ, NULL);
spl->title("PLOT_PLOTTYPE_IMPULSES");
spl = subplot.getSubplot(0,2);
spl->data3D(x, y, z);
spl->axisRange(PLOT_AXIS_Z, -.4, 1.2, .4);
spl->axisRange(PLOT_AXIS_XY, -10, 10, 5);
spl->plotType(PLOT_PLOTTYPE_POINTS, 0, 7, 1);
spl->label(PLOT_AXIS_XYZ, NULL);
spl->title("PLOT_PLOTTYPE_POINTS");
spl = subplot.getSubplot(1,0);
spl->data3D(x, y, z);
spl->axisRange(PLOT_AXIS_Z, -.4, 1.2, .4);
spl->axisRange(PLOT_AXIS_XY, -10, 10, 5);
spl->plotType(PLOT_PLOTTYPE_LINESPOINTS, 0, 0, 1, 7, 1);
spl->label(PLOT_AXIS_XYZ, NULL);
spl->title("PLOT_PLOTTYPE_LINESPOINTS");
spl = subplot.getSubplot(1,1);
spl->data3D(x, y, z);
spl->axisRange(PLOT_AXIS_Z, -.4, 1.2, .4);
spl->axisRange(PLOT_AXIS_XY, -10, 10, 5);
spl->plotType(PLOT_PLOTTYPE_SURFACES, 0);
spl->label(PLOT_AXIS_XYZ, NULL);
spl->title("PLOT_PLOTTYPE_SURFACES");
subplot.plotting();
}