I want to create a bar-chart where the y-axis uses "min:sec" as labels. However, the data I want to display has seconds as units. What is now the best approach to do this?
zone time_in_zone
1 305
2 664
3 1945
4 1187
I would plot this data using:
ggplot(data, aes(fill=zone, y=time_in_zone, x=zone))+
geom_bar(stat="identity")
However, I fail converting the y-axis to a meaningful time series.
You can add scale_y_time
to your plot like this...
ggplot(data, aes(fill=zone, y=time_in_zone, x=zone))+
geom_bar(stat="identity") +
scale_y_time()
Which should give you a time formatted y axis like this...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With