当前位置:网站首页>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 .

边栏推荐
- Eight sorting summaries
- Three transparent LED displays that were "crowded" in 2022
- STM32 single chip microcomputer programming learning
- Take you ten days to easily finish the finale of go micro services (distributed transactions)
- PX4 Position_Control RC_Remoter引入
- 6方面带你认识LED软膜屏 LED软膜屏尺寸|价格|安装|应用
- GGPUBR: HOW TO ADD ADJUSTED P-VALUES TO A MULTI-PANEL GGPLOT
- 【多线程】主线程等待子线程执行完毕在执行并获取执行结果的方式记录(有注解代码无坑)
- liftOver进行基因组坐标转换
- Some things configured from ros1 to ros2
猜你喜欢

The selected cells in Excel form have the selection effect of cross shading

Esp32 audio frame esp-adf add key peripheral process code tracking

动态内存(进阶四)

Always report errors when connecting to MySQL database

6. Introduce you to LED soft film screen. LED soft film screen size | price | installation | application

ESP32音频框架 ESP-ADF 添加按键外设流程代码跟踪

GGPLOT: HOW TO DISPLAY THE LAST VALUE OF EACH LINE AS LABEL

How to Create a Nice Box and Whisker Plot in R

揭露数据不一致的利器 —— 实时核对系统

Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)
随机推荐
Astparser parsing class files with enum enumeration methods
Writing contract test cases based on hardhat
TDSQL|就业难?腾讯云数据库微认证来帮你
VS2019代码中包含中文内容导致的编译错误和打印输出乱码问题
BEAUTIFUL GGPLOT VENN DIAGRAM WITH R
Some suggestions for young people who are about to enter the workplace in the graduation season
Is the stock account given by qiniu business school safe? Can I open an account?
揭露数据不一致的利器 —— 实时核对系统
Redis超出最大内存错误OOM command not allowed when used memory > 'maxmemory'
Develop scalable contracts based on hardhat and openzeppelin (II)
Cluster Analysis in R Simplified and Enhanced
原生方法合并word
A sharp tool for exposing data inconsistencies -- a real-time verification system
HOW TO ADD P-VALUES ONTO A GROUPED GGPLOT USING THE GGPUBR R PACKAGE
6. Introduce you to LED soft film screen. LED soft film screen size | price | installation | application
ASTParser 解析含有emum 枚举方法的类文件的踩坑记
ESP32存储配网信息+LED显示配网状态+按键清除配网信息(附源码)
QT获取某个日期是第几周
Solve the problem of data blank in the quick sliding page of the uniapp list
Eight sorting summaries