| 1 |
% Figures 8-9 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 |
|
| 9 |
% mc2.mp is produced by the very pre-release version of metacontour |
| 10 |
% that should be included with this file; the program consists of |
| 11 |
% the files metacontour.cc, metacontour.h, cpoint.cc, cpoint.h, |
| 12 |
% and metacontour_main.cc. There is no input file; the data to |
| 13 |
% be plotted is generated within the program. |
| 14 |
% |
| 15 |
% Note that the resulting file is not in true "plot object" form; |
| 16 |
% we need to manually clip it and define the plot scale here. |
| 17 |
% This will, of course, be fixed in later versions of metacontour. |
| 18 |
|
| 19 |
input mc2 |
| 20 |
clip contplotA.LinePlot to (0,0)--(0,1)--(1,1)--(1,0)--cycle; |
| 21 |
clip contplotA.FillPlot to (0,0)--(0,1)--(1,1)--(1,0)--cycle; |
| 22 |
clip contplotA.Grid to (0,0)--(0,1)--(1,1)--(1,0)--cycle; |
| 23 |
|
| 24 |
contplotA.xleft = -1.0; |
| 25 |
contplotA.xright = 1.0; |
| 26 |
contplotA.ybot = -1.0; |
| 27 |
contplotA.ytop = 1.0; |
| 28 |
|
| 29 |
|
| 30 |
% Define pens, for convenience. |
| 31 |
|
| 32 |
pen thickline; thickline := pencircle scaled 2pt; |
| 33 |
pen thinline; thinline := pencircle scaled 1pt; |
| 34 |
pen hairline; hairline := pencircle scaled 0.25pt; |
| 35 |
|
| 36 |
|
| 37 |
% Figure 8: Sample graph created by MetaContour and MetaPlot, |
| 38 |
% showing potential lines for a combination of a linear gradient |
| 39 |
% and a point source, plotted on a polar grid. |
| 40 |
|
| 41 |
plot_instantiate(cplotA, contplotA); |
| 42 |
|
| 43 |
cplotA.pagewidth = 2.25in; |
| 44 |
plot_setequalaxes(cplotA); |
| 45 |
cplotA.llft = (0,0); |
| 46 |
|
| 47 |
beginfig(8); |
| 48 |
draw cplotA.plot(LinePlot) withpen thinline; |
| 49 |
draw cplotA.plot(Grid) withpen hairline; |
| 50 |
linejoin:=mitered; |
| 51 |
draw cplotA.llft--cplotA.lrt--cplotA.urt--cplotA.ulft--cycle withpen thickline; |
| 52 |
draw plot_xtickscale(cplotA)( |
| 53 |
cplotA.llft, cplotA.lrt, |
| 54 |
0.08in, 0.06in, down, 0.0, 0.5, "%3f") |
| 55 |
withpen thinline; |
| 56 |
draw plot_xtickscale(cplotA)( |
| 57 |
cplotA.llft, cplotA.lrt, |
| 58 |
0.05in, 0.06in, down, 0.0, 0.1, "") |
| 59 |
withpen thinline; |
| 60 |
draw plot_ytickscale(cplotA)( |
| 61 |
cplotA.llft, cplotA.ulft, |
| 62 |
0.08in, 0.06in, left, 0.0, 0.5, "%3f") |
| 63 |
withpen thinline; |
| 64 |
draw plot_ytickscale(cplotA)( |
| 65 |
cplotA.llft, cplotA.ulft, |
| 66 |
0.05in, 0.06in, left, 0.0, 0.1, "") |
| 67 |
withpen thinline; |
| 68 |
endfig; |
| 69 |
|
| 70 |
|
| 71 |
% Figure 9: Another sample graph created by MetaContour and MetaPlot, |
| 72 |
% illustrating a filled contour-plot style rather than using contour |
| 73 |
% lines. |
| 74 |
|
| 75 |
beginfig(9); |
| 76 |
draw cplotA.plot(FillPlot); |
| 77 |
draw cplotA.plot(Grid) withpen hairline; |
| 78 |
linejoin:=mitered; |
| 79 |
draw cplotA.llft--cplotA.lrt--cplotA.urt--cplotA.ulft--cycle withpen thickline; |
| 80 |
draw plot_xtickscale(cplotA)( |
| 81 |
cplotA.llft, cplotA.lrt, |
| 82 |
0.08in, 0.06in, down, 0.0, 0.5, "%3f") |
| 83 |
withpen thinline; |
| 84 |
draw plot_xtickscale(cplotA)( |
| 85 |
cplotA.llft, cplotA.lrt, |
| 86 |
0.05in, 0.06in, down, 0.0, 0.1, "") |
| 87 |
withpen thinline; |
| 88 |
draw plot_ytickscale(cplotA)( |
| 89 |
cplotA.llft, cplotA.ulft, |
| 90 |
0.08in, 0.06in, left, 0.0, 0.5, "%3f") |
| 91 |
withpen thinline; |
| 92 |
draw plot_ytickscale(cplotA)( |
| 93 |
cplotA.llft, cplotA.ulft, |
| 94 |
0.05in, 0.06in, left, 0.0, 0.1, "") |
| 95 |
withpen thinline; |
| 96 |
endfig; |
| 97 |
|
| 98 |
end |