[英]Scatter plot of pair coordinates, annotated with pandas DataFrame index name for labels
For a two-column pandas DataFrame, whose rows contain a pair of two values that belong to one another as xy coordinates, how can a 2D plot be generated such that each pair of coordinates are given an annotated text label equal to the index
name for那一排?
例如,坐标 ( 0.983801
, 0.0155373
) 应在 plot 中显示为单个点,并使用AXP
进行注释。 与其余行类似,每个行都唯一命名
DataFrame 由两个一维 numpy arrays a
和b
构造而成,而标签是两者长度相等的列表:
#columns labeled on next line since the transpose of index arg is columns
df = pd.DataFrame(np.vstack((a,b)),index=['pe','jsc']).T
df.index = labels #row labels
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.