Skip to content
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

Book_1_Ch_11代码疑问 #129

Closed
Mephistofer opened this issue Dec 18, 2023 · 3 comments
Closed

Book_1_Ch_11代码疑问 #129

Mephistofer opened this issue Dec 18, 2023 · 3 comments

Comments

@Mephistofer
Copy link

Book_1_Ch_11,第16页,代码 4. 用 Plotly 生成平面等高线 | Bk1_Ch11_04.ipynb

# 创建布局
layout = go.Layout(
 width=600, # 设置图形宽度
 height=600, # 设置图形高度
 xaxis=dict(title=r'$x_1$'),
 yaxis=dict(title=r'$x_2$'))

这段代码,Latex语法在vscode和jupyter notebook中都没有生效,感觉plotly.graph_objects对于Latex支持可能有一点问题。
在vscode中,latex默认渲染是vscode,可以修改渲染器生效,例如:

import plotly.io as pio
pio.renderers.default = 'svg'

但是chrome中使用jupyter notebook,默认渲染是“plotly_mimetype+notebook",目前渲染器我设置为browser才可以,不清楚怎么回事。

@Visualize-ML
Copy link
Owner

Visualize-ML commented Dec 18, 2023 via email

@Mephistofer
Copy link
Author

如果确保anaconda运行环境正确(从prop中启动jupyter),以及正确安装了 Kaleido,则将默认的渲染器设置为图像类的,之后的都可以正常显示。比如绘图前设置:

import plotly.io as pio
pio.renderers.default = 'png'

@Mephistofer
Copy link
Author

之前我发现这种设置vscode可以,jupyterlab不行的原因是我启动jupyterlab是直接cmd进入的,没有进入base环境中,如果直接从prompt中进入就没有这个问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants