Python 在Jupyter笔记本中以Plotly方式使用外部CSS字体
我想在Jupyter笔记本内制作的绘图仪中使用外部字体 从我做了一个添加Poppins字体的单元格,我从Google字体页面上得到了它的嵌入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"
%%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()