Mercurial > octave-nkf
comparison scripts/plot/__go_draw_axes__.m @ 7257:e8a3e3e33490
[project @ 2007-12-05 01:18:41 by jwe]
author | jwe |
---|---|
date | Wed, 05 Dec 2007 01:18:42 +0000 |
parents | 3a695b7adf8e |
children | 3fade00a6ac7 |
comparison
equal
deleted
inserted
replaced
7256:be3280acbdb8 | 7257:e8a3e3e33490 |
---|---|
72 if (isempty (t.string)) | 72 if (isempty (t.string)) |
73 fputs (plot_stream, "unset title;\n"); | 73 fputs (plot_stream, "unset title;\n"); |
74 else | 74 else |
75 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", | 75 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", |
76 have_newer_gnuplot); | 76 have_newer_gnuplot); |
77 fprintf (plot_stream, "set title \"%s\" font \"%s,%d\";\n", | 77 if (strcmp (f, "*")) |
78 undo_string_escapes (tt), f, s); | 78 fontspec = ""; |
79 else | |
80 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
81 endif | |
82 fprintf (plot_stream, "set title \"%s\" %s;\n", | |
83 undo_string_escapes (tt), fontspec); | |
79 endif | 84 endif |
80 endif | 85 endif |
81 | 86 |
82 if (! isempty (axis_obj.xlabel)) | 87 if (! isempty (axis_obj.xlabel)) |
83 t = get (axis_obj.xlabel); | 88 t = get (axis_obj.xlabel); |
87 fprintf (plot_stream, "unset xlabel;\n"); | 92 fprintf (plot_stream, "unset xlabel;\n"); |
88 fprintf (plot_stream, "unset x2label;\n"); | 93 fprintf (plot_stream, "unset x2label;\n"); |
89 else | 94 else |
90 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", | 95 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", |
91 have_newer_gnuplot); | 96 have_newer_gnuplot); |
97 if (strcmp (f, "*")) | |
98 fontspec = ""; | |
99 else | |
100 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
101 endif | |
92 if (strcmpi (axis_obj.xaxislocation, "top")) | 102 if (strcmpi (axis_obj.xaxislocation, "top")) |
93 fprintf (plot_stream, "set x2label \"%s\" %s font \"%s,%d\"", | 103 fprintf (plot_stream, "set x2label \"%s\" %s %s", |
94 undo_string_escapes (tt), colorspec, f, s); | 104 undo_string_escapes (tt), colorspec, fontspec); |
95 else | 105 else |
96 fprintf (plot_stream, "set xlabel \"%s\" %s font \"%s,%d\"", | 106 fprintf (plot_stream, "set xlabel \"%s\" %s %s", |
97 undo_string_escapes (tt), colorspec, f, s); | 107 undo_string_escapes (tt), colorspec, fontspec); |
98 endif | 108 endif |
99 if (have_newer_gnuplot) | 109 if (have_newer_gnuplot) |
100 ## Rotation of xlabel not yet support by gnuplot as of 4.2, but | 110 ## Rotation of xlabel not yet support by gnuplot as of 4.2, but |
101 ## there is no message about it. | 111 ## there is no message about it. |
102 fprintf (plot_stream, " rotate by %f", angle); | 112 fprintf (plot_stream, " rotate by %f", angle); |
118 fprintf (plot_stream, "unset ylabel;\n"); | 128 fprintf (plot_stream, "unset ylabel;\n"); |
119 fprintf (plot_stream, "unset y2label;\n"); | 129 fprintf (plot_stream, "unset y2label;\n"); |
120 else | 130 else |
121 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", | 131 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", |
122 have_newer_gnuplot); | 132 have_newer_gnuplot); |
133 if (strcmp (f, "*")) | |
134 fontspec = ""; | |
135 else | |
136 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
137 endif | |
123 if (strcmpi (axis_obj.yaxislocation, "right")) | 138 if (strcmpi (axis_obj.yaxislocation, "right")) |
124 fprintf (plot_stream, "set y2label \"%s\" %s font \"%s,%d\"", | 139 fprintf (plot_stream, "set y2label \"%s\" %s %s", |
125 undo_string_escapes (tt), colorspec, f, s); | 140 undo_string_escapes (tt), colorspec, fontspec); |
126 else | 141 else |
127 fprintf (plot_stream, "set ylabel \"%s\" %s font \"%s,%d\"", | 142 fprintf (plot_stream, "set ylabel \"%s\" %s %s", |
128 undo_string_escapes (tt), colorspec, f, s); | 143 undo_string_escapes (tt), colorspec, fontspec); |
129 endif | 144 endif |
130 if (have_newer_gnuplot) | 145 if (have_newer_gnuplot) |
131 fprintf (plot_stream, " rotate by %f;\n", angle); | 146 fprintf (plot_stream, " rotate by %f;\n", angle); |
132 endif | 147 endif |
133 fputs (plot_stream, ";\n"); | 148 fputs (plot_stream, ";\n"); |
146 if (isempty (t.string)) | 161 if (isempty (t.string)) |
147 fputs (plot_stream, "unset zlabel;\n"); | 162 fputs (plot_stream, "unset zlabel;\n"); |
148 else | 163 else |
149 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", | 164 [tt, f, s] = __maybe_munge_text__ (enhanced, t, "string", |
150 have_newer_gnuplot); | 165 have_newer_gnuplot); |
151 fprintf (plot_stream, "set zlabel \"%s\" %s font \"%s,%d\"", | 166 if (strcmp (f, "*")) |
152 undo_string_escapes (tt), colorspec, f, s); | 167 fontspec = ""; |
168 else | |
169 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
170 endif | |
171 fprintf (plot_stream, "set zlabel \"%s\" %s %s", | |
172 undo_string_escapes (tt), colorspec, fontspec); | |
153 if (have_newer_gnuplot) | 173 if (have_newer_gnuplot) |
154 ## Rotation of zlabel not yet support by gnuplot as of 4.2, but | 174 ## Rotation of zlabel not yet support by gnuplot as of 4.2, but |
155 ## there is no message about it. | 175 ## there is no message about it. |
156 fprintf (plot_stream, " rotate by %f;\n", angle); | 176 fprintf (plot_stream, " rotate by %f;\n", angle); |
157 endif | 177 endif |
911 endif | 931 endif |
912 | 932 |
913 case "text" | 933 case "text" |
914 [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string", | 934 [label, f, s] = __maybe_munge_text__ (enhanced, obj, "string", |
915 have_newer_gnuplot); | 935 have_newer_gnuplot); |
936 if (strcmp (f, "*")) | |
937 fontspec = ""; | |
938 else | |
939 fontspec = sprintf ("font \"%s,%d\"", f, s); | |
940 endif | |
916 lpos = obj.position; | 941 lpos = obj.position; |
917 halign = obj.horizontalalignment; | 942 halign = obj.horizontalalignment; |
918 angle = obj.rotation; | 943 angle = obj.rotation; |
919 units = obj.units; | 944 units = obj.units; |
920 color = obj.color; | 945 color = obj.color; |
928 colorspec = get_text_colorspec (color); | 953 colorspec = get_text_colorspec (color); |
929 endif | 954 endif |
930 | 955 |
931 if (nd == 3) | 956 if (nd == 3) |
932 fprintf (plot_stream, | 957 fprintf (plot_stream, |
933 "set label \"%s\" at %s %.15g,%.15g,%.15g font \"%s,%d\" %s rotate by %f %s;\n", | 958 "set label \"%s\" at %s %.15g,%.15g,%.15g %s %s rotate by %f %s;\n", |
934 undo_string_escapes (label), units, lpos(1), | 959 undo_string_escapes (label), units, lpos(1), |
935 lpos(2), lpos(3), f, s, halign, angle, colorspec); | 960 lpos(2), lpos(3), fontspec, halign, angle, colorspec); |
936 else | 961 else |
937 fprintf (plot_stream, | 962 fprintf (plot_stream, |
938 "set label \"%s\" at %s %.15g,%.15g font \"%s,%d\" %s rotate by %f %s;\n", | 963 "set label \"%s\" at %s %.15g,%.15g %s %s rotate by %f %s;\n", |
939 undo_string_escapes (label), units, | 964 undo_string_escapes (label), units, |
940 lpos(1), lpos(2), f, s, halign, angle, colorspec); | 965 lpos(1), lpos(2), fontspec, halign, angle, colorspec); |
941 endif | 966 endif |
942 | 967 |
943 otherwise | 968 otherwise |
944 error ("__go_draw_axes__: unknown object class, %s", | 969 error ("__go_draw_axes__: unknown object class, %s", |
945 obj.type); | 970 obj.type); |