ggplot_error: incomplete expression

Hi everyone,

I am trying to plot a chart with ggplot but I am getting an error. Thanks in advance!!

library(cowplot)

energy_types_longer%>%
ggplot (aes(x = "year", y= "gigawatts", group = country) +
geom_line(color = "steelblue", size = 0.8) +
geom_point( shape= "21", fill="steelblue", size= 2)+
facet_wrap(~ type, scales = "free_y")+
scale_y_continuous(labels = scales::comma)+
theme_minimal_hgrid()

Error: Incomplete expression:
energy_types_longer%>%
ggplot (aes(x = "year", y= "gigawatts", group = country) +
geom_line(color = "steelblue", size = 0.8) +
geom_point( shape= "21", fill="steelblue", size= 2)+
facet_wrap(~ type, scales = "free_y")+
scale_y_continuous(labels = scales::comma)+
theme_minimal_hgrid()

After correcting the unbalanced brackets, ..still giving me an error...

energy_types_longer%>%
ggplot (aes(x = "year", y= "gigawatts", group = country)) +
geom_line(color = "steelblue", size = 0.8) +
geom_point( shape= "21", fill="steelblue", size= 2)+
facet_wrap(~ type, scales = "free_y")+
scale_y_continuous(labels = scales::comma)+
theme_minimal_hgrid()

Error: Discrete value supplied to continuous scale

Can you provide a reproducible example?

You need another ) in the second row. It should be
ggplot (aes(x = "year", y= "gigawatts", group = country)) +

thanks, I just change it but still is giving me an error....
Now it says:

Error: Discrete value supplied to continuous scale

Unbalanced brackets.
Two open, 1 close

Hi, finally it works,...aes was missing and, year and gigawatts should not have "".

Many thanks !!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.