Reputation: 437
I'm plotting data from different files in the same graph using the normal command:
> plot "foo1" title1..., \
> "foo2" title2...
Say that some points from foo2 overlap with others in foo1. So as foo2 is the last to be plotted, the overlapping data from it will cover those of foo1 (I'm choosing different colors for both of them). Now, I need the data to be arranged from title1 to title2, hence I plot foo1 then foo2, but I also need the data from foo1 to appear above the overlapping data from foo2.
Is there a way to do this?
I hope my question is clear.
Upvotes: 4
Views: 1172
Reputation: 2647
gnuplot> set key invert
gnuplot> plot x title "title2", -2*x title "title1"
will list the key in inverted order
title1
title2
but draws foo1 on top of foo2.
Upvotes: 0
Reputation: 15910
Unfortunately you can't change the stacking order of the data directly. However, you can try something like this (if I understand your issue correctly):
plot NaN title 'title1', \
'foo2' title 'title2', \
'foo1' notitle lt 1
The first plot command does not plot anything, but it adds the proper title and line style to the legend. (Note that plotting NaN
only works if the x and y ranges are set somehow, in this case by the rest of the data being plotted.) The second command (after the comma) plots the second set of data normally. The third line plots the first set of data on top of the second, and uses lt 1
to match the linetype of the entry in the legend.
(The extra spaces are just so things line up nicely.)
Upvotes: 3