Home > Software engineering >  Is there a simple way to change the plot axis decimal indicator from point to comma in base R?
Is there a simple way to change the plot axis decimal indicator from point to comma in base R?

Time:11-24

I am making this simple plot

plot(data.frame(a=c(0.5,1,1.5,2,2.5,3,3.5,4),
                 b=c(0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08)))

I´ve seem lots off questions about how to make the axis decimal indicator a comma on ggplot2, but didn't find any on base R. I'm thinking something that adjust to the axis scale if the range of the data changes. I know one could use xaxt = "n" and paste the values as text but wonder how that works with diferent ranges Regards.

CodePudding user response:

You can use options(OutDec = ",").

plot(data.frame(a=c(0.5,1,1.5,2,2.5,3,3.5,4),
                b=c(0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08)))

enter image description here

  •  Tags:  
  • r
  • Related