首页 > 解决方案 > 如何在散景图中设置文本字体?

问题描述

我需要为我的硕士论文的图形设置一个 20pt 的通用文本字体。目前我正在使用 Bokeh 来绘制我的数字,但我不知道如何设置文本字体。

这是一个示例图:

图1

f1 = figure(plot_height = 500, 
plot_width = 1500,
title = "TOP 1",
x_axis_label = "Date and Time",
y_axis_label = "Temperatur [°C]",
x_axis_type = "datetime")  #x-Achse als Datum


f1.line(df2["Datum"],df2["Modell A"],
legend = "Modelltemp. TOP 1",
color = "blue")

f1.line(df["Date and Time"],df["Room Temperature TOP1 [C]"],
color = "green",
legend = "T_TOP1")

f1.line(df["Date and Time"],df["Setpoint TOP1 [C]"],
color = "red",
legend = "T_SP1")

f1.legend.location = "top_right"
f1.legend.orientation = "horizontal"
f1.legend.click_policy = "hide"

标签: pythonbokeh

解决方案


Bokeh 中没有“通用文本字体”之类的东西。每个处理文本的模型都有自己的属性来控制字体大小。例如,Titlehas text_font_sizeAxishasaxis_label_text_font_size用于其标签,类似属性用于其刻度标签。


推荐阅读