博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python 子图大小_Python | 图的大小
阅读量:2531 次
发布时间:2019-05-11

本文共 1488 字,大约阅读时间需要 4 分钟。

python 子图大小

In some cases, the automatic figure size generated by the is not visually good or there could be some non-acceptable ratio in the figure. So, rather than allowing a pyplot to decide the figure size, we can manually define the dimensions of the figure.

在某些情况下,由生成的自动图形大小在视觉上不佳,或者图形中可能存在某些不可接受的比例。 因此,我们可以手动定义图形的尺寸,而不是允许pyplot来确定图形的尺寸。

In this article, we are going to change figure size using an inbuilt function:

在本文中,我们将使用内置函数更改图形大小

matplotlib.pyplot.figure(figsize)

Syntax:

句法:

matplotlib.pyplot.figure(figsize=(9,3))# figsize(float, float)    width, height in inches.

1)宽身材 (1) Wide Figure)

Python | Figure Size of Plot (1)

2)高地 (2) Tall Plot)

Python | Figure Size of Plot (2)

3)小方形图 (3) Small Square Figure)

Python | Figure Size of Plot (3)

4)方形图 (4) Square Figure)

Python | Figure Size of Plot (4)

绘图图形大小的Python代码 (Python code for figure size of plot)

# Data Visualization using Python# Figure Sizeimport numpy as npimport matplotlib.pyplot as pltx = np.arange(50)y = 2*x*x + 7*x - 14# Example 1 plt.figure(figsize=(9,5))# Leftmostplt.plot(x, y, 'yo')plt.title('Plot')plt.ylabel('Function Vaule')plt.xlabel('x-axis')plt.show()# Example 2 plt.figure(figsize=(6,9))# Leftmostplt.plot(x, y, 'yo')plt.title('Plot')plt.ylabel('Function Vaule')plt.xlabel('x-axis')plt.show()# Example 3plt.figure(figsize=(3,3))# Leftmostplt.plot(x, y, 'yo')plt.title('Plot')plt.ylabel('Function Vaule')plt.xlabel('x-axis')plt.show()# Example 4 plt.figure(figsize=(7,7))# Leftmostplt.plot(x, y, 'yo')plt.title('Plot')plt.ylabel('Function Vaule')plt.xlabel('x-axis')plt.show()

Output:

输出:

Output is as figure

翻译自:

python 子图大小

转载地址:http://jyxzd.baihongyu.com/

你可能感兴趣的文章
Django 框架的 模板继承 与 模板包含
查看>>
Effective Modern C++:01类型推导
查看>>
根据html页面模板动态生成html页面(c#类)
查看>>
Failed to Connect to MySQL at 127.0.0.1:3306 MySql WorkBench 本地连接问题
查看>>
android下activity中多个listview只允许主界面滚动
查看>>
(贪心5.2.1)UVA 10026 Shoemaker's Problem(利用数据有序化来进行贪心选择)
查看>>
java基础练习 4
查看>>
Swift学习:扩展(Extensions)
查看>>
java了解
查看>>
[基础] 模板+友元类外定义
查看>>
【日常训练】数据中心(CSP 201812-4)
查看>>
《JavaScript总结》apply、call和bind方法
查看>>
Alpha 冲刺 (5/10)
查看>>
递归和二分法
查看>>
vs命令行参数说明
查看>>
C++Builder调整TreeView和ListView间距
查看>>
205. Isomorphic Strings
查看>>
SynchronousQueue
查看>>
JQuery常用函数及功能小结
查看>>
POJ 2653 Pick-up sticks 线段相交
查看>>