Issue with timestamp on x axis -- ggplot/plotly

Hello, I am writing a simple ggplot and geom_bar command insider a renderPlotly function in my shiny app. The x variable is a timestamp, which in my data is stored as chr "2020-03-10 15:13:22". When I plot this, the x axis labels now read as "50", "100"...this is weird and I have tried multiple ways to overcome this but nothing seems to work. I am basically not being able to see the timestamp label on x axis for each bar. I would appreciate your help.

I haven't used shiny, but am wondering whether changing the data type of your timestamp to datetime might help. You could load the lubridate package and then use as_datetime() to convert the column from character to datetime. Does that help?

Thank you for your response @dromano. I tried that and it changes the type of the timestamp to POSIXct, format: "2020-03-10 15:13:22". Then when I plot through plotly and ggplot it once again unfortunately reformats the timestamp to "1.5456B" for example and in fact doesn't show the bar. @andresrcs do you have any idea? I hope you don't mind me reaching out. I know you've been super helpful with shiny before :smile:
Thank you again @dromano

Can you provide a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one for a shiny app

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.