#include <math.h> #include <chplot.h> int main() { int numpoints = 36; array double x[numpoints], y[numpoints]; class CPlot plot; linspace(x, -6, 6); y = 1 ./ (1+exp(-x)); plot.data2D(x, y); plot.ticsLocation(PLOT_AXIS_XY, "axis"); plot.axisRange(PLOT_AXIS_X, -6, 6, 2); plot.axisRange(PLOT_AXIS_Y, 0, 1, 0.2); plot.border(PLOT_BORDER_BOTTOM|PLOT_BORDER_LEFT, PLOT_OFF); plot.label(PLOT_AXIS_XY, NULL); plot.text("1/(1+exp(-x))", PLOT_TEXT_CENTER, 0, 1.15, 0); plot.text("x", PLOT_TEXT_CENTER, 0, -0.15, 0); plot.margins(-1, -1, 4, 3); /* adjust top and bottom margins for labels */ plot.plotting(); }