error appeared when trying out the geom_ribbon function

20 Views Asked by At

I am trying to create a geom_ribbon chart, but the plot only shows the axes, without the plots.

The codes I wrote:

install.packages("tidyverse")
library("tidyverse")
data("diamonds")

ggplot() +
  geom_ribbon(data=diamonds,
    mapping = aes(
      y=carat,x=cut,
    ymin = min(carat),
    ymax = max(carat)
    ), fill = "blue"
  )

The result I got: enter image description here I would like to know where went wrong. Thanks.

I tried to get help from https://mpn.metworx.com/packages/ggplot2/3.3.0/reference/geom_ribbon.html but could not relate the examples to my own problem.

0

There are 0 best solutions below