gpt4 book ai didi

python - R - 如何将 HTML 代码嵌入到 Jupyter 笔记本输出中?

转载 作者:太空宇宙 更新时间:2023-11-03 16:28:32 27 4
gpt4 key购买 nike

我怎样才能做类似 this 的事情使用R?实际上我想将 Jupyter 笔记本单元宽度设置为 100%。在 python 中,这段代码可以完美运行:

from IPython.core.display import HTML, display
HTML("<style>.container { width: 100%; }</style>")

R 中有等效的吗?

谢谢!

最佳答案

您可以使用 display_html 函数在 R 中显示 html 代码例如

// for full width
IRdisplay::display_html('<style>.container { width:100% !important; }</style>')

// this does not work with most sites due to same-origin policy, but no problem with local files
IRdisplay::display_html('<iframe src="http://www.w3schools.com" width=1000, height=1000></iframe> ')

参见:SecurityError: Blocked a frame with origin from accessing a cross-origin frame

关于python - R - 如何将 HTML 代码嵌入到 Jupyter 笔记本输出中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37793888/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com