source: trunk/examples/objects/plot/plot1.cc

Last change on this file was 5673, checked in by ldelgass, 9 years ago

Fix line endings, set eol-style to native on all C/C++ sources.

  • Property svn:eol-style set to native
File size: 843 bytes
Line 
1// matlab, matplotlib like interface
2// maybe implementable with varargs?
3// donno how to implement doubles and triples of args:
4//  x,y,x,z
5//  x,y,fmt,x,z,fmt2
6
7#include <iostream>
8#include "RpPlot.h"
9
10int main()
11{
12    Rappture::Plot *p1 = NULL;
13    Rappture::Plot *p2 = NULL;
14    Rappture::Plot *p3 = NULL;
15    Rappture::Plot *p4 = NULL;
16
17    double x[] = {1,2,3,4,5,6,7,8,9,10};
18    double z[] = {1,2,3,4,5,6,7,8,9,10};
19    double y[] = {1,4,9,16,25,36,49,64,81,100};
20
21    size_t nPts = 10;
22
23    // green line, dotted line style, circle marker
24    const char *fmt = "g:o"
25
26    p1 = new Rappture::Plot(nPts,x,y);
27    p2 = new Rappture::Plot(nPts,x,y,fmt);
28    p3 = new Rappture::Plot(nPts,x,z,x,y,"g:o");
29    p4 = new Rappture::Plot(nPts,x,z,nPts,x,y,nPts,x,x);
30
31    delete p1;
32    delete p2;
33    delete p3;
34    delete p4;
35
36    return 0;
37}
Note: See TracBrowser for help on using the repository browser.