Error: unexpected symbol in: " scale_alpha_continuous(labels = scales::percent_format(accuracy = 1),limits = c(0,0.33)) p"

p <- ggplot(as.data=data_p, mapping = aes(x = vote/100, y = party_name2, fill = factor(year),
group = party_name2, color = party_name2))

p + geom_bar(stat = "identity", position = position_dodge2(width = 0.9, preserve = "single")) +
geom_col() +
geom_text(size=2.3,color="black",position = position_dodge2(width = 0.9,preserve = "single"),hjust = -0.1,
mapping = aes(label = scales::percent(vote/100,accuracy=0.1)) +

labs(title = "Fylgi flokkanna í Alþingiskosningum 2009-2017",y = NULL,x = NULL,fill = "Flokkar") +

geom_col() + scale_color_manual(values=c("#808080", "#92278F", "#FF8C00", "#FFCA3E", "#A0D067", "#002169", "#512483", "#EA0038", "#00ADEF", "#FF7D14", "#00B878")) +

scale_fill_manual("#101010","#404040","#707070","#909090") +
scale_alpha_continuous(labels = scales::percent_format(accuracy = 1),limits = c(0,0.33))
..........................................................................................................................................................................

Sometimes this code runs but doesn't show a graph and sometimes this error comes up: Error: unexpected symbol in:
" scale_alpha_continuous(labels = scales::percent_format(accuracy = 1),limits = c(0,0.33))
p"
..........................................................................................................................................................................
I have it connected to google sheets. What can I do to make the code work and the graph show?

Hi Þorsteinn:

Without a reprex it's difficult look for the code which produce the error.

Maybe you have experiencing one of these problems? https://stackoverflow.com/a/25889235. Maybe you forget made enter between the last line of this code and the next expression?

I visited the reference page for scale_alpha_continuous()function. Maybe you are writing limits() instead of range()?

scale_alpha_continuous(labels = scales::percent_format(accuracy = 1), range = c(0, 0.33))

Hope that helps.

Greetings.

This topic was automatically closed 21 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.