【问题标题】:Sunburst R not showing all depth or sequence levelsSunburst R not showing all depth or sequence levels
【发布时间】:2022-12-01 19:00:28
【问题描述】:

I am trying to create a sunburst plot in R but the depth of all threads are not visible. What am I doing wrong? I know there are some cases which have 3 levels = A->B->C and also A->B->C->D, but those are being ignored.

#install.packages("sunburstR")
library(sunburstR)

#read in the .csv file to a data frame
path_data <- read.csv(
  "democopy.csv"
  ,header=T
  ,stringsAsFactors = FALSE
)

#select the 2 columns needed for the visualisation
df <- path_data[c('paths','numbers')]

#create sunburst visualisation
sunburst(df,percent=TRUE,count=TRUE,colors=c("#4D9DE0","#3BB273","#E1BC29","#7768AE","#E15554"), height=700, width=700)'''

【问题讨论】:

    标签: r sunburst-diagram


    【解决方案1】:

    Did you manage to solve this problem ?

    I have the same problem, but when I filter my data to the "paths" above a certain depth (e.g, 4), they do appear on the plot.

    Have you tried something like this ?

    import stringr
    df$path_depth= str_count(df$paths, "-") + 1 # I assume the separator is "-"
    sunburst(df[df$path_depth>=3,])
    

    I have used the sunburst function for quite a while, but it is the first time something like this has occured. Maybe there is a default filter for the depths that are very rare among all the sequences.

    【讨论】:

      猜你喜欢
      • 2022-12-26
      • 2021-08-13
      • 2020-06-28
      • 1970-01-01
      • 2015-04-18
      • 2022-12-02
      • 2022-11-09
      • 2022-12-01
      • 2022-12-27
      相关资源
      最近更新 更多