File: cropplot.xp

package info (click to toggle)
epix 1.2.22-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,256 kB
  • sloc: cpp: 16,847; sh: 5,054; makefile: 159; lisp: 6
file content (35 lines) | stat: -rw-r--r-- 607 bytes parent folder | download | duplicates (9)
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();
}