[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: minor ticks
From: |
David Bateman |
Subject: |
Re: minor ticks |
Date: |
Fri, 14 Nov 2008 11:51:50 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.17 (X11/20081018) |
address@hidden wrote:
Hello,
How can I get minor ticks on an axis in my plot? I don't want any gridlines.
Thank you,
Tobias
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
In Octave 3.0.x you can't, as the axis property for minor ticks isn't
implemented.. In 3.1.51+ it is implemented in the axis, but the gnuplot
backend doesn't respect it. The attached patch addresses that. With this
patch you can do something like
plot(1:10)
set (gca(), "XMinorTick", "on")
Regards
David
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
# HG changeset patch
# User David Bateman <address@hidden>
# Date 1226659675 -3600
# Node ID 9061a7241685c80d2b6b91e0b02a7f32d0a67f24
# Parent 629acb84f3e6ba3ceea2d9fbc2cdcd2ae09b0668
Respect the minortick property of the axis objects
diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-12 David Bateman <address@hidden>
+
+ * plot/__go_draw_axes__.m (do_tics_1): Support the minorick properties
+ of the axis object.
+
2008-11-12 David Bateman <address@hidden>
* plot/__quiver__.m: Only autoscale if more than one element to
diff --git a/scripts/plot/__go_draw_axes__.m b/scripts/plot/__go_draw_axes__.m
--- a/scripts/plot/__go_draw_axes__.m
+++ b/scripts/plot/__go_draw_axes__.m
@@ -1379,55 +1379,55 @@
[fontname, fontsize] = get_fontname_and_size (obj);
if (strcmpi (obj.xaxislocation, "top"))
- do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
- obj.xcolor, "x2", plot_stream, true, mono, "border",
- obj.tickdir, fontname, fontsize, obj.interpreter);
- do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
+ do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+ obj.xticklabel, obj.xcolor, "x2", plot_stream, true, mono,
+ "border", obj.tickdir, fontname, fontsize, obj.interpreter);
+ do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
obj.xcolor, "x", plot_stream, true, mono, "border",
"", fontname, fontsize, obj.interpreter);
elseif (strcmpi (obj.xaxislocation, "zero"))
- do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
- obj.xcolor, "x", plot_stream, true, mono, "axis",
- obj.tickdir, fontname, fontsize, obj.interpreter);
- do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
+ do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+ obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
+ "axis", obj.tickdir, fontname, fontsize, obj.interpreter);
+ do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
obj.xcolor, "x2", plot_stream, true, mono, "axis",
"", fontname, fontsize, obj.interpreter);
else
- do_tics_1 (obj.xtickmode, obj.xtick, obj.xticklabelmode, obj.xticklabel,
- obj.xcolor, "x", plot_stream, true, mono, "border",
- obj.tickdir, fontname, fontsize, obj.interpreter);
- do_tics_1 ("manual", [], obj.xticklabelmode, obj.xticklabel,
+ do_tics_1 (obj.xtickmode, obj.xtick, obj.xminortick, obj.xticklabelmode,
+ obj.xticklabel, obj.xcolor, "x", plot_stream, true, mono,
+ "border", obj.tickdir, fontname, fontsize, obj.interpreter);
+ do_tics_1 ("manual", [], "off", obj.xticklabelmode, obj.xticklabel,
obj.xcolor, "x2", plot_stream, true, mono, "border",
"", fontname, fontsize, obj.interpreter);
endif
if (strcmpi (obj.yaxislocation, "right"))
- do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
- obj.ycolor, "y2", plot_stream, ymirror, mono, "border",
- obj.tickdir, fontname, fontsize, obj.interpreter);
- do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
+ do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+ obj.yticklabel, obj.ycolor, "y2", plot_stream, ymirror, mono,
+ "border", obj.tickdir, fontname, fontsize, obj.interpreter);
+ do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
obj.ycolor, "y", plot_stream, ymirror, mono, "border",
"", fontname, fontsize, obj.interpreter);
elseif (strcmpi (obj.xaxislocation, "zero"))
- do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
- obj.ycolor, "y", plot_stream, ymirror, mono, "axis",
- obj.tickdir, fontname, fontsize, obj.interpreter);
- do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
+ do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+ obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
+ "axis", obj.tickdir, fontname, fontsize, obj.interpreter);
+ do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
obj.ycolor, "y2", plot_stream, ymirror, mono, "axis",
"", fontname, fontsize, obj.interpreter);
else
- do_tics_1 (obj.ytickmode, obj.ytick, obj.yticklabelmode, obj.yticklabel,
- obj.ycolor, "y", plot_stream, ymirror, mono, "border",
- obj.tickdir, fontname, fontsize, obj.interpreter);
- do_tics_1 ("manual", [], obj.yticklabelmode, obj.yticklabel,
+ do_tics_1 (obj.ytickmode, obj.ytick, obj.yminortick, obj.yticklabelmode,
+ obj.yticklabel, obj.ycolor, "y", plot_stream, ymirror, mono,
+ "border", obj.tickdir, fontname, fontsize, obj.interpreter);
+ do_tics_1 ("manual", [], "off", obj.yticklabelmode, obj.yticklabel,
obj.ycolor, "y2", plot_stream, ymirror, mono, "border",
"", fontname, fontsize, obj.interpreter);
endif
- do_tics_1 (obj.ztickmode, obj.ztick, obj.zticklabelmode, obj.zticklabel,
- obj.zcolor, "z", plot_stream, true, mono, "border",
- obj.tickdir, fontname, fontsize, obj.interpreter);
+ do_tics_1 (obj.ztickmode, obj.ztick, obj.zminortick, obj.zticklabelmode,
+ obj.zticklabel, obj.zcolor, "z", plot_stream, true, mono,
+ "border", obj.tickdir, fontname, fontsize, obj.interpreter);
endfunction
-function do_tics_1 (ticmode, tics, labelmode, labels, color, ax,
+function do_tics_1 (ticmode, tics, mtics, labelmode, labels, color, ax,
plot_stream, mirror, mono, axispos, tickdir,
fontname, fontsize, interpreter)
persistent warned_latex = false;
@@ -1449,7 +1449,7 @@
colorspec = get_text_colorspec (color, mono);
if (strcmpi (ticmode, "manual") || strcmpi (labelmode, "manual"))
if (isempty (tics))
- fprintf (plot_stream, "unset %stics;\n", ax);
+ fprintf (plot_stream, "unset %stics;\nunset m%stics;\n", ax, ax);
elseif (strcmpi (labelmode, "manual") && ! isempty (labels))
if (ischar (labels))
labels = cellstr (labels);
@@ -1466,6 +1466,7 @@
fprintf (plot_stream, "set %stics %s %s nomirror (", ax,
tickdir, axispos);
endif
+
labels = regexprep(labels, "%", "%%");
for i = 1:ntics
fprintf (plot_stream, " \"%s\" %.15g", labels{k++}, tics(i));
@@ -1477,7 +1478,12 @@
endif
endfor
fprintf (plot_stream, ") %s %s;\n", colorspec, fontspec);
- else
+ if (strcmp (mtics, "on"))
+ fprintf (plot_stream, "set m%stics 5;\n", ax);
+ else
+ fprintf (plot_stream, "unset m%stics;\n", ax);
+ endif
+ else
error ("unsupported type of ticklabel");
endif
else
@@ -1491,6 +1497,11 @@
endif
fprintf (plot_stream, " %.15g,", tics(1:end-1));
fprintf (plot_stream, " %.15g) %s;\n", tics(end), fontspec);
+ if (strcmp (mtics, "on"))
+ fprintf (plot_stream, "set m%stics 5;\n", ax);
+ else
+ fprintf (plot_stream, "unset m%stics;\n", ax);
+ endif
endif
else
fprintf (plot_stream, "set format %s \"%%g\";\n", ax);
@@ -1500,6 +1511,11 @@
else
fprintf (plot_stream, "set %stics %s %s nomirror %s %s;\n", ax,
tickdir, axispos, colorspec, fontspec);
+ endif
+ if (strcmp (mtics, "on"))
+ fprintf (plot_stream, "set m%stics 5;\n", ax);
+ else
+ fprintf (plot_stream, "unset m%stics;\n", ax);
endif
endif
endfunction