Hi!
I have been trying to create a barplot with a variety of features, including a limit on the y axis. However, I keep getting an error in aesthetics. This is the code and the error:
ggplot(CrownVolume1, aes(x=Art., y=Crown_volume_May, fill=Art., ylim = c(0, 30)))+
geom_bar(stat="identity") +
labs(title = "May CVP",
x = "Species",
y = "CVP (m³)")
Error in
check_aesthetics()
:
! Aesthetics must be either length 1 or the same as the data (9): ylim
Runrlang::last_error()
to see where the error occurred.
Backtrace:
- base (local)
<fn>
(x) - ggplot2:::print.ggplot(x)
- ggplot2:::ggplot_build.ggplot(x)
- ggplot2 (local) by_layer(function(l, d) l$compute_aesthetics(d, plot))
- ggplot2 (local) f(l = layers[[i]], d = data[[i]])
- l$compute_aesthetics(d, plot)
- ggplot2 (local) f(..., self = self)
- ggplot2:::check_aesthetics(evaled, n)
Runrlang::last_trace()
to see the full context.
rlang::last_trace()
<error/rlang_error>
Error incheck_aesthetics()
:
! Aesthetics must be either length 1 or the same as the data (9): ylim
Backtrace:
▆
- ├─base (local)
<fn>
(x) - └─ggplot2:::print.ggplot(x)
- ├─ggplot2::ggplot_build(x)
- └─ggplot2:::ggplot_build.ggplot(x)
-
└─ggplot2 (local) by_layer(function(l, d) l$compute_aesthetics(d, plot))
-
└─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
-
└─l$compute_aesthetics(d, plot)
-
└─ggplot2 (local) f(..., self = self)
-
└─ggplot2:::check_aesthetics(evaled, n)
-
└─rlang::abort(...)