【发布时间】:2020-09-14 11:27:26
【问题描述】:
我想增加 plotly 图形上文本注释的大小。我想出的解决方案是在下面的最小代码上。但是,一旦位数通过该值增加,则文本的字体大小不会以相同的方式应用于所有位数成员。为了向大家展示实际问题,我准备了一个伪输入数据,所以请不要专注于为什么要显示一些愚蠢的数字。这个问题看起来很小,但它严重影响了我波动的数据可视化,这些可视化在序列中具有各种深度和最高值。有什么想法吗?
最少的代码
library(plotly)
df <- read.csv("https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv", stringsAsFactors = FALSE)
df <- df[which(df$year==2007 & df$continent=='Europe' & df$pop > 2.e6),]
#pseudo input data
temp_data <- c(c(1:5, 10:15, 100:105, 1000:1010))
fig <- plot_ly(df, type='bar', x = ~country, y = temp_data, text = temp_data, name="",
textposition = 'outside', #'auto'
textangle = -90,
textfont = list(size = 120)
)
fig
电流输出
期望是这样的
【问题讨论】:
标签: r graphics annotations font-size r-plotly