1

I have created this sort of heatmap, but I need it to look smoother than like this enter image description here

code:

    ggplot(data = DF_with0, aes(V1, V2, fill = V3)) +                                                                           
     geom_tile() +
     xlab("X Coordinate (feet)") + ylab("Y Coordinate (feet)") +
     scale_fill_gradient(limits = c(0, 100), low = "black", high = "red") +
     scale_x_continuous(expand = c(0,0)) +
     scale_y_continuous(expand = c(0,0))

ideally I want it to look like this: enter image description here

Is there any fast way or library that I should know? Maybe I am missing something (I am quite noob).

My data frame looks like that:

enter image description here Where the V1 and the x-axis, V2 the y-axis and V3 are the values for the color filling.

Thanks in advance to everyone!

william3031
  • 1,653
  • 1
  • 18
  • 39
puppeschi
  • 11
  • 1
  • Next time, provide a reproducible example instead of a screenshot of your dataset: https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – william3031 Jan 21 '22 at 03:57

1 Answers1

0

Try geom_raster with interpolate = TRUE instead of geom_tile.

geoff
  • 942
  • 5
  • 13
  • In this way I am just blurring the image, not getting a better figure, sadly. – puppeschi Jan 13 '22 at 13:05
  • At some point the limit is just the resolution of your data. Example 2. you linked just includes significantly more data than example 1. and that's really all there is to it. Interpolation can help fill in the blanks but as you said it'll be blurry by nature. – geoff Jan 15 '22 at 13:12
  • Makes sense! Thank you! – puppeschi Jan 17 '22 at 21:51