Line width is another property that can play a big role in basic data visualization. Bold lines have a major impact on readability than thin lines. Plotting includes sum or average line are plotting with greater line width. Because of such type of usage, matplotlib provides a feature to change linewidth.
线宽是另一个可以在基本数据可视化中发挥重要作用的属性。 粗线比细线对可读性有重大影响。 标绘包括总和或平均线标绘,具有更大的线宽。 由于这种用法,matplotlib提供了更改线宽的功能。
Following are some examples of categorical plotting:
以下是分类绘图的一些示例:
Syntax:
句法:
matplotlib.pyplot.plot(x,y,linewidth=2.0)
# linewidth=2.0
# Width of the line
用于控制线宽的Python代码 (Python code for controlling the line width)
# Data Visualization using Python
# Controling line width
import numpy as np
import matplotlib.pyplot as plt
x1 = np.linspace(0.0, 2.0)
x2 = np.linspace(0.0, 2.0)
y1 = np.sin(2 * np.pi * x1) * np.exp(-x1)
y2 = np.cos(2 * np.pi * x2)
plt.plot(x1, y1, 'b')
plt.plot(x2, y2, 'b', linewidth=3.0)
plt.xlabel('Time')
plt.ylabel('oscilation')
plt.title('LineWidth')
plt.figure()
Output:
输出:
Output is as figure
翻译自: https://www.includehelp.com/python/controlling-the-line-width.aspx