简体   繁体   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")

I want to remove the percentage labels getting displayed over the pie chart. 我想删除在饼图中显示的百分比标签。

基于R图表属性参考 ,必须将textinfo属性设置为none

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

This should do: 应该这样做:

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")

If you want to label you can fill information in text="". 如果要标记,可以在text =“”中填写信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM