如何使用全息视图或hvplot更改字体大小?
下面是我的一个简单的情节示例:
# import libraries
import numpy as np
import pandas as pd
import holoviews as hv
import hvplot.pandas
hv.extension('bokeh', logo=False)
# create sample dataframe
df = pd.DataFrame({
'col1': np.random.normal(size=30),
'col2': np.random.normal(size=30),
})
# plot data with holoviews
my_plot = hv.Scatter(df, label='Scattering around')发布于 2019-11-27 12:51:00
1)您可以在绘图中使用.opts(fontsize={})通过更改字体大小,如下所示:
# change fontsizes for different parts of plot
my_plot.opts(fontsize={
'title': 15,
'labels': 14,
'xticks': 10,
'yticks': 10,
}).opts(fontscale=1.5) 2)与版本>= 1.13的全息视图您可以缩放所有字体,并使图例,标题,xticks更大的使用
# make fonts all at once larger for your plot by the same scale
# here I've chosen fontscale=2, which makes all fonts 200% larger
my_plot.opts(fontscale=2)3)如果您想要缩放您的字体,并且您有一个用于全息视图绘图的bokeh后端,您可以这样做:
# scale fontsizes with 200%
my_plot.opts(fontsize={
'title': '200%',
'labels': '200%',
'ticks': '200%',
})有关您可以更改fontsize的所有可能部分的更多信息可以在这里找到:
http://holoviews.org/user_guide/Customizing_Plots.html#Font-sizes
https://stackoverflow.com/questions/59070661
复制相似问题