Debian Codegraph @

texmf-dist/doc/latex/metaplot/examples/figures_2-7.mp

raw
1 % Figures 2-7 from _MetaPlot, MetaContour, and Other Collaborations
2 % with METAPOST_, preprint version, given at the Practical TeX 2004
3 % conference.
4
5 prologues:=0;
6 input metaplot % MetaPlot macros
7
8 % capillary.mp and capillary2.mp are both produced as output of the
9 % program capillary.cc. The relevant parameters in the program
10 % (lines 29-30) are:
11 %
12 % For capillary.mp:
13 % double theta = pi/4.0;
14 % double d = 1.0;
15 %
16 % For capillary2.mp:
17 % double theta = pi/6.0;
18 % double d = 1.0;
19
20 input capillary % capillary plot object
21 input capillary2 % capillaryb plot object
22
23
24 % Figure 2: The capillary surface, in its unadorned form as plot
25 % object elements scaled to 2.0in by 0.75in.
26
27 plot_instantiate(plotA, capillary)
28 plotA.pageleft = 0.0;
29 plotA.pagebottom = 0.0;
30 plotA.pagewidth = 2.0in;
31 plotA.pageheight = 0.75in;
32
33 beginfig(2)
34 draw plotA.plot(fplot) withcolor 0.85white;
35 draw plotA.plot(lplot) withpen pencircle scaled 1pt;
36 endfig;
37
38
39 % Figure 3: The capillary surface, with equal y and z scales, a page
40 % height of 0.75in, and appropriate annotations.
41
42 plot_instantiate(plotB, capillary)
43 plotB.pageleft = 0.0;
44 plotB.pagebottom = 0.0;
45 plotB.pageheight = 0.75in;
46 plot_setequalaxes(plotB);
47
48 beginfig(3)
49 draw plotB.plot(fplot) withcolor 0.85white;
50 linecap := butt;
51 pickup pencircle scaled 1pt;
52 % z-axis (vertical)
53 z1 = (plotB.pageleft, plotB.pagebottom);
54 z2 = (plotB.pageleft, plotB.pagetop + 0.1in);
55 % y-axis (horizontal)
56 z3 = (plotB.pageleft, plot_ypageloc(plotB,0.0));
57 z4 = (plotB.pageright + 0.1in,
58 plot_ypageloc(plotB,0.0));
59 drawarrow z1 -- z2;
60 label.top(btex $z$ etex, z2);
61 drawarrow z3 -- z4;
62 label.rt(btex $y$ etex, z4);
63 pickup pencircle scaled 0.25pt;
64 % Label for contact angle
65 z5 = plotB.plot(contactpoint);
66 z6 = z5 + 0.24in
67 * dir(-90 + capillary.contactangle);
68 z7 = z5 + 0.18in
69 * dir(-90 + 0.5*capillary.contactangle);
70 draw z5 -- z6;
71 label(btex $\theta$ etex, z7);
72 endfig;
73
74
75 % Figure 4: The capillary surface with parameters and page height as
76 % in Figure 3, but with $\theta = \pi/6$.
77
78 plot_instantiate(plotC, capillaryb)
79 plotC.pageleft = 0.0;
80 plotC.pagebottom = 0.0;
81 plotC.pageheight = 0.75in;
82 plot_setequalaxes(plotC);
83
84 beginfig(4)
85 draw plotC.plot(fplot) withcolor 0.85white;
86 linecap := butt;
87 pickup pencircle scaled 1pt;
88 % z-axis (vertical)
89 z1 = (plotC.pageleft, plotC.pagebottom);
90 z2 = (plotC.pageleft, plotC.pagetop + 0.1in);
91 % y-axis (horizontal)
92 z3 = (plotC.pageleft, plot_ypageloc(plotC,0.0));
93 z4 = (plotC.pageright + 0.1in,
94 plot_ypageloc(plotC,0.0));
95 drawarrow z1 -- z2;
96 label.top(btex $z$ etex, z2);
97 drawarrow z3 -- z4;
98 label.rt(btex $y$ etex, z4);
99 pickup pencircle scaled 0.25pt;
100 % Label for contact angle
101 z5 = plotC.plot(contactpoint);
102 z6 = z5 + 0.24in
103 * dir(-90 + capillaryb.contactangle);
104 z7 = z5 + 0.18in
105 * dir(-90 + 0.5*capillaryb.contactangle);
106 draw z5 -- z6;
107 label(btex $\theta$ etex, z7);
108 endfig;
109
110
111 % Figure 5: Two capillary surfaces, as in Figure 3 and Figure 4, showing
112 % the difference in the curves as a result of varying $\theta$.
113
114 plot_instantiate(plotD, capillary)
115 plotD.pageleft = 0.0;
116 plotD.pagebottom = 0.0;
117 plotD.pageheight = 0.75in;
118 plot_setequalaxes(plotD);
119
120 plot_instantiate(plotE, capillaryb)
121 plot_zpageloc(plotD, 0.0, 0.0)
122 = plot_zpageloc(plotE, 0.0, 0.0);
123 plot_zpageloc(plotD, 1.0, 1.0)
124 = plot_zpageloc(plotE, 1.0, 1.0);
125
126 beginfig(5)
127 linecap := butt;
128 pickup pencircle scaled 1pt;
129 draw plotD.plot(fplot) withcolor 0.85white;
130 draw plotE.plot(lplot) dashed evenly
131 withpen pencircle scaled 0.5pt;
132 % z-axis (vertical)
133 z1 = (plotD.pageleft, plotD.pagebottom);
134 x2 = plotD.pageleft;
135 y2 = max(plotD.pagetop, plotE.pagetop) + 0.1in;
136 % y-axis (horizontal)
137 z3 = (plotD.pageleft, plot_ypageloc(plotD,0.0));
138 x4 = max(plotD.pageright, plotE.pageright) + 0.1in;
139 y4 = plot_ypageloc(plotD,0.0);
140 drawarrow z1 -- z2;
141 label.top(btex $z$ etex, z2);
142 drawarrow z3 -- z4;
143 label.rt(btex $y$ etex, z4);
144 endfig;
145 end
146
147
148 % Figure 6: A repeat of Figure 5, with simple grid labels added.
149
150 beginfig(6)
151 linecap := butt;
152 pickup pencircle scaled 1pt;
153 draw plotD.plot(fplot) withcolor 0.85white;
154 draw plotE.plot(lplot) dashed evenly
155 withpen pencircle scaled 0.5pt;
156 % z-axis (vertical)
157 z1 = (plotD.pageleft, plotD.pagebottom);
158 x2 = plotD.pageleft;
159 y2 = max(plotD.pagetop, plotE.pagetop) + 0.1in;
160 % y-axis (horizontal)
161 z3 = (plotD.pageleft, plot_ypageloc(plotD,0.0));
162 x4 = max(plotD.pageright, plotE.pageright) + 0.1in;
163 y4 = plot_ypageloc(plotD,0.0);
164 drawarrow z1 -- z2;
165 label.top(btex $z$ etex, z2);
166 drawarrow z3 -- z4;
167 label.rt(btex $y$ etex, z4);
168 x5 = plotD.pageleft;
169 x6 = x4;
170 y5 = y6 = plotD.pagebottom;
171 draw plot_xtickscale(plotD)(
172 z5, z6, 0.08in, 0.06in, down,
173 0.0, 1.0, "%3f")
174 withpen pencircle scaled 0.5pt;
175 y7 = plotD.pagebottom;
176 y8 = y2;
177 x7 = x8 = plotD.pageleft;
178 draw plot_ytickscale(plotD)(
179 z7, z8, 0.08in, 0.06in, left,
180 0.0, 0.5, "%3f")
181 withpen pencircle scaled 0.5pt;
182 endfig;
183
184
185 % Figure 7: A repeat of Figure 5 again, with more advanced grid labels.
186
187 beginfig(7)
188 linecap := butt;
189 pickup pencircle scaled 1pt;
190 draw plotD.plot(fplot) withcolor 0.85white;
191 draw plotE.plot(lplot) dashed evenly
192 withpen pencircle scaled 0.5pt;
193 % z-axis (vertical)
194 z1 = (plotD.pageleft, plotD.pagebottom);
195 x2 = plotD.pageleft;
196 y2 = max(plotD.pagetop, plotE.pagetop) + 0.1in;
197 % y-axis (horizontal)
198 z3 = (plotD.pageleft, plot_ypageloc(plotD,0.0));
199 x4 = max(plotD.pageright, plotE.pageright) + 0.1in;
200 y4 = plot_ypageloc(plotD,0.0);
201 drawarrow z1 -- z2;
202 label.top(btex $z$ etex, z2);
203 drawarrow z3 -- z4;
204 label.rt(btex $y$ etex, z4);
205 x5 = plotD.pageleft;
206 x6 = x4 - 0.1in;
207 y5 = y6 = plotD.pagebottom - 0.06in;
208 draw plot_xtickscale(plotD)(
209 z5, z6, 0.08in, 0.06in, down,
210 0.5, 1.0, "%3f")
211 withpen pencircle scaled 0.5pt;
212 draw plot_xtickscale(plotD)(
213 z5, z6, 0.08in, 0.06in, down,
214 0.0, 1.0, "")
215 withpen pencircle scaled 0.5pt;
216 draw plot_xtickscale(plotD)(
217 z5, z6, 0.04in, 0.06in, down,
218 0.0, 0.1, "")
219 withpen pencircle scaled 0.5pt;
220 y7 = y4;
221 y8 = y2 - 0.1in;
222 x7 = x8 = plotD.pageleft - 0.06in;
223 draw plot_ytickscale(plotD)(
224 z7, z8, 0.08in, 0.06in, left,
225 0.0, 0.5, "%3f")
226 withpen pencircle scaled 0.5pt;
227 draw plot_ytickscale(plotD)(
228 z7, z8, 0.04in, 0.06in, left,
229 0.0, 0.1, "")
230 withpen pencircle scaled 0.5pt;
231 endfig;
232
233 end