summaryrefslogtreecommitdiff
path: root/graphics/epix/samples/cropplot.xp
blob: b470d9049780899a9e26b2e355cef52c2bbd9c92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

double f(double t) { return 2*t*(1-t)*(1-t); }
double g(double t) { return 1/(1-t*t); }

int main()
{
  picture(P(-2,-4), P(2,4), "200x200pt");

  begin();

  set_crop();
  // Vertical asymptotes
  dashed();
  line(P(-1, ymin()), P(-1, ymax()));
  line(P( 1, ymin()), P( 1, ymax()));
  solid();

  // Axes
  h_axis(8);
  v_axis(8);

  h_axis_labels(4, P(-1, 2), tl); // align top-left
  v_axis_labels(4, P(-1, 2), tl);

  // Graphs
  plot(f, xmin(), xmax(), 80);

  bold();
  plot(g, xmin(), xmax(), 80); // N.B. poles are sample points

  end();
}