python - Matplotlib:如何更改双条形图的 figsize
问题描述
我使用以下代码在 matplotlib 中绘制了一个双条形图:
x = pd.Series(range(12))
y = self.cust_data['Cluster_ID'].value_counts().sort_index()
z = self.cust_data['Cluster_ID_NEW'].value_counts().sort_index()
plt.bar(x + 0.0, y, color = 'b', width = 0.5)
plt.bar(x + 0.5, z, color = 'g', width = 0.5)
plt.legend(['Old Cluster', 'New Cluster'])
plt.savefig("C:\\Users\\utkarsh.a.ranjan\\Documents\\pyqt_data\\generate_results\\bar", bbox_inches='tight',pad_inches=0.1)
plt.clf()
我想使用 figsize 参数使结果图的大小更大。绘制单个条形图时这很容易,但在这里我对放置 figsize 参数的位置感到困惑。
解决方案
推荐阅读
- arduino-ide - 如何修复 Arduino IDE 中没有匹配的调用功能?
- spatial - 尝试使用 add = True 并收到错误消息
- python - TensorFlow:可视化自定义层
- dart - 解析 json 数组返回 `Expected a value of type 'List<>', but got one type of 'List
' - c++ - 难以理解 C++ 中的链表实现
- javascript - 如何解决状态码为 500 axios 的空错误?
- c - 使用 I2C 读写时遇到问题
- python-3.x - json.decoder.JSONDecodeError:期望值:第 1 行第 1 列(字符 0)和 204 响应
- python - 使用列表理解简化 for 循环和 if 语句
- vb.net - 反序列化 Json 以获得多语言支持