-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples using multiple datasets #55
Comments
The |
Thanks for the link. However, r2d3 doesn't appear to be interpreting the data as I'd expect. I shall try to provide a minimum reproducible example: I've included text files with the contents of my dataframe (data.txt), the js.script file (network4_js.txt) and a short R script with my data_to_json function and r2d3 command (r2d3_github.txt). When I run these in RStudio, the viewer returns a blank screen. What I would expect is to get a layout of rectangles with blue nodes, as I get when I open an html file containing the "same" d3 (network4_html.txt). Please note, var data is copy and pasted from the R studio console by printing Any ideas why the two don't generate the same output? |
There's probably a JavaScript error happening somewhere along the line. Try using the browser debugging tools to run that down. |
I don't really know how to do that, but I've attached an image of the Web Inspector in case it gives you any clues. Interestingly, if I set |
@shotchki did you solve this? I am having the same problem with a graph network. |
I'm afraid not. I put that project on the back burner in the hopes I'd get some more guidance/inspiration. Currently thinking about re-writing it in igraph & visNetwork. |
I had the same problem, but I think I figured something out. Here is an .Rmd that works for me. I hope it helps. |
Thank you for your comment. Unfortunately, it 's not using two variables from the same dataframe, but using multiple dataframes that's the issue. |
@shotchki In network4_js.txt:
Then you can just refer to them in js as |
Very late reply but I tried your solution and I noticed that it only works if you use your own data_to_json function:
Then you can reference using data.df1 and data.df2 |
Does r2d3 support the production of visualizations which require more than one dataset? e.g. force graphs, which require nodes and links. The package appears to only accept one entry into the data argument, which must always be referred to as "data" in the .js script, e.g.
I have tried various means of creating a nested dataset, which I can then call in the .js script, and even filtering the data within the .js script; this works if I write an html file, but not in R using the r2d3 command.
If r2d3 does support the production of visualizations which require more than one dataset, please can you provide an example in the gallery, such as the forcegraph, that actually converts r dataframes, rather than reading in pre-existing .json files?
The text was updated successfully, but these errors were encountered: