Programming and Graphics

(Kiana) #1

222 Introduction to C++ Programming and Graphics


Figure 7.4.1 Graphics display of codeplot2dsimpleshowing a line with markers
at the data points.

Function draw2daxes


Drawing and formatting axes is done through a sequence of operations
for defining and plotting ticks and underlying labels, as implemented in the
functiondraw2daxes.cc:


/*----------------------
draw2daxes.cc

Draw axes,
Label axes,
Put labels on the plot
----------------------- */

#include <iostream>
#include <iomanip>
#include <fstream>
#include "VOGLE/voglec++.h"

using namespace std;

void drawaxes2d (float xmin, float xmax // x plotting limits
,float ymin, float ymax // y plotting limits
,int ntcx // number of ticks on the x axis
,int ntcy // number of ticks on the y axis
,int Ilabelax // 1 to label axes; 0 for no labels
,int axc // axis color
,int lbc // label color
,char labelx[] // x-axis label
Free download pdf