1

Trying to plot density map based on values in a csv file. The csv data is of the format LAT,LONG,VALUE.

**How do I restrict the density contour plotting only to inside the shape of the region obtained from the shape file (which is shown red here). It should not extend to the whole rectangular box, but remain inside the shape.

Harsh Pensi
  • 113
  • 7
  • 1
    Can you make a minimal reproducible example? – Axeman Dec 24 '15 at 11:47
  • Minimal question would be - How do i restrict geom_density2d and stat_density2d to be plotted only inside the shape file region obtained from ap.geojson file. I have used geom_tile to plot the shape file , but the density plot only overlaps this and is not limited by it in any way. The density plot continues to be in the whole rectangular box. – Harsh Pensi Dec 24 '15 at 12:05
  • 1
    I can tell you why it is all green, you have mapped `fill` twice, once to `1`, and once to `..level..`. Density estimates will sum up to one, and in each location they will generally be very small (i.e. close to 0). This means they will be green. If you add a [minimal reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), I can try to help with the rest. – Axeman Dec 24 '15 at 15:01
  • 1
    As mentioned before without a minimal reproducible example it is difficult to help. Nevertheless [this answer](http://stackoverflow.com/a/28135845/3184024) might be of use to you. – wici Dec 24 '15 at 21:55

0 Answers0