I'm plotting my data in a heatmap. Some of the data of the fill is positive and some is negative. I would like to plot a line over the heatmap that separates what is positive and what is negative.
I have looked up and tried using geom_contour, but couldn't figure out if there was an argument where to introduce the condition fill>0 or something like that. this is my current plot.
I would like a line that separates positive fron negative tiles like this
but keeping the color gradient of the oiginal, just plotting a line that separates both spaces.


You can compute in a separate dataframe the threshold of
yabove which the fill value is positive and add it to your plot withgeom_step():Reproducible example
Compute the steps
Plot