source: trunk/examples/objects/plot/plot2.cc @ 1581

Last change on this file since 1581 was 1386, checked in by dkearney, 16 years ago

adding a few object prototypes we can play with for future developement. the plot object is probably the most interesting. examples are located in examples/objects dirs

File size: 1.1 KB
Line 
1#include <iostream>
2#include "RpPlot.h"
3
4int main()
5{
6    Rappture::Plot *p0 = NULL;
7    Rappture::Plot *p1 = NULL;
8    Rappture::Plot *p2 = NULL;
9    Rappture::Plot *p3 = NULL;
10    Rappture::Plot *p4 = NULL;
11
12    Rappture::Plot::lineInfo *li1;
13    Rappture::Plot::lineInfo *li2;
14
15    double x[] = {1,2,3,4,5,6,7,8,9,10};
16    double z[] = {1,2,3,4,5,6,7,8,9,10};
17    double y[] = {1,4,9,16,25,36,49,64,81,100};
18
19    size_t nPts = 10;
20
21    li1 = new Rappture::Plot::lineInfo(
22    li.xlabel("xlabel");
23    li.xdesc("xdesc");
24    li.ylabel("ylabel");
25
26    p0 = new Rappture::Plot("blahPlot");
27    p0->addAxis("xlabel","xdesc","xunits","xscale",x,nPts);
28    p0->addAxis("ylabel","ydesc","yunits","yscale",y,nPts);
29
30    p1 = new Rappture::Plot(nPts,x,y);
31    p2 = new Rappture::Plot(nPts,x,y,fmt);
32    p3 = new Rappture::Plot(nPts,x,z,x,y,fmt);
33    p4 = new Rappture::Plot(nPts,x,z,nPts,x,y,nPts,x,x);
34
35    p0->addAxis("zlabel","zdesc","zunits","zscale",z,10);
36
37    printCurve(n);
38    n->delAxis("zlabel");
39    n->delAxis("xzylabel");
40    printCurve(n);
41
42    delete n;
43    return 0;
44}
Note: See TracBrowser for help on using the repository browser.