762
770
colorspec = sprintf ("lc rgb \"#%02x%02x%02x\"",
763
771
round (255*color));
765
withclause{data_idx} = sprintf ("with %s %s %s %s %s",
766
style, pt, lt, ps, colorspec);
773
withclause{data_idx} = sprintf ("with %s %s %s %s %s %s",
774
style, lw, pt, lt, ps,
768
if (isequal (color, [0,0,0]))
770
elseif (isequal (color, [1,0,0]))
772
elseif (isequal (color, [0,1,0]))
774
elseif (isequal (color, [0,0,1]))
776
elseif (isequal (color, [1,0,1]))
778
elseif (isequal (color, [0,1,1]))
780
elseif (isequal (color, [1,1,1]))
782
elseif (isequal (color, [1,1,0]))
787
withclause{data_idx} = sprintf ("with %s %s %s lt %d",
777
typ = get_old_gnuplot_color (color);
778
withclause{data_idx} = sprintf ("with %s %s %s %s lt %d",
779
style, lw, pt, ps, typ);
888
879
facecolor_none_or_white = (strncmp (obj.facecolor, "none", 4)
889
880
|| (isnumeric (obj.facecolor)
890
881
&& all (obj.facecolor == 1)));
891
if (strncmp (obj.facecolor, "none", 4))
892
hidden_removal = false;
894
if (isnan (hidden_removal))
895
hidden_removal = true;
882
hidden_removal = false;
883
fputs (plot_stream, "set style increment default;\n");
899
884
if (flat_interp_edge && facecolor_none_or_white)
900
885
withclause{data_idx} = "with line palette";
886
fputs (plot_stream, "unset pm3d\n");
887
if (all (obj.facecolor == 1))
888
hidden_removal = true;
890
elseif (facecolor_none_or_white)
891
edgecol = obj.edgecolor;
892
if (have_newer_gnuplot)
896
colorspec = sprintf ("linecolor rgb \"#%02x%02x%02x\"",
897
round (255*edgecol));
899
if (all (obj.facecolor == 1))
900
hidden_removal = true;
902
fputs(plot_stream,"unset pm3d;\n");
903
fprintf (plot_stream,
904
"set style line %d %s lw %f;\n",
905
data_idx, colorspec, obj.linewidth);
906
fputs(plot_stream,"set style increment user;\n");
908
typ = get_old_gnuplot_color (edgecol);
909
fprintf (plot_stream,
910
"set style line %d lt %d lw %f;\n",
911
data_idx, typ, obj.linewidth);
913
withclause{data_idx} = sprintf("with line linestyle %d", data_idx);
914
fputs (plot_stream, "unset pm3d\n");
903
917
if (have_newer_gnuplot)
932
946
"set style line %d %s lw %f;\n",
933
947
data_idx, colorspec, obj.linewidth);
935
if (isequal (edgecol, [0,0,0]))
937
elseif (isequal (edgecol, [1,0,0]))
939
elseif (isequal (edgecol, [0,1,0]))
941
elseif (isequal (edgecol, [0,0,1]))
943
elseif (isequal (edgecol, [1,0,1]))
945
elseif (isequal (edgecol, [0,1,1]))
947
elseif (isequal (edgecol, [1,1,1]))
949
elseif (isequal (edgecol, [1,1,0]))
949
typ = get_old_gnuplot_color (edgecol);
954
950
fprintf (plot_stream,
955
951
"set style line %d lt %d lw %f;\n",
956
952
data_idx, typ, obj.linewidth);
986
982
fprintf (plot_stream,
987
"set label \"%s\" at %s %.15g,%.15g,%.15g %s rotate by %f %s front %s;\n",
983
"set label \"%s\" at %s %.15g,%.15g,%.15g %s rotate by %f %s %s front %s;\n",
988
984
undo_string_escapes (label), units, lpos(1),
989
lpos(2), lpos(3), halign, angle, fontspec, colorspec);
985
lpos(2), lpos(3), halign, angle, fontspec,
986
__do_enhanced_option__ (enhanced, obj), colorspec);
991
988
fprintf (plot_stream,
992
"set label \"%s\" at %s %.15g,%.15g %s rotate by %f %s front %s;\n",
989
"set label \"%s\" at %s %.15g,%.15g %s rotate by %f %s %s front %s;\n",
993
990
undo_string_escapes (label), units,
994
lpos(1), lpos(2), halign, angle, fontspec, colorspec);
991
lpos(1), lpos(2), halign, angle, fontspec,
992
__do_enhanced_option__ (enhanced, obj), colorspec);
1058
1070
fputs (plot_stream, "set border 895;\n");
1060
1072
if (strcmpi (axis_obj.yaxislocation, "right"))
1061
fputs (plot_stream, "unset ytics; set y2tics nomirror\n");
1073
fputs (plot_stream, "unset ytics; set y2tics %s nomirror\n",
1062
1075
if (strcmpi (axis_obj.xaxislocation, "top"))
1063
fputs (plot_stream, "unset xtics; set x2tics nomirror\n");
1076
fputs (plot_stream, "unset xtics; set x2tics %s nomirror\n",
1064
1078
fputs (plot_stream, "set border 12;\n");
1066
fputs (plot_stream, "unset x2tics; set xtics nomirror\n");
1080
fputs (plot_stream, "unset x2tics; set xtics %s nomirror\n",
1067
1082
fputs (plot_stream, "set border 9;\n");
1070
fputs (plot_stream, "unset y2tics; set ytics nomirror\n");
1085
fputs (plot_stream, "unset y2tics; set ytics %s nomirror\n",
1071
1087
if (strcmpi (axis_obj.xaxislocation, "top"))
1072
fputs (plot_stream, "unset xtics; set x2tics nomirror\n");
1088
fputs (plot_stream, "unset xtics; set x2tics %s nomirror\n",
1073
1090
fputs (plot_stream, "set border 6;\n");
1075
fputs (plot_stream, "unset x2tics; set xtics nomirror\n");
1092
fputs (plot_stream, "unset x2tics; set xtics %s nomirror\n",
1076
1094
fputs (plot_stream, "set border 3;\n");
1476
1483
function do_tics (obj, plot_stream, ymirror, mono)
1477
1484
if (strcmpi (obj.xaxislocation, "top"))
1478
1485
do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
1479
obj.xcolor, "x2", plot_stream, true, mono, "border");
1486
obj.xcolor, "x2", plot_stream, true, mono, "border",
1480
1488
do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
1481
obj.xcolor, "x", plot_stream, true, mono, "border");
1489
obj.xcolor, "x", plot_stream, true, mono, "border", "");
1482
1490
elseif (strcmpi (obj.xaxislocation, "zero"))
1483
1491
do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
1484
obj.xcolor, "x", plot_stream, true, mono, "axis");
1492
obj.xcolor, "x", plot_stream, true, mono, "axis",
1485
1494
do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
1486
obj.xcolor, "x2", plot_stream, true, mono, "axis");
1495
obj.xcolor, "x2", plot_stream, true, mono, "axis", "");
1488
1497
do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
1489
obj.xcolor, "x", plot_stream, true, mono, "border");
1498
obj.xcolor, "x", plot_stream, true, mono, "border",
1490
1500
do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
1491
obj.xcolor, "x2", plot_stream, true, mono, "border");
1501
obj.xcolor, "x2", plot_stream, true, mono, "border", "");
1493
1503
if (strcmpi (obj.yaxislocation, "right"))
1494
1504
do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
1495
obj.ycolor, "y2", plot_stream, ymirror, mono, "border");
1505
obj.ycolor, "y2", plot_stream, ymirror, mono, "border",
1496
1507
do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
1497
obj.ycolor, "y", plot_stream, ymirror, mono, "border");
1508
obj.ycolor, "y", plot_stream, ymirror, mono, "border", "");
1498
1509
elseif (strcmpi (obj.xaxislocation, "zero"))
1499
1510
do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
1500
obj.ycolor, "y", plot_stream, ymirror, mono, "axis");
1511
obj.ycolor, "y", plot_stream, ymirror, mono, "axis",
1501
1513
do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
1502
obj.ycolor, "y2", plot_stream, ymirror, mono, "axis");
1514
obj.ycolor, "y2", plot_stream, ymirror, mono, "axis", "");
1504
1516
do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
1505
obj.ycolor, "y", plot_stream, ymirror, mono, "border");
1517
obj.ycolor, "y", plot_stream, ymirror, mono, "border",
1506
1519
do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
1507
obj.ycolor, "y2", plot_stream, ymirror, mono, "border");
1520
obj.ycolor, "y2", plot_stream, ymirror, mono, "border", "");
1509
1522
do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel,
1510
obj.zcolor, "z", plot_stream, true, mono, "border");
1523
obj.zcolor, "z", plot_stream, true, mono, "border",
1513
1527
function do_tics_1 (ticmode, tics, labelmode, labels, color, ax,
1514
plot_stream, mirror, mono, axispos)
1528
plot_stream, mirror, mono, axispos, tickdir)
1515
1529
colorspec = get_text_colorspec (color, mono);
1516
1530
if (strcmpi (ticmode, "manual"))
1517
1531
if (isempty (tics))
1577
1594
round (255*color));
1580
if (isequal (color, [0,0,0]))
1582
elseif (isequal (color, [1,0,0]))
1584
elseif (isequal (color, [0,1,0]))
1586
elseif (isequal (color, [0,0,1]))
1588
elseif (isequal (color, [1,0,1]))
1590
elseif (isequal (color, [0,1,1]))
1592
elseif (isequal (color, [1,1,1]))
1594
elseif (isequal (color, [1,1,0]))
1597
typ = get_old_gnuplot_color (color);
1599
1598
colorspec = sprintf ("textcolor lt %d", typ);
1603
1602
function [f, s, fnt, it, bld] = get_fontname_and_size (t)
1604
1603
if (isempty (t.fontname))
1607
fnt = tolower (t.fontname);
1612
if (! isempty (t.fontweight) && strcmp (tolower (t.fontweight), "bold"))
1611
if (! isempty (t.fontweight) && strcmpi (t.fontweight, "bold"))
1613
1612
if (! isempty(t.fontangle)
1614
&& (strcmp (tolower (t.fontangle), "italic")
1615
|| strcmp (tolower (t.fontangle), "oblique")))
1613
&& (strcmpi (t.fontangle, "italic")
1614
|| strcmpi (t.fontangle, "oblique")))
1616
1615
f = strcat (f, "-bolditalic");
1939
1939
sym.subset = '{/Symbol \314}';
1940
1940
sym.subseteq = '{/Symbol \315}';
1941
1941
sym.in = '{/Symbol \316}';
1942
sym.langle = '{/Symbol \320}';
1943
sym.rangle = '{/Symbol \320}';
1942
sym.notin = '{/Symbol \317}';
1943
sym.angle = '{/Symbol \320}';
1944
sym.bigtriangledown = '{/Symbol \321}';
1945
sym.langle = '{/Symbol \341}';
1946
sym.rangle = '{/Symbol \361}';
1944
1947
sym.nabla = '{/Symbol \321}';
1948
sym.prod = '{/Symbol \325}';
1945
1949
sym.surd = '{/Symbol \326}';
1946
1950
sym.cdot = '{/Symbol \327}';
1947
1951
sym.neg = '{/Symbol \330}';
1948
1952
sym.wedge = '{/Symbol \331}';
1949
1953
sym.vee = '{/Symbol \332}';
1954
sym.Leftrightarrow = '{/Symbol \333}';
1955
sym.Leftarrow = '{/Symbol \334}';
1956
sym.Uparrow = '{/Symbol \335}';
1957
sym.Rightarrow = '{/Symbol \336}';
1958
sym.Downarrow = '{/Symbol \337}';
1959
sym.diamond = '{/Symbol \340}';
1950
1960
sym.copyright = '{/Symbol \343}';
1951
sym.rfloor = '{/Symbol \353}';
1961
sym.lfloor = '{/Symbol \353}';
1952
1962
sym.lceil = '{/Symbol \351}';
1953
sym.lfloor = '{/Symbol \373}';
1963
sym.rfloor = '{/Symbol \373}';
1954
1964
sym.rceil = '{/Symbol \371}';
1955
1965
sym.int = '{/Symbol \362}';
1958
function [pos, orient, sz, origin, mirr] = gnuplot_postion_colorbox (pos, cbox)
1959
## This is an emprically derived function that
1968
function [pos, orient, sz, origin, mirr] = gnuplot_position_colorbox (pos, cbox, obj)
1969
## This is an emprically derived function that attempts to find a good
1970
## size for the colorbox even for subplots and strange aspect ratios.
1961
1972
if (strncmp (cbox, "north", 5) || strncmp (cbox, "south", 5))
1962
1973
scl = pos([2,4]);
1985
if (strcmpi (obj.dataaspectratiomode, "manual"))
1986
sz = min(pos(3:4))([1,1]);
1987
r = obj.dataaspectratio;
1988
if (pos(3) > pos(4))
1990
case {"north", "northoutside"}
1991
off = 4 / 3 * [(pos(3) - pos(4)) ./ (r(2)/r(1)), pos(4) / pos(3) / 2];
1993
case {"south", "southoutside"}
1994
off = 4 / 3 * [(pos(3) - pos(4)) ./ (r(2)/r(1)), 0];
1997
off = [(pos(3) - pos(4)) ./ (r(2)/r(1)), 0];
2001
case {"north", "northoutside"}
2002
off = 1.5 * [0, (pos(4) - pos(3)) ./ (r(1) / r(2))];
2003
case {"south", "southoutside"}
2004
off = 0.5 * [0, (pos(4) - pos(3)) ./ (r(1) / r(2))];
2006
off = [0, (pos(4) - pos(3)) ./ (r(1) / r(2))];
1975
2015
case "northoutside"
1976
sz = pos(3:4) - 0.08;
1977
origin = [0.05, 0.06] + [0.00, 0.88] .* sz + pos(1:2);
2017
origin = [0.05, 0.06] + [0.00, 0.88] .* sz + pos(1:2) + off;
1979
2019
orient = "horizontal";
1981
sz = pos(3:4) - 0.16;
1982
origin = [0.09, 0.09] + [0.00, 0.94] .* sz + pos(1:2);
2022
origin = [0.09, 0.09] + [0.00, 0.94] .* sz + pos(1:2) + off;
1984
2024
orient = "horizontal";
1985
2025
case "southoutside"
1986
sz = pos(3:4) - 0.08;
1987
origin = [0.05, 0.06] + [0.00, 0.00] .* sz + pos(1:2);
2027
origin = [0.05, 0.06] + [0.00, 0.00] .* sz + pos(1:2) + off;
1989
2029
orient = "horizontal";
1991
sz = pos(3:4) - 0.16;
1992
origin = [0.08, 0.09] + [0.03, 0.05] .* sz + pos(1:2);
2032
origin = [0.08, 0.09] + [0.03, 0.05] .* sz + pos(1:2) + off;
1994
2034
orient = "horizontal";
1995
2035
case "eastoutside"
1996
sz = pos(3:4) - 0.08;
1997
origin = [0.00, 0.06] + [0.94, 0.00] .* sz + pos(1:2);
2037
origin = [0.00, 0.06] + [0.94, 0.00] .* sz + pos(1:2) + off;
1999
2039
orient = "vertical";
2001
sz = pos(3:4) - 0.16;
2002
origin = [0.09, 0.10] + [0.91, 0.01] .* sz + pos(1:2);
2042
origin = [0.09, 0.10] + [0.91, 0.01] .* sz + pos(1:2) + off;
2004
2044
orient = "vertical";
2005
2045
case "westoutside"
2006
sz = pos(3:4) - 0.08;
2007
origin = [0.00, 0.06] + [0.06, 0.00] .* sz + pos(1:2);
2047
origin = [0.00, 0.06] + [0.06, 0.00] .* sz + pos(1:2) + off;
2009
2049
orient = "vertical";
2011
sz = pos(3:4) - 0.16;
2012
origin = [0.06, 0.09] + [0.04, 0.03] .* sz + pos(1:2);
2052
origin = [0.06, 0.09] + [0.04, 0.03] .* sz + pos(1:2) + off;
2014
2054
orient = "vertical";