Digits, too many decimals

Hello !
I have a little problem, it prints too many digits... I have no idea how to fix it even after some research.
So here is how it looks like :

and here is the code for that part and above that I have put "options("digits"=3)", but it still doesn't change anything.

ggmoyVues=ggplot(tableauMoy, aes(x=Concepte, y=Vues, fill=Concepte))+
  theme_classic()+
  geom_bar(stat="identity")+
  theme(legend.position = "none")+
  ggtitle("Moyenne des vues de chaque concepte")+ylab("Vues (en million)")+xlab("")+
  theme(plot.title = element_text(face="bold", size=11))+
  geom_text(aes(label=Vues, accuracy = 0.01),position=position_dodge(width=0.9), vjust=-0.25)
ggmoyVues

I have a little idea of where does the mistake come from, I created a Matrix with all the datas I wanted and I converted it into a dataframe, so i had some values as in the photo (8.6777777 etc.), but, in the data frame I don't see more than 3 decimals because of options("digits"=3), but when I want to put these values above my chart it shows the "first version". I hope it's clear. So if you have any solution I take it !

Thank you beforehand for your help !

geom_text() has no accuracy argument and it is definitely not an aesthetic you can map inside aes(). I think you can do something like this

geom_text(aes(label = round(Vues, 2)), position = position_dodge(width = 0.9), vjust = -0.25)

If this doesn't solve your problem, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

1 Like

Wow the answer was so simple, well it worked ! Many thanks

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.