I have the following data frame (df1)
which i generated a geom_tile
plot from it.
X Y Z
1 1 0.343
5 4 0.134
10 6 0.564
20 8 0.532
40 9 0.235
46 12 0.425
and i have another data frame which i want to use to draw the lines (df2)
:
a b c d
1 1 0.05 good
5 4 0.01 better
10 6 0.03 middle
20 8 0.1 bad
40 9 0.2 bad
46 12 0.22 bad
so the idea, is that a
and X
are the same and b
and Y
are the same values.
what i want to do is to draw some lines around the geom_tile
areas depending on the value of d
in df2
. so in each different area there will be a different color line e.g (good is red, better is blue, ...)
i tried to use geom_contour
but the problem it draws lines in a very ugly way and i wasn't able to specify coordinates in a good way ..
Note
- some areas might not be in straight lines
- data frames are bigger, this is a test data to explain the idea