summaryrefslogtreecommitdiff
path: root/graphics/epix/samples/coord_tricks.xp
blob: 06cf00903732a8a67e78f8d344c9fae5a2ce91ec (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

const double gap(0.15); // distance between graph portions

Color GRAY(Black(0.5));

int main()
{
  picture(P(0,0),P(2+gap,2+gap), "4x4in");

  begin();

  plain(GRAY);
  // draw in global coordinates
  axis_break(P(1,0), P(1+gap,0));
  axis_break(P(0,1), P(0,1+gap));

  // portion adjacent to origin
  screen scr1(P(0,0), P(4,4));
  activate(scr1);

  set_crop();
  grid(8,8);

  h_axis_labels(4, P(0,-4), b);
  v_axis_labels(4, P(-4,0), l);

  bold(Red());
  plot(recip, 0, 4, 120);

  inset(P(0,0), P(1,1));

  // right portion
  screen scr2(P(10,0), P(14,4));
  activate(scr2);

  set_crop();
  plain(GRAY);
  grid(8,8);

  h_axis_labels(4, P(0,-4), b);

  bold(Red());
  plot(recip, 10, 14, 20);

  inset(P(1+gap,0), P(2+gap,1));

  // top portion
  screen scr3(P(0,10), P(4,14));
  activate(scr3);

  set_crop();
  plain(GRAY);
  grid(8,8);

  v_axis_labels(4, P(-4,0), l);

  bold(Red());
  plot(recip, 0.05, 0.1, 10);

  inset(P(0,1+gap), P(1,2+gap));

  end();
}