|
From: Thor A. <ta...@to...> - 2013-01-16 09:53:08
|
Hi,
I was under the impression that it is possible to plot only parts of a data
file with the ternary operator (?:), strcol() and missing ('?'), but I get
strange results.
My data file contains:
8<------8<------8<------8<------
cat << EOF > data
1 2 A
2 3 A
1 1 B
2 4 B
3 2 A
4 3 A
EOF
8<------8<------8<------8<------
Now if try to plot the lines with 'B' in the third column:
echo "set table; plot 'data' u 1:((strcol(3) eq 'B')? \$2 : '?')" | gnuplot
The result is:
8<------8<------8<------8<------
# Curve 0 of 1, 6 points
# Curve title: "'data' u 1:((strcol(3) eq 'B')? $2 : '?')"
# x y type
1 1.89869e-267 i
2 1.89869e-267 i
1 1 i
2 4 i
3 4 i
4 4 i
8<------8<------8<------8<------
Which is not what I expected. Am I doing it wrong or is this a bug?
The above was tested with a recent cvs version of Gnuplot.
gnuplot> show version long
G N U P L O T
Version 4.7 patchlevel 0 last modified 2013-01-08
Build System: Linux i686
Copyright (C) 1986-1993, 1998, 2004, 2007-2012
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
mailing list: gnu...@li...
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 = "/opt/stow/gnuplot/libexec/gnuplot/4.7"
GNUPLOT_PS_DIR = "/opt/stow/gnuplot/share/gnuplot/4.7/PostScript"
HELPFILE = "/opt/stow/gnuplot/share/gnuplot/4.7/gnuplot.gih"
--
best regards
Thor Andreassen
|