|
From: Jonathan T. <jt...@as...> - 2013-06-27 23:26:43
|
I'm using gnuplot 4.6.3, freshly compiled from the sourceforge tarball.
(See below for my full 'show version long' output.)
I'm trying to produce a log-scale plot with labels at the 1, 2, and 5
positions of each decade. Alas, If I use the
"label" posn level
form of 'set xtics' or 'set ytics', the label disappears for level 1
(minor) tics. For example,
set xtics (1, 2 1, "" 3 1, "" 4 1, 5 1, "" 6 1, "" 7 1, "" 8 1, "" 9 1, 10)
or
set xtics ("1" 1, "2" 2 1, "" 3 1, "" 4 1, "5" 5 1, "" 6 1, "" 7 1, "" 8 1, "" 9 1, "10" 10)
each produces a graph with the 2 and 5 labels missing (i.e., only 1 and
10 labels are present). This behavior is also present for a linear-scale
plot, i.e., the log-scale is actually irrelevant here (apart from providing
my original motivation).
This works
set xtics (1, 2, "" 3 1, "" 4 1, 5, "" 6 1, "" 7 1, "" 8 1, "" 9 1, 10)
and so does this
set xtics ("1" 1 0, "2" 2 0, "" 3 1, "" 4 1, "5" 5 0, "" 6 1, "" 7 1, "" 8 1, "" 9 1, "10" 10 0)
(in the sense that each of these gives labels 1, 2, 5, and 10)
but both of those have the 2 and 5 tics as level-0 (major) instead of
level-1 (minor).
More generally, I can find no way to put a label on a level-1 tic.
It seems to me that is a bug, or at best a mis-feature.
Is there a known workaround (apart from puttting the labels on by hand,
or using multiplot to superimpose another plot)?
Here's a full script to reproduce the problem; comment or uncomment
one of the 'set xtics' command as desired:
--- begin script ---
set xrange [1:10]
# these work (but have 2 and 5 as level 0 (major) tics
##set xtics (1, 2, "" 3 1, "" 4 1, 5, "" 6 1, "" 7 1, "" 8 1, "" 9 1, 10)
##set xtics ("1" 1 0, "2" 2 0, "" 3 1, "" 4 1, "5" 5 1, "" 6 1, "" 7 1, "" 8 1, "" 9 1, "10" 10 0)
# each of these omits the 2 and 5 labels
set xtics (1, 2 1, "" 3 1, "" 4 1, 5 1, "" 6 1, "" 7 1, "" 8 1, "" 9 1, 10)
##set xtics ("1" 1, "2" 2 1, "" 3 1, "" 4 1, "5" 5 1, "" 6 1, "" 7 1, "" 8 1, "" 9 1, "10" 10)
##set xtics ("1" 1 0, "2" 2 1, "" 3 1, "" 4 1, "5" 5 1, "" 6 1, "" 7 1, "" 8 1, "" 9 1, "10" 10 0)
plot sin(x)
--- end script ---
For completeness, here's my ~/.gnuplot file:
--- begin ~/.gnuplot ---
# gnuplot init file
set format "%g"
set term x11
set samples 1000
set style data lines
set zero 0.0
set xyplane 0.0
set clip two
set view ,,0.9
set view 30, 300
min(x,y) = (x < y) ? x : y
max(x,y) = (x > y) ? x : y
hypot(re,im) = sqrt(re**2 + im**2)
cnorm(re,im) = hypot(re,im)
fmod(x,y) = x - y*floor(x/y)
average(x,y) = x + 0.5*(y-x)
# map t in [0,1] --> [a,b]
map01(a,b,t) = a + t*(b-a)
--- end ~/.gnuplot ---
Here's my "show version long" output:
--- begin 'show version long' output ---
gnuplot> show version long
G N U P L O T
Version 4.6 patchlevel 3 last modified 2013-04-12
Build System: OpenBSD amd64
Copyright (C) 1986-1993, 1998, 2004, 2007-2013
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
faq, bugs, etc: type "help FAQ"
immediate help: type "help" (plot window: hit 'h')
Compile options:
-READLINE +LIBREADLINE -HISTORY
-BACKWARDS_COMPATIBILITY +BINARY_DATA
+GD_PNG +GD_JPEG +GD_TTF +GD_GIF +ANIMATION
-USE_CWDRC +X11 +X11_POLYGON +MULTIBYTE +X11_EXTERNAL +USE_MOUSE +HIDDEN3D_QUADTREE
+DATASTRINGS +HISTOGRAMS +OBJECTS +STRINGVARS +MACROS +IMAGE +USER_LINETYPES +STATS
GNUPLOT_DRIVER_DIR = "/usr/local/libexec/gnuplot/4.6"
GNUPLOT_PS_DIR = "/usr/local/share/gnuplot/4.6/PostScript"
HELPFILE = "/usr/local/share/gnuplot/4.6/gnuplot.gih"
gnuplot>
--- end 'show version long' output ---
ciao,
--
-- "Jonathan Thornburg [remove -animal to reply]" <jt...@as...>
Dept of Astronomy & IUCSS, Indiana University, Bloomington, Indiana, USA
on sabbatical in Canada through late August 2013
"There was of course no way of knowing whether you were being watched
at any given moment. How often, or on what system, the Thought Police
plugged in on any individual wire was guesswork. It was even conceivable
that they watched everybody all the time." -- George Orwell, "1984"
|