I want to plot m*n
matrix, each element of which is an rgb
triple, like in the following gnuplot code snippet (rgb matrix of 3*3
):
$cross << EODcross
255 0 0 0 0 0 255 0 0
0 0 0 0 0 0 0 0 0
255 0 0 0 0 0 255 0 0
EODcross
Black cross on red background. I can change delimiters between columns and color components, if needed.
Can I achieve the desired avoiding set palette rgbformulae i,j,k
and directly using $cross
data? Something like:
plot '$cross' matrix with image rgb
If not, I can pass 24bit-wide integers (of course, in textual representation, i.e. precalculated and converted to text r + 256 * (g + 256 * b)
or b + 256 * (g + 256 * r)
value). How should i,j,k
triple looks like to correctly map rgb
value represented in mentioned form to palette color space?
The
rgbimage
plotting style expects five columns, the last three give red, blue and green values in the range [0:255]. So you can use any 24-bit integer representation of the colors, because you must extract the color channels yourself when plotting:It seems that ascii matrix data and rgbimage do not fit together.
If you are free to format your input data, then put each column of the image into a single block, separating the blocks by two blank lines like this:
Then plot the cross like this:
The numbers -2 and 0 in the
using
section correspond to the pseudo columns "block index" and "line within a block", respectively. They are used as x and y values. Theplot with rgbimage
style requiresx,y,r,g,b
data.This is the result: