LDAvis icon indicating copy to clipboard operation
LDAvis copied to clipboard

How would I plot the intertopic distance in ggplot?

Open norseghost opened this issue 3 years ago • 1 comments

Well, the title says it all. I find the intertopic distance map quite useful in demonstrating how diverse (or not) a set of documents may be; but I'd quite like to run it through ggplot.

Any pointers? If all else fails, I can screenshot the plot and include it that way; but eeew :)

norseghost avatar Sep 12 '20 22:09 norseghost

Not sure if this is still relevant but I found that you can access the plotting data through the json. Something like this worked for me:

json_obj <- jsonlite::fromJSON(json) # where json is the output from LDAvis::createJSON
mds_data <- as_tibble(json_obj$mdsDat) # can also use a data.frame
ggplot(mds_data, aes(x, y)) + geom_point()

Matt-Int avatar Jul 13 '21 17:07 Matt-Int