Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在Jupyter笔记本中以Plotly方式使用外部CSS字体_Python_Css_Plotly_Jupyter_Jupyterhub - Fatal编程技术网

Python 在Jupyter笔记本中以Plotly方式使用外部CSS字体

Python 在Jupyter笔记本中以Plotly方式使用外部CSS字体,python,css,plotly,jupyter,jupyterhub,Python,Css,Plotly,Jupyter,Jupyterhub,我想在Jupyter笔记本内制作的绘图仪中使用外部字体 从我做了一个添加Poppins字体的单元格,我从Google字体页面上得到了它的嵌入 %%html <style> <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet"

我想在Jupyter笔记本内制作的绘图仪中使用外部字体

从我做了一个添加Poppins字体的单元格,我从Google字体页面上得到了它的嵌入

%%html
<style>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
</style>
图表显示的是单空格,这意味着Poppins字体无法显示

从Chrome开发工具上看,%%HTML cell似乎无法加载字体,因为没有调用googleapis url

我正在运行我自己最简单的Jujyter集线器实例,所以我也会考虑定制一个CCS

# https://plotly.com/python/figure-labels/
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(
    x=list(range(10)),
    y=[n**2 for n in range(10)]
))
fig.update_layout(
    title="My Plot Title",
    font=dict(
        family="Poppins, monospace", # only this part should matter
        size=20
    )
)
fig.show()