为什么 iPad 无法渲染 "offline" 情节但 iPhone 可以?
Why is iPad not able to render "offline" plotly plots but iPhone can?
如果我在网站上托管离线绘图(例如,on a github.io page here),我可以在我的桌面和我的 iPhone(iOS 12.0,Safari),但不在我的 iPad 上(iOS 12.1,Safari 和 Chrome)——我收到一条 "WebGL is not supported by your browser" 消息。
然而,对于所有这些设备,this one 等网页上的图可以毫无问题地呈现。是什么导致我的 iPhone 和 iPad 之间渲染离线绘图的差异?
大多数现代浏览器都支持 WebGL,但有时默认情况下它是禁用的。我不使用 safari,但您可以找到小 guides to enable it on the web, there are also other sites,您可以在其中检查它是否已启用并丢弃该问题。并非所有 plotly 的图都使用 WebGL,尽管我认为曲面图使用 WebGL,因此您可能需要先检查它是否已启用。
绝对是一个奇怪的案例,我正在添加另一个答案以试图更好地解释我认为它是什么。
Python 的 plotly(又名 plotly.py)在幕后使用 plotly.js,当您将情节下载为 html 时,它包含库 plotly.js在html文件中(可以使用浏览器的开发工具查看)
相同 plotly.py 版本的 offline
模块将始终包含相同的 plotly.js 版本,而 online
模块可能包含 plotly.js目前被 plotly 的 plot.ly 平台使用,或者至少这可以解释这些模块之间的差异。通过使用浏览器的工具检查代码,plotly 文档中的示例似乎甚至没有使用 plotly.js 就可以呈现。
此外,plotly.js 正在重写其 WebGL 代码,如您在此 issue 中所见,该代码最初针对版本 2,但可能会更快推出,您可以在其中见评论:
Along with this transition - or perhaps even better before it - we
should find a way to test webgl plots in iOS - perhaps using
https://www.browserstack.com/screenshots/api ? We need to make sure
that bugs we've fixed before - such as #280, #1868 (any others that
are iOS-specific?) - don't come back with this rewrite.
您可以在哪里看到与此类似的对 issues 的引用。
TL DR:除了让你的浏览器和 plotlys 保持最新之外,你无能为力,plotly 的代码非常动态,所以你应该经常检查更新然后。
以下是我尝试过的一些有效方法。
如果您使用的是 google Colab,请使用此代码-
导入 plotly.io 作为 pio
pio.renderers.default = "colab"
前往 iPad 设置 —> Safari —> 高级 —> 实验性功能 —> 打开 Web GL 2.0
如果我在网站上托管离线绘图(例如,on a github.io page here),我可以在我的桌面和我的 iPhone(iOS 12.0,Safari),但不在我的 iPad 上(iOS 12.1,Safari 和 Chrome)——我收到一条 "WebGL is not supported by your browser" 消息。
然而,对于所有这些设备,this one 等网页上的图可以毫无问题地呈现。是什么导致我的 iPhone 和 iPad 之间渲染离线绘图的差异?
大多数现代浏览器都支持 WebGL,但有时默认情况下它是禁用的。我不使用 safari,但您可以找到小 guides to enable it on the web, there are also other sites,您可以在其中检查它是否已启用并丢弃该问题。并非所有 plotly 的图都使用 WebGL,尽管我认为曲面图使用 WebGL,因此您可能需要先检查它是否已启用。
绝对是一个奇怪的案例,我正在添加另一个答案以试图更好地解释我认为它是什么。
Python 的 plotly(又名 plotly.py)在幕后使用 plotly.js,当您将情节下载为 html 时,它包含库 plotly.js在html文件中(可以使用浏览器的开发工具查看)
相同 plotly.py 版本的 offline
模块将始终包含相同的 plotly.js 版本,而 online
模块可能包含 plotly.js目前被 plotly 的 plot.ly 平台使用,或者至少这可以解释这些模块之间的差异。通过使用浏览器的工具检查代码,plotly 文档中的示例似乎甚至没有使用 plotly.js 就可以呈现。
此外,plotly.js 正在重写其 WebGL 代码,如您在此 issue 中所见,该代码最初针对版本 2,但可能会更快推出,您可以在其中见评论:
Along with this transition - or perhaps even better before it - we should find a way to test webgl plots in iOS - perhaps using https://www.browserstack.com/screenshots/api ? We need to make sure that bugs we've fixed before - such as #280, #1868 (any others that are iOS-specific?) - don't come back with this rewrite.
您可以在哪里看到与此类似的对 issues 的引用。
TL DR:除了让你的浏览器和 plotlys 保持最新之外,你无能为力,plotly 的代码非常动态,所以你应该经常检查更新然后。
以下是我尝试过的一些有效方法。
如果您使用的是 google Colab,请使用此代码-
导入 plotly.io 作为 pio
pio.renderers.default = "colab"
前往 iPad 设置 —> Safari —> 高级 —> 实验性功能 —> 打开 Web GL 2.0