uRosConf/voronoiTreemap

Error in "Node" %in% class(node) : is_scalar_character(total_lab) is not TRUE

Closed this issue · 3 comments

Hi there,
first of all, thanks for the wonderful tool!
I tried to use it with my own dataset, but I am getting the following error:

Error in "Node" %in% class(node) : 
  is_scalar_character(total_lab) is not TRUE

The dataframe looks like this:

Proteobacteria Alphaproteobacteria Parvularculales   #FCCDE5   1.04 Parvularculales  
Proteobacteria Oligoflexia Bdellovibrionales       #FCCEE5   3.12 Bdellovibrionales  
[...]

I tried to format it as your example file (canada).
Column 1 to 4 & 6 are character columns (called 'h1' 'h2' 'h3' 'color' 'codes'). Column 5 is numeric (called 'weight') and contains a percent value (the sum of this column is 100).

At the very first step:
canadaH <- vt_export_json(vt_input_from_df(data_sum,scaleToPerc = F))
I get the error. Any idea why?

Hi Sarah,
I don't see the problem immediately.
But we had the improvement of vt_input_from_df on our radar anyway, so I added new parameters to it, where you have to explicitly name the columns containing the information. So if you install the github development version devtools::install_github("uRosConf/voronoiTreemap") and try the new version of the function vt_input_from_df it would be great.

If the problem still exists, can you provide me with a dummy data set and the code you use.

It works now with the new version!
However, I fail in saving the plot to pdf or png by using

pdf("plot.pdf")
vt_d3(canadaH, label=T,width = 900,height = 900, color_border = "#000000", size_border = "2px", legend = TRUE, legend_title = "Class", seed = 5)
dev.off()

Do you have an idea how to save it otherwise?

The function generates a htmlwidget and not a regular graph, so there are two options either

  • use 'save as html' in Rstudio and then open it in Chrome and print to pdf
  • or you can use the webshot package