我知道 savefig 有一个选项 dpi。但如果我用plotly 绘图并写入图像,我就没有设置dpi 的选项。
如何用plotly设置dpi?
TypeError: write_image() got an unexpected keyword argument 'dpi'
Run Code Online (Sandbox Code Playgroud) 我打算制作多个子图来展示我的结果。我使用了 matplotlib 的子图。我有文字大小的问题。正如您在此处的简单代码中所见。在plt.title
文档中它说title(label, fontdict=None, loc='center', pad=None, **kwargs)
import random
from matplotlib.pyplot import figure, plot, xlabel, ylabel, legend, close, subplots, title, savefig, get_current_fig_manager, show, pause, clf
x = []
for i in range(10):
x.append(random.random()*i)
y_1 = []
for i in range(10):
y_1.append(random.random()*i)
y_2 = []
for i in range(10):
y_2.append(random.random()*i)
fig, ax = subplots(1, 2, squeeze = False, figsize = (10,10))
ax[0,1].title.set_text('y_1', fontdict = {'font.size':22})
ax[0,1].plot(x,y_1)
ax[0,1].set_xlabel('x')
ax[0,1].set_ylabel('y_1')
ax[0,0].title.set_text('y_2', fontdict = {'font.size':22})
ax[0,0].plot(x,y_2)
ax[0,0].set_xlabel('x')
ax[0,0].set_ylabel('y_2')
Run Code Online (Sandbox Code Playgroud)
但是如果我运行这段代码,我会收到一个错误 TypeError: set_text() …