The 4th column is a 24 bit RGB color value.
I have tried to set up the appropriate splot command, but I have been unable to get the plot line to satisfactorily display the data
% splot "data" using 1:2:3:4 with dots lw 5 rgbcolor variable
for example
What would be the correct way to do the splot line?
Thank you for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think your plot isn’t working as expected due to two key points that need a small adjustment.
1. Use of "rgbcolor variable":
To specify point colors, you should use the linecolor option (abbreviated as lc) together with "rgbcolor variable". So make sure your plot command includes something like:
lcrgbcolorvariable
2. Handling of the fourth column in "using":
In your data, the fourth column appears to be a hexadecimal color code in double quotes, like "0xFF0000". Gnuplot treats this as a string. However, when using "lc rgbcolor variable", Gnuplot expects a numeric color value (an integer).
To fix this, you can explicitly convert the string to an integer using "int(strcol(4))", like this:
I am trying to use splot to display 3 dimension data, with a colorspec in the 4th column.
For example, the first three lines of my "data" file read:
The 4th column is a 24 bit RGB color value.
I have tried to set up the appropriate splot command, but I have been unable to get the plot line to satisfactorily display the data
% splot "data" using 1:2:3:4 with dots lw 5 rgbcolor variable
for example
What would be the correct way to do the splot line?
Thank you for your help.
I think your plot isn’t working as expected due to two key points that need a small adjustment.
1. Use of "rgbcolor variable":
To specify point colors, you should use the
linecolor
option (abbreviated aslc
) together with "rgbcolor variable". So make sure your plot command includes something like:2. Handling of the fourth column in "using":
In your data, the fourth column appears to be a hexadecimal color code in double quotes, like
"0xFF0000"
. Gnuplot treats this as a string. However, when using "lc rgbcolor variable", Gnuplot expects a numeric color value (an integer).To fix this, you can explicitly convert the string to an integer using "int(strcol(4))", like this:
Alternatively, if you're generating the data yourself, it's even better to write the color codes as unquoted numeric literals:
With that format, the following will work just fine:
Hope this helps.