summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/metaplot/examples/figures_2-7.mp
blob: cc2e8be970e28eef296fc87195ee9d762efd10ad (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
% Figures 2-7 from _MetaPlot, MetaContour, and Other Collaborations
% with METAPOST_, preprint version, given at the Practical TeX 2004
% conference.

prologues:=0;
input metaplot    % MetaPlot macros

% capillary.mp and capillary2.mp are both produced as output of the 
% program capillary.cc.  The relevant parameters in the program
% (lines 29-30) are:
%
% For capillary.mp:
%    double theta = pi/4.0;
%    double d = 1.0;
%
% For capillary2.mp:
%    double theta = pi/6.0;
%    double d = 1.0;

input capillary   % capillary plot object
input capillary2  % capillaryb plot object


% Figure 2: The capillary surface, in its unadorned form as plot
% object elements scaled to 2.0in by 0.75in.

plot_instantiate(plotA, capillary)
plotA.pageleft = 0.0;
plotA.pagebottom = 0.0;
plotA.pagewidth = 2.0in;
plotA.pageheight = 0.75in;

beginfig(2)
  draw plotA.plot(fplot) withcolor 0.85white;
  draw plotA.plot(lplot) withpen pencircle scaled 1pt;
endfig;


% Figure 3: The capillary surface, with equal y and z scales, a page
% height of 0.75in, and appropriate annotations.

plot_instantiate(plotB, capillary)
plotB.pageleft = 0.0;
plotB.pagebottom = 0.0;
plotB.pageheight = 0.75in;
plot_setequalaxes(plotB);

beginfig(3)
  draw plotB.plot(fplot) withcolor 0.85white;
  linecap := butt;
  pickup pencircle scaled 1pt;
  % z-axis (vertical)
  z1 = (plotB.pageleft, plotB.pagebottom);
  z2 = (plotB.pageleft, plotB.pagetop + 0.1in);
  % y-axis (horizontal)
  z3 = (plotB.pageleft, plot_ypageloc(plotB,0.0));
  z4 = (plotB.pageright + 0.1in,
          plot_ypageloc(plotB,0.0));
  drawarrow z1 -- z2;
  label.top(btex $z$ etex, z2);
  drawarrow z3 -- z4;
  label.rt(btex $y$ etex, z4);
  pickup pencircle scaled 0.25pt;
  % Label for contact angle
  z5 = plotB.plot(contactpoint);
  z6 = z5 + 0.24in
        * dir(-90 + capillary.contactangle);
  z7 = z5 + 0.18in
        * dir(-90 + 0.5*capillary.contactangle);
  draw z5 -- z6;
  label(btex $\theta$ etex, z7);
endfig;


% Figure 4: The capillary surface with parameters and page height as
% in Figure 3, but with $\theta = \pi/6$.

plot_instantiate(plotC, capillaryb)
plotC.pageleft = 0.0;
plotC.pagebottom = 0.0;
plotC.pageheight = 0.75in;
plot_setequalaxes(plotC);

beginfig(4)
  draw plotC.plot(fplot) withcolor 0.85white;
  linecap := butt;
  pickup pencircle scaled 1pt;
  % z-axis (vertical)
  z1 = (plotC.pageleft, plotC.pagebottom);
  z2 = (plotC.pageleft, plotC.pagetop + 0.1in);
  % y-axis (horizontal)
  z3 = (plotC.pageleft, plot_ypageloc(plotC,0.0));
  z4 = (plotC.pageright + 0.1in,
          plot_ypageloc(plotC,0.0));
  drawarrow z1 -- z2;
  label.top(btex $z$ etex, z2);
  drawarrow z3 -- z4;
  label.rt(btex $y$ etex, z4);
  pickup pencircle scaled 0.25pt;
  % Label for contact angle
  z5 = plotC.plot(contactpoint);
  z6 = z5 + 0.24in
        * dir(-90 + capillaryb.contactangle);
  z7 = z5 + 0.18in
        * dir(-90 + 0.5*capillaryb.contactangle);
  draw z5 -- z6;
  label(btex $\theta$ etex, z7);
endfig;


% Figure 5: Two capillary surfaces, as in Figure 3 and Figure 4, showing
% the difference in the curves as a result of varying $\theta$.

plot_instantiate(plotD, capillary)
plotD.pageleft = 0.0;
plotD.pagebottom = 0.0;
plotD.pageheight = 0.75in;
plot_setequalaxes(plotD);

plot_instantiate(plotE, capillaryb)
plot_zpageloc(plotD, 0.0, 0.0)
 = plot_zpageloc(plotE, 0.0, 0.0);
plot_zpageloc(plotD, 1.0, 1.0)
 = plot_zpageloc(plotE, 1.0, 1.0);

beginfig(5)
  linecap := butt;
  pickup pencircle scaled 1pt;
  draw plotD.plot(fplot) withcolor 0.85white;
  draw plotE.plot(lplot) dashed evenly
    withpen pencircle scaled 0.5pt;
  % z-axis (vertical)
  z1 = (plotD.pageleft, plotD.pagebottom);
  x2 = plotD.pageleft;
  y2 = max(plotD.pagetop, plotE.pagetop) + 0.1in;
  % y-axis (horizontal)
  z3 = (plotD.pageleft, plot_ypageloc(plotD,0.0));
  x4 = max(plotD.pageright, plotE.pageright) + 0.1in;
  y4 = plot_ypageloc(plotD,0.0);
  drawarrow z1 -- z2;
  label.top(btex $z$ etex, z2);
  drawarrow z3 -- z4;
  label.rt(btex $y$ etex, z4);
endfig;
end


% Figure 6: A repeat of Figure 5, with simple grid labels added.

beginfig(6)
  linecap := butt;
  pickup pencircle scaled 1pt;
  draw plotD.plot(fplot) withcolor 0.85white;
  draw plotE.plot(lplot) dashed evenly
    withpen pencircle scaled 0.5pt;
  % z-axis (vertical)
  z1 = (plotD.pageleft, plotD.pagebottom);
  x2 = plotD.pageleft;
  y2 = max(plotD.pagetop, plotE.pagetop) + 0.1in;
  % y-axis (horizontal)
  z3 = (plotD.pageleft, plot_ypageloc(plotD,0.0));
  x4 = max(plotD.pageright, plotE.pageright) + 0.1in;
  y4 = plot_ypageloc(plotD,0.0);
  drawarrow z1 -- z2;
  label.top(btex $z$ etex, z2);
  drawarrow z3 -- z4;
  label.rt(btex $y$ etex, z4);
  x5 = plotD.pageleft;
  x6 = x4;
  y5 = y6 = plotD.pagebottom;
  draw plot_xtickscale(plotD)(
    z5, z6, 0.08in, 0.06in, down,
    0.0, 1.0, "%3f")
    withpen pencircle scaled 0.5pt;
  y7 = plotD.pagebottom;
  y8 = y2;
  x7 = x8 = plotD.pageleft;
  draw plot_ytickscale(plotD)(
    z7, z8, 0.08in, 0.06in, left,
    0.0, 0.5, "%3f")
    withpen pencircle scaled 0.5pt;
endfig;


% Figure 7: A repeat of Figure 5 again, with more advanced grid labels.

beginfig(7)
  linecap := butt;
  pickup pencircle scaled 1pt;
  draw plotD.plot(fplot) withcolor 0.85white;
  draw plotE.plot(lplot) dashed evenly
    withpen pencircle scaled 0.5pt;
  % z-axis (vertical)
  z1 = (plotD.pageleft, plotD.pagebottom);
  x2 = plotD.pageleft;
  y2 = max(plotD.pagetop, plotE.pagetop) + 0.1in;
  % y-axis (horizontal)
  z3 = (plotD.pageleft, plot_ypageloc(plotD,0.0));
  x4 = max(plotD.pageright, plotE.pageright) + 0.1in;
  y4 = plot_ypageloc(plotD,0.0);
  drawarrow z1 -- z2;
  label.top(btex $z$ etex, z2);
  drawarrow z3 -- z4;
  label.rt(btex $y$ etex, z4);
  x5 = plotD.pageleft;
  x6 = x4 - 0.1in;
  y5 = y6 = plotD.pagebottom - 0.06in;
  draw plot_xtickscale(plotD)(
    z5, z6, 0.08in, 0.06in, down,
    0.5, 1.0, "%3f")
    withpen pencircle scaled 0.5pt;
  draw plot_xtickscale(plotD)(
    z5, z6, 0.08in, 0.06in, down,
    0.0, 1.0, "")
    withpen pencircle scaled 0.5pt;
  draw plot_xtickscale(plotD)(
    z5, z6, 0.04in, 0.06in, down,
    0.0, 0.1, "")
    withpen pencircle scaled 0.5pt;
  y7 = y4;
  y8 = y2 - 0.1in;
  x7 = x8 = plotD.pageleft - 0.06in;
  draw plot_ytickscale(plotD)(
    z7, z8, 0.08in, 0.06in, left,
    0.0, 0.5, "%3f")
    withpen pencircle scaled 0.5pt;
  draw plot_ytickscale(plotD)(
    z7, z8, 0.04in, 0.06in, left,
    0.0, 0.1, "")
    withpen pencircle scaled 0.5pt;
endfig;

end