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
|
(* ASCEND modelling environment
Copyright (C) 1997 Benjamin Andrew Allan
Copyright (C) 2007 Carnegie Mellon University
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*)(*
by Ben Allan
provoked by plot.a4l by Peter Piela and Kirk A. Abbott
A parameterized plot library mostly compatible
with plot.a4l, but with variable graph titles.
*)
(* THIS MODEL IS AUTO-INCLUDED IN THE ASCEND MANUAL SO BE CAREFUL WITH EDITS *)
REQUIRE "atoms.a4l";
PROVIDE "plot.a4l";
MODEL pltmodel() REFINES cmumodel();
(* the methods in this MODEL library have
basically nothing to do except exist.
*)
METHODS
METHOD check_self;
END check_self;
METHOD scale_self;
END scale_self;
METHOD bound_self;
END bound_self;
METHOD default_all;
END default_all;
METHOD check_all;
END check_all;
METHOD bound_all;
END bound_all;
METHOD scale_all;
END scale_all;
END pltmodel;
MODEL plt_point(
x WILL_BE real;
y WILL_BE real;
) REFINES pltmodel();
END plt_point;
MODEL plt_curve(
npnts IS_A set OF integer_constant;
y_data[npnts] WILL_BE real;
x_data[npnts] WILL_BE real;
)REFINES pltmodel();
(* points of matching subscript will be plotted in order of
increasing subscript value.
*)
legend "Label for curve (displayed in legend box)"
, format "colour/linestyle in pylab format, eg 'r-' for red line"
IS_A symbol;
FOR i IN [npnts] CREATE
pnt[i] IS_A plt_point(x_data[i],y_data[i]);
END FOR;
END plt_curve;
ATOM plt_integer_default_0 REFINES integer
DIMENSIONLESS
DEFAULT 0;
END plt_integer_default_0;
MODEL plt_plot_integer(
curve_set IS_A set OF integer_constant;
curve[curve_set] WILL_BE plt_curve;
)REFINES pltmodel();
title "Plot title (shown at top)"
, XLabel "X-axis label"
, YLabel "Y-axis label"
IS_A symbol;
legend_position "Legend position (see http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend)"
IS_A plt_integer_default_0;
Xlow, Ylow, Xhigh, Yhigh IS_A real;
Xlog, Ylog IS_A boolean_start_false;
END plt_plot_integer;
MODEL plt_plot_symbol(
curve_set IS_A set OF symbol_constant;
curve[curve_set] WILL_BE plt_curve;
)REFINES pltmodel();
title "Plot title (shown at top)"
, XLabel "X-axis label"
, YLabel "Y-axis label"
IS_A symbol;
legend_position "Legend position (see http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend)"
IS_A plt_integer_default_0;
Xlow, Ylow, Xhigh, Yhigh IS_A real;
Xlog, Ylog IS_A boolean_start_false;
END plt_plot_symbol;
|