[英]When plotting from a CSV file using matplotlib, 0 values on X, Y axis are not plotting and I need them to be plotted
我的 CSV 文件中的 0 值没有绘制,关于为什么会发生这种情况以及我如何确保绘制它们的任何想法?
import pandas as pd
import numpy as np from matplotlib
import pyplot as plt
columns = np.array(["Ast", "Gls"])
df = pd.read_csv(r"document.csv", usecols=columns)
print("Contents in csv file:\n", df)
colors =(["red"])
size = ([500])
plt.scatter(df.Ast, df.Gls, c=colors, s=size, alpha=0.5, cmap='viridis')
plt.show()
Contents in csv file:
Gls Ast
0 2 1
1 4 5
2 0 3
3 1 9
4 1 1
5 4 2
6 1 1
7 5 4
8 7 4
9 4 1
10 5 6
11 4 1
12 0 1
13 2 2
14 3 0
15 1 0
16 0 2
17 4 5
18 0 1
19 4 3
20 2 5
21 14 11
22 4 1
23 3 6
24 7 1
25 2 5
26 9 3
例如,绘制所有数字大于零的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.