0

I'm attempting to plot a categorical variable on the x axis and a time on the y axis. I also have a categorical variable called run used to set line colour.

I have a time object created using the hms package object on the y axis. Even after stripping the ms from this object, they come back in when creating plots in ggplot.

enter image description here

ggplot(df, aes(x = category,y=plot_real_time),group = run,colour=run)) + 
  geom_line(linewidth=2)

creates the above plot. I don't need the .0000000 at the end.

E. Rei
  • 125
  • 4
  • 1
    It would be easier to help you if you provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including a snippet of your data or some fake data. – stefan Aug 15 '23 at 11:40
  • Your y-axis may be categorical (strings), not a real "time" value. I think you need to convert it to something numeric, perhaps POSIXt, and then use `scale_y_datetime(date_labels="%H:%M:%S")` or similar. – r2evans Aug 15 '23 at 12:21

0 Answers0