Python | 控制线宽

线宽在数据可视化中对可读性至关重要。matplotlib库提供了改变线宽的特性,以便于强调如总和或平均线等关键信息。文章通过Python代码示例展示了如何控制线宽。
摘要由CSDN通过智能技术生成

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 | Controlling the Line Width

用于控制线宽的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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值