-
Notifications
You must be signed in to change notification settings - Fork 93
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
Multiple d3heatmaps not displaying in conditional #54
Comments
I think using Try
|
Thank you especially for the quick response. This is a nice work around. Am I missing something or should I be able to generate multiple d3heatmap just like any plot within a code chunk though? |
I can't say for sure, but I'm almost positive we are limited to one |
That's what I initially thought too. But this works just fine. require(d3heatmap)
d3heatmap(mtcars, col = "Spectral")
d3heatmap(mtcars, col = "Blues") |
Calling d3heatmap doesn't actually render a heatmap, it just creates and returns one--just like all htmlwidgets. (This is different than plots which actually get created when you call plot()). It just so happens that what knitr chooses to do with top-level expressions, is print (actually knit_print) them. So what you did was akin to this:
And wondering why only 2, not 1, was printed. And tagList is akin to wrapping these numbers in c(1, 2). So the limitation if you want to call it that, is that an if() block only ever returns its last expression. |
That makes perfect sense. Thank you! |
When trying to plot multiple d3heatmaps within a conditional, the HTML that is generated only plots the final heat map. Below is code for an Rmd to reproduce the bug.
If the heat maps are outside of a conditional, multiple will appear in the knitted html file. Has anyone else run into this? Any help would be appreciated.
The text was updated successfully, but these errors were encountered: