【发布时间】:2021-09-05 01:32:01
【问题描述】:
我的标题对齐在图表左侧不起作用。如何将标题左对齐。
我正在尝试在下面的图表中对齐标题,但对我不起作用请帮助我在这里缺少什么或我必须更新哪一行
df <- data.frame("LOC" =c("CA","NY","WA","TX"),
"TAX" = c(3421.00,5640.00,7880.32,4569.00))
ttl ="Tax collection"
g <- plot_ly(df, x =~TAX, y = ~ LOC, type = 'bar',width = 1200, height =900, showlegend=F
, text = ~paste0(roundUp(TAX*100), "%"), textposition = "outside",
marker = list(color = "blue"))
tit <- list(
text = ttl,
font = cht_ttl,
xref = "paper",
yref = "paper",
xanchor = "right",
x = 0.1,
y = 1,
showarrow = FALSE
)
ax <- list(
title = "",
showgrid = FALSE,
range = c(0, 1)
)
chart <- g %>% layout(annotations = tit,
xaxis = ax,
yaxis = list (title = " "),font=chrt_title, showline = TRUE)
chart
【问题讨论】:
-
请包含您正在使用的非基础包。
roundUp函数来自哪个包? -
roundup是自定义取整,刚刚更新
-
@RonakShah 所以在我的示例中,Tx 集合应该在左上角,但它在图表上方。