当前位置:网站首页>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'] = False
about Ubuntu System , You need to manually specify the font to realize the display of Chinese . The setup code is as follows .
边栏推荐
- Is the stock account given by qiniu business school safe? Can I open an account?
- Introduction to interface debugging tools
- Tiktok overseas tiktok: finalizing the final data security agreement with Biden government
- Summary of flutter problems
- vant tabs组件选中第一个下划线位置异常
- deepTools对ChIP-seq数据可视化
- mysql链表数据存储查询排序问题
- excel表格中选中单元格出现十字带阴影的选中效果
- Liftover for genome coordinate conversion
- 解决uniapp列表快速滑动页面数据空白问题
猜你喜欢
JS——每次调用从数组里面随机取一个数,且不能与上一次为同一个
MySQL comparison operator in problem solving
可昇級合約的原理-DelegateCall
HOW TO ADD P-VALUES ONTO A GROUPED GGPLOT USING THE GGPUBR R PACKAGE
The computer screen is black for no reason, and the brightness cannot be adjusted.
How to Create a Nice Box and Whisker Plot in R
解决uniapp列表快速滑动页面数据空白问题
CTF record
Esp32 stores the distribution network information +led displays the distribution network status + press the key to clear the distribution network information (source code attached)
PowerBI中导出数据方法汇总
随机推荐
MySQL linked list data storage query sorting problem
Webauthn - official development document
念念不忘,必有回响 | 悬镜诚邀您参与OpenSCA用户有奖调研
Summary of data export methods in powerbi
R HISTOGRAM EXAMPLE QUICK REFERENCE
PHP query distance according to longitude and latitude
Research on and off the Oracle chain
What are the methods of adding elements to arrays in JS
PLC-Recorder快速监控多个PLC位的技巧
SSRF
【2022 ACTF-wp】
MySql存储过程游标遍历结果集
MTK full dump grab
基于Hardhat编写合约测试用例
Jinshanyun - 2023 Summer Internship
Pyqt5+opencv project practice: microcirculator pictures, video recording and manual comparison software (with source code)
Homer预测motif
[cloud native] 2.5 kubernetes core practice (Part 2)
How to Easily Create Barplots with Error Bars in R
Map set assignment to database