Mercurial > hg > octave-lyh
comparison scripts/plot/__go_draw_axes__.m @ 7206:6e4ceeeb1940
[project @ 2007-11-27 22:40:20 by jwe]
author | jwe |
---|---|
date | Tue, 27 Nov 2007 22:40:20 +0000 |
parents | ccda60eac3d4 |
children | 4612ef369abb |
comparison
equal
deleted
inserted
replaced
7205:f3d508351e49 | 7206:6e4ceeeb1940 |
---|---|
35 pos = [0, 0, 1, 1]; | 35 pos = [0, 0, 1, 1]; |
36 if (! isempty (axis_obj.outerposition)) | 36 if (! isempty (axis_obj.outerposition)) |
37 pos = axis_obj.outerposition; | 37 pos = axis_obj.outerposition; |
38 endif | 38 endif |
39 | 39 |
40 ymirror = true; | |
40 if (! isempty (axis_obj.position)) | 41 if (! isempty (axis_obj.position)) |
41 pos = axis_obj.position; | 42 pos = axis_obj.position; |
42 fprintf (plot_stream, "set tmargin 3;\n"); | 43 fprintf (plot_stream, "set tmargin 3;\n"); |
43 fprintf (plot_stream, "set bmargin 3;\n"); | 44 fprintf (plot_stream, "set bmargin 3;\n"); |
44 fprintf (plot_stream, "set lmargin 10;\n"); | 45 fprintf (plot_stream, "set lmargin 10;\n"); |
45 fprintf (plot_stream, "set rmargin 10;\n"); | 46 fprintf (plot_stream, "set rmargin 10;\n"); |
47 ymirror = false; | |
46 endif | 48 endif |
47 | 49 |
48 if (! strcmp (axis_obj.__colorbar__, "none")) | 50 if (! strcmp (axis_obj.__colorbar__, "none")) |
49 [pos, cbox_orient, cbox_size, cbox_origin, cbox_mirror] = ... | 51 [pos, cbox_orient, cbox_size, cbox_origin, cbox_mirror] = ... |
50 gnuplot_postion_colorbox (pos, axis_obj.__colorbar__); | 52 gnuplot_postion_colorbox (pos, axis_obj.__colorbar__); |
207 fputs (plot_stream, "set grid mztics;\n"); | 209 fputs (plot_stream, "set grid mztics;\n"); |
208 else | 210 else |
209 fputs (plot_stream, "set grid nomztics;\n"); | 211 fputs (plot_stream, "set grid nomztics;\n"); |
210 endif | 212 endif |
211 | 213 |
212 do_tics (axis_obj, plot_stream); | 214 do_tics (axis_obj, plot_stream, ymirror); |
213 | 215 |
214 xlogscale = strcmpi (axis_obj.xscale, "log"); | 216 xlogscale = strcmpi (axis_obj.xscale, "log"); |
215 if (xlogscale) | 217 if (xlogscale) |
216 fprintf (plot_stream, "set logscale %s;\n", xaxisloc); | 218 fprintf (plot_stream, "set logscale %s;\n", xaxisloc); |
217 else | 219 else |
1530 endif | 1532 endif |
1531 fputs (plot_stream, "e\n"); | 1533 fputs (plot_stream, "e\n"); |
1532 | 1534 |
1533 endfunction | 1535 endfunction |
1534 | 1536 |
1535 function do_tics (obj, plot_stream) | 1537 function do_tics (obj, plot_stream, ymirror) |
1536 if (strcmpi (obj.xaxislocation, "top")) | 1538 if (strcmpi (obj.xaxislocation, "top")) |
1537 do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, | 1539 do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, |
1538 obj.xcolor, "x2", plot_stream); | 1540 obj.xcolor, "x2", plot_stream, true); |
1539 do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, | 1541 do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, |
1540 obj.xcolor, "x", plot_stream); | 1542 obj.xcolor, "x", plot_stream, true); |
1541 else | 1543 else |
1542 do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, | 1544 do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel, |
1543 obj.xcolor, "x", plot_stream); | 1545 obj.xcolor, "x", plot_stream, true); |
1544 do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, | 1546 do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel, |
1545 obj.xcolor, "x2", plot_stream); | 1547 obj.xcolor, "x2", plot_stream, true); |
1546 endif | 1548 endif |
1547 if (strcmpi (obj.yaxislocation, "right")) | 1549 if (strcmpi (obj.yaxislocation, "right")) |
1548 do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, | 1550 do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, |
1549 obj.ycolor, "y2", plot_stream); | 1551 obj.ycolor, "y2", plot_stream, ymirror); |
1550 do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, | 1552 do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, |
1551 obj.ycolor, "y", plot_stream); | 1553 obj.ycolor, "y", plot_stream, ymirror); |
1552 else | 1554 else |
1553 do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, | 1555 do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel, |
1554 obj.ycolor, "y", plot_stream); | 1556 obj.ycolor, "y", plot_stream, ymirror); |
1555 do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, | 1557 do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel, |
1556 obj.ycolor, "y2", plot_stream); | 1558 obj.ycolor, "y2", plot_stream, ymirror); |
1557 endif | 1559 endif |
1558 do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel, | 1560 do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel, |
1559 obj.zcolor, "z", plot_stream); | 1561 obj.zcolor, "z", plot_stream, true); |
1560 endfunction | 1562 endfunction |
1561 | 1563 |
1562 function do_tics_1 (ticmode, tics, labelmode, labels, color, ax, plot_stream) | 1564 function do_tics_1 (ticmode, tics, labelmode, labels, color, ax, plot_stream, mirror) |
1563 colorspec = get_text_colorspec (color); | 1565 colorspec = get_text_colorspec (color); |
1564 if (strcmpi (ticmode, "manual")) | 1566 if (strcmpi (ticmode, "manual")) |
1565 if (isempty (tics)) | 1567 if (isempty (tics)) |
1566 fprintf (plot_stream, "unset %stics;\n", ax); | 1568 fprintf (plot_stream, "unset %stics;\n", ax); |
1567 elseif (strcmpi (labelmode, "manual") && ! isempty (labels)) | 1569 elseif (strcmpi (labelmode, "manual") && ! isempty (labels)) |
1571 if (iscellstr (labels)) | 1573 if (iscellstr (labels)) |
1572 k = 1; | 1574 k = 1; |
1573 ntics = numel (tics); | 1575 ntics = numel (tics); |
1574 nlabels = numel (labels); | 1576 nlabels = numel (labels); |
1575 fprintf (plot_stream, "set format %s \"%%s\";\n", ax); | 1577 fprintf (plot_stream, "set format %s \"%%s\";\n", ax); |
1576 fprintf (plot_stream, "set %stics %s (", ax, colorspec); | 1578 if (mirror) |
1579 fprintf (plot_stream, "set %stics %s (", ax, colorspec); | |
1580 else | |
1581 fprintf (plot_stream, "set %stics nomirror %s (", ax, colorspec); | |
1582 endif | |
1577 for i = 1:ntics | 1583 for i = 1:ntics |
1578 fprintf (plot_stream, " \"%s\" %g", labels(k++), tics(i)) | 1584 fprintf (plot_stream, " \"%s\" %g", labels(k++), tics(i)) |
1579 if (i < ntics) | 1585 if (i < ntics) |
1580 fputs (plot_stream, ", "); | 1586 fputs (plot_stream, ", "); |
1581 endif | 1587 endif |
1587 else | 1593 else |
1588 error ("unsupported type of ticklabel"); | 1594 error ("unsupported type of ticklabel"); |
1589 endif | 1595 endif |
1590 else | 1596 else |
1591 fprintf (plot_stream, "set format %s \"%%g\";\n", ax); | 1597 fprintf (plot_stream, "set format %s \"%%g\";\n", ax); |
1592 fprintf (plot_stream, "set %stics (", ax); | 1598 if (mirror) |
1599 fprintf (plot_stream, "set %stics (", ax); | |
1600 else | |
1601 fprintf (plot_stream, "set %stics nomirror (", ax); | |
1602 endif | |
1593 fprintf (plot_stream, " %g,", tics(1:end-1)); | 1603 fprintf (plot_stream, " %g,", tics(1:end-1)); |
1594 fprintf (plot_stream, " %g);\n", tics(end)); | 1604 fprintf (plot_stream, " %g);\n", tics(end)); |
1595 endif | 1605 endif |
1596 else | 1606 else |
1597 fprintf (plot_stream, "set format %s \"%%g\";\n", ax); | 1607 fprintf (plot_stream, "set format %s \"%%g\";\n", ax); |
1598 fprintf (plot_stream, "set %stics %s;\n", ax, colorspec); | 1608 if (mirror) |
1609 fprintf (plot_stream, "set %stics %s;\n", ax, colorspec); | |
1610 else | |
1611 fprintf (plot_stream, "set %stics nomirror %s;\n", ax, colorspec); | |
1612 endif | |
1599 endif | 1613 endif |
1600 endfunction | 1614 endfunction |
1601 | 1615 |
1602 function colorspec = get_text_colorspec (color) | 1616 function colorspec = get_text_colorspec (color) |
1603 persistent have_newer_gnuplot ... | 1617 persistent have_newer_gnuplot ... |