"script_name", line 5: can only mod ints
Line 5 refers to:
plot "<data_file_name>" using
<column_number_1>:($<column_number_2>%<mod_base>) title '<title>' with
lines
The data of <column_number_2> does indeed solely consist of integers.
So, is this is a bug? Or do I have to provide some sort of casting to tell
gnuplot the data are integers.
Thank you,
Gert
> The data of <column_number_2> does indeed solely consist of integers.
You may know that, but gnuplot doesn't. You have to tell it, by
casting, like this:
plot 'datafile' using 1:(int($2) % 2)
--
Hans-Bernhard Broeker (bro...@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Thank you very much. I had looked into many online tutorials, but still
hadn't find any information about this casting.
Did I overlook the existence of a decent tutorial which does incorporate
these kind of manipulations (...and much more)?
Gert
> Did I overlook the existence of a decent tutorial which does incorporate
> these kind of manipulations (...and much more)?
I don't think so. You did overlook the actual gnuplot documentation,
though. To be more precise: "help expression", which says:
Note that gnuplot uses both "real" and "integer" arithmetic, like FORTRAN and
C. Integers are entered as "1", "-10", etc; reals as "1.0", "-10.0", "1e1",
3.5e-1, etc. The most important difference between the two forms is in
division: division of integers truncates: 5/2 = 2; division of reals does
not: 5.0/2.0 = 2.5. In mixed expressions, integers are "promoted" to reals
before evaluation: 5/2e0 = 2.5. The result of division of a negative integer
by a positive one may vary among compilers. Try a test like "print -5/2" to
determine if your system chooses -2 or -3 as the answer.
This explains why the problem occurs in the first place.
Well, actually, I did read this part of the documentation. So I understood
the nature of the problem. But the documentation didn't mention anything
about the possibility to perform casting.
Thanks anyway for pointing me out.
Greetings,
Gert