[英]To get data of points plotted in different area of scatter plots in python
I have created a scatter plot for a fantasy league for different players between 'players cost' and 'fantasy points'. 我为“玩家成本”和“幻想点”之间的不同玩家创建了幻想联盟的散点图。 Now I want to get the information (like Name,age,team,etc) of the data points on the left side of the green vertical line and more specifically at North-West part of the graph. 现在我想获得绿色垂直线左侧数据点的信息(如姓名,年龄,团队等),更具体地说,是图表的西北部分。 Is there any function "get" to get information the data points. 是否有任何函数“获取”来获取数据点的信息。
Image desription: Normal scatter plot with two vertial lines v1 at x=6 and v2 at x = 10. I want to get information of datapoints plotted on left of v1 from the plot 图像描述:正常散点图,在x = 6处有两条垂直线v1,在x = 10处有v2。我想从图中获得在v1左边绘制的数据点的信息
Following is the code i wrote to draw this scatter plot 以下是我写的用于绘制此散点图的代码
x = dataset.loc[:,"Cost"]
y = datasetloc[:,"Points"]
plt.figure(figsize = (20,10))
plt.scatter(x,y,size =100,marker = '*',color = 'b',alpha = 0.8,edgeolors
= 'white')
plt.xlabel("Indiidual Players Cost")
plt.ylabel("Fantasy Points")
plt.title("Players Cost Vs Fantasy Points")
plt.show()
You will want to access information directly from your dataset. 您需要直接从数据集中访问信息。
nw = dataset[(dataset.Cost <= 6) & (dataset.Points >= 0)]
ne = dataset[(dataset.Cost >= 6) & (dataset.Points >= 0)]
sw = dataset[(dataset.Cost <= 6) & (dataset.Points <= 0)]
se = dataset[(dataset.Cost >= 6) & (dataset.Points <= 0)]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.