I'm trying to get different points color and enter the points of second file on x-axis in the same graph.
I have two different files which contains : (y-axis:D,A,Q,F ; x-axis: 1-5 and 6-10) 1.file enter image description here 2. file enter image description here
Then I wrote this code to draw :
set style data labels
xcoord(N)= (N)
ycoord(N) = (column(0)+1)
symbol(N) = strcol(N) ne "/" ? strcol(N) : "/"
set xrange [0:10]
set yrange [0:5]
set ytics ("D" 1, "A" 2, "Q" 3, "F" 4)
plot for [N=0:6] 'doc.txt' using (xcoord(N)):(ycoord(N)):(symbol(N)):(symbol(N)) w labels tc lt 7 font "Helvetica,12" notitle, \
for [N=0:6] 'doc1.txt' using (xcoord(N)):(ycoord(N)):(symbol(N)):(symbol(N)) w labels tc lt 1 font "Helvetica,10" notitle
and currently the output looks like this: graph of 1.file enter image description here graph of two data files enter image description here
As you can see, the all points are overlapping. I want to use different colors for /, 5, g, 3 and o and plot the points of second files in the x-axis 6-10. How can I do that? Can someone help in correcting my commands. Many thanks.
Not sure I understand the question fully, but to move the points from the second file over by six units on x you could modify the plot command to be:
plot for [N=0:6] 'doc.txt' using (xcoord(N)):(ycoord(N)):(symbol(N)):(symbol(N)) w labels tc lt 7 font "Helvetica,12" notitle, \
for [N=0:6] 'doc1.txt' using (6+xcoord(N)):(ycoord(N)):(symbol(N)):(symbol(N)) w labels tc lt 1 font "Helvetica,10" notitle
Can you clarify what color you want to use for the points? Your sample output does use a different color for the points in each file; is that not what you wanted?
Edit
I am making up a data format because you haven not shown any actual data, but perhaps the example below is enough to get you started.
$DATA << EOD
3 F / / 3 g 3
2 Q / / o / 5
1 A / o / / 5
0 D / / 5 / g
EOD
set xrange [0:7]
set yrange [-1:4]
set tics nomirror
set border 3
unset key
# These are the hexadecimal RGB representations of
# "red" "blue" "yellow" "green" "purple"
array colors = [0xFF0000, 0x0000FF, 0xFFFF00, 0x00FF00, 0xC080FF]
array symbol = ["/", "5", "g", "3", "o"]
color( sym ) = sum [i=1:5] (symbol[i] eq sym ? colors[i] : 0)
plot for [N=1:6] $DATA using (N) : (column(1)) : (strcol(N)) : (color(strcol(N))) \
with labels tc rgb variable font ":Bold"
Alternatively, you could do something with palette colors and numerical values rather than discrete RGB color names. That would be a different approach.