0

ggplot(data=raster)+geom_raster(aes(x=x,y=y,fill=elevation))

now the legend by the plot, does not show the numbers for min and max values? what is the solution??

Ali Abd
  • 11
  • 3
  • Does that answer your question: https://stackoverflow.com/questions/62842840/setting-min-max-size-in-legend-in-ggplot –  Aug 22 '22 at 20:33
  • Could you maybe share a picture pf the legend –  Aug 22 '22 at 20:34
  • 2
    @AliAbd, in your three previous questions, you've received repeated comments asking you to provide a more reproducible question: no sample data, and often no plot or pictorial indication of what you think is wrong. ***Please*** see https://stackoverflow.com/q/5963269, [mcve], and https://stackoverflow.com/tags/r/info for discussion on how to ask questions in a way that greatly simplifies helping you (and therefore improves the chances you'll get a fast and useful answer). – r2evans Aug 22 '22 at 20:39
  • I don't understand why you fill geom_raster() –  Aug 22 '22 at 20:41

1 Answers1

0

You can use the following code for show max and min

ggp <- ggplot(raster, aes(x, y, color = elevation)) +   
  geom_point() 

And then add if you want replace the numbers by max and min

ggp +                                       
  scale_color_continuous(breaks = c(min(raster$y),
                                    mean(raster$y),
                                    max(raster$y)),
                         labels = c("Min",
                                    "Mean",
                                    "Max"))

I hope is right, because I don't have any data to check it