当前位置:网站首页>Data analysis - Matplotlib sample code
Data analysis - Matplotlib sample code
2022-07-02 11:48:00 【yinshuilan】
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-2, 2, 100)
y1 = np.cos(np.pi * x)
y2 = np.sin(np.pi * x)
plt.plot(x, y1, "go", label=r"$y1=\cos(\pi \times x)$", alpha=0.8, linewidth=0.7)
plt.plot(x, y2, "r-", label=r"$y2=\sin(\pi \times x)$", alpha=0.8, linewidth=0.7)
df = pd.DataFrame(np.random.randint(0, 100, size=(100, 1)), columns=list('A'))
plt.annotate("important Point", (0, 1), xytext=(-1.5, 1.1), arrowprops=dict(arrowstyle='->'))
plt.xlabel("x-axis")
plt.ylabel("y-axis")
# Set the coordinate range [xmin, xmax, ymin, ymax]
plt.axis([-2.1, 2.1, -1.2, 1.2])
# Show labels
plt.legend()
# Show grid
plt.grid(alpha=0.4)
plt.title("Two Plots", color=(0.1, 0.3, 0.5))
plt.show()The operation input is shown in the figure below :

import matplotlib as mpl
mpl.rcParams["font.sans-serif"] = ["Microsoft YaHei"]
mpl.rcParams['axes.unicode_minus'] = Falseabout Ubuntu System , You need to manually specify the font to realize the display of Chinese . The setup code is as follows .

边栏推荐
- qt 仪表自定义控件
- 行業的分析
- flutter 问题总结
- SSRF
- MySQL比较运算符IN问题求解
- C file and folder operation
- [visual studio 2019] create MFC desktop program (install MFC development components | create MFC application | edit MFC application window | add click event for button | Modify button text | open appl
- PHP query distance according to longitude and latitude
- C # method of obtaining a unique identification number (ID) based on the current time
- Writing contract test cases based on hardhat
猜你喜欢

II Stm32f407 chip GPIO programming, register operation, library function operation and bit segment operation

Develop scalable contracts based on hardhat and openzeppelin (II)

A sharp tool for exposing data inconsistencies -- a real-time verification system

How to Create a Nice Box and Whisker Plot in R
![[cloud native] 2.5 kubernetes core practice (Part 2)](/img/87/826894d758392a0c7a60dd5fa09eef.png)
[cloud native] 2.5 kubernetes core practice (Part 2)

Tdsql | difficult employment? Tencent cloud database micro authentication to help you

Attribute acquisition method and operation notes of C # multidimensional array

抖音海外版TikTok:正与拜登政府敲定最终数据安全协议

The computer screen is black for no reason, and the brightness cannot be adjusted.

ren域名有价值吗?值不值得投资?ren域名的应用范围有哪些?
随机推荐
基于 Openzeppelin 的可升级合约解决方案的注意事项
Summary of data export methods in powerbi
K-Means Clustering Visualization in R: Step By Step Guide
ros缺少xacro的包
电脑无缘无故黑屏,无法调节亮度。
Eight sorting summaries
动态内存(进阶四)
行業的分析
pgsql 字符串转数组关联其他表,匹配 拼接后原顺序展示
MySql存储过程游标遍历结果集
Solve the problem of data blank in the quick sliding page of the uniapp list
liftOver进行基因组坐标转换
Astparser parsing class files with enum enumeration methods
Summary of flutter problems
easyExcel和lombok注解以及swagger常用注解
ASTParser 解析含有emum 枚举方法的类文件的踩坑记
Some things configured from ros1 to ros2
数据分析 - matplotlib示例代码
6方面带你认识LED软膜屏 LED软膜屏尺寸|价格|安装|应用
抖音海外版TikTok:正与拜登政府敲定最终数据安全协议