Open nick-youngblut opened 7 years ago
It seems that this is still a problem. This seems to be distributed to other packages using htmlwidgets as well, for example DiagrammeR..
The short answer to this issue is that it is not currently possible to adjust the height of the widget in Jupyter based on evidence that I gathered while searching a solution for this topic.
The long answer is as following:
htmlwidgets
uses the function toHTML
to display widgets in Jupyter which then uses the IRdisplay library. This function will basically produce an htmltools
HTML browsable object.display
method to display objects according to its mimetype. This function will call repr::mime2repr
to convert the widget to HTML. After the conversion, it will then request the IRkernel library to display the content by calling send_response
zmq
messages. In the present case it sends a message of type display_data
iframes
which is the HTML element used to display htmlwidgets
At the moment, I have considered the following alternatives:
iframes
(ie htmlwidgets
) and use a different mimetype for the output that plays better with Jupyter such as svg
. This is my preferred approach as it also avoids bloating the notebook with unnecessary iframes
. In some cases, a library will try to wrap its svg
element on an iframe
. Therefore, one needs to figure how to extract that element from the generated HTML code..jp-mode-isolated
CSS class in the developer tab of your webbrowser which will affect all displayed widgets. However, I do not think this is the cleanest solution.
I'm trying to display some examples from the htmlwidgets gallery (http://www.htmlwidgets.org/showcase_rglwidget.html) in an R kernel in a Jupyter Notebook (eg., the
networkD3
andd3heatmap
examples). The htmlwidgets are being displayed in the notebook, but the height of the widget is <1 mm. I can barely see the widget, but I can tell that I'm selecting/moving something if I click carefully. How do I increase the size of the plot?I've attached a couple of screen shots to show the
networkD3
example (it's hard to see because it's height is almost 0).Session Info: