plotly adding a source or caption to a chart

前端 未结 1 1977
一生所求
一生所求 2020-12-19 05:34

Is there a way to add a data source / caption to a chart in Plotly, similar with what can be done in ggplot with the caption argument:

labs(capt         


        
相关标签:
1条回答
  • 2020-12-19 05:48

    annotation offers a simple way to add a caption to a chart in plotly:

    library(plotly)
    plot_ly(x=~hp, y=~mpg, data=mtcars, type="scatter", mode="marker") %>% 
     layout(annotations = 
     list(x = 1, y = -0.1, text = "Source: data I found somewhere.", 
          showarrow = F, xref='paper', yref='paper', 
          xanchor='right', yanchor='auto', xshift=0, yshift=0,
          font=list(size=15, color="red"))
     )
    

    .

    More details are given here and here.

    0 讨论(0)
提交回复
热议问题