python - matplotlib .ps 输出被截断
问题描述
我正在绘制一个matplotlib.subplots
使用plt.savefig()
所有其他格式生成正确输出的图。只有当我将其保存为 .ps 文件时,才会生成截断图。我试过 set plt.tight_layout() 但它不起作用。
这是一个例子:
import numpy as np
import matplotlib.pyplot as plt
v_x = np.random.randint(0, 80000, 30000)
v_y = v_x # the x, y cordinate of the dots.
f,axes = plt.subplots(5,5,figsize = (40,40))
for row in range(5):
for col in range(5):
print(row,col)
axes[row,col].set_yticklabels([])
axes[row,col].set_xticklabels([])
if row > col:
axes[row,col].axis('off')
else:
axes[row,col].set_xlim(0,len(v_x))
axes[row,col].set_ylim(0,len(v_y))
axes[row,col].scatter(v_x,v_y, c = '#000000', s=(72./300)**2, marker = 's', edgecolor= '')
f.savefig('{}'.format('test.ps'), facecolor='w', bbox_inches='tight', dpi = 300)
解决方案
尝试摆脱
figsize = (40, 40)
看起来您的身材被 figsize 参数截断了。
推荐阅读
- javascript - 正则表达式不允许开头和结尾的空格
- java - 如何从非活动类中删除 FusedlocationProviderClient 位置更新
- vaadin - 3.0.0.beta 的 Vaadin 上下文菜单添加错误,但适用于 2.1.0
- c# - 为什么这个递归搜索返回不相关的结果?
- c++ - 在 QT 中的两个窗口之间共享 websocket 连接
- javascript - 我可以将 Dart 编译的 JS (JavaScript) 用于静态网站的 Firebase 托管吗
- javafx-css - Javafx CSS:用 CSS 绘制文本
- javascript - 我应该预先分配一个数组还是随我增长
- python - 对数据框中的下 i 行使用 Python 循环
- objective-c - 如何操作 ios 代码