簡體   English   中英

如何在使用R中的plot_ly創建的餅圖中刪除百分比標簽

[英]How to remove percentage labels in a pie chart created using plot_ly in R

library(plotly)
ds <- data.frame(labels = c("A", "B", "C"), values = c(10, 40, 60))
plot_ly(ds, labels = labels, values = values, type = "pie") %>%
layout(title = "Basic Pie Chart using Plotly")

我想刪除在餅圖中顯示的百分比標簽。

基於R圖表屬性參考 ,必須將textinfo屬性設置為none

plot_ly(ds, labels = labels, values = values, type = "pie", textinfo = "none")

應該這樣做:

library(plotly)
ds <- data.frame(labels = c("A", "B", "C"), values = c(10, 40, 60))
plot_ly(ds, labels = labels, values = values, type = "pie", textinfo= "text", text="") %>%
  layout(title = "Basic Pie Chart using Plotly")

如果要標記,可以在text =“”中填寫信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM