R中密度图上的数字而不是日期

时间:2018-05-02 19:52:59

标签: r plotly density-plot r-plotly ggplotly

我有问题。我试图用.as-console-wrapper { max-height: 100% !important; top: 0; }包在R中绘制密度图。但当我将鼠标悬停在情节上时,我得到日期17623的数字格式,而不是2018-04-02。任何想法如何解决这个问题?

plotly

enter image description here

1 个答案:

答案 0 :(得分:1)

基于此:how to choose variable to display in tooltip when using ggplotly?

你可以试试这个:

density_plot = ggplot(dataTable, aes(x=Date, y = Value, label1= Date, label2 = Value)) +
  geom_density(stat="identity", fill = "#4156C5") + 
  labs(fill = "Value", x = "Date", y = "Frequency")

ggplotly(density_plot, tooltip = c("label1", "label2"))

enter image description here