hdml指的是什么接口
327
2022-08-24
python_采样_多个散点图在一起(python只有一组数据画散点图)
参考: = df.sampleBy('gender',{1:0.0002,2:0.0002}).select("balance","numTrans","numIntlTrans")sample_data.take(5)To put multiple 2D charts in one go you can usedata_multi = dict([ (elem, data_sample.select(elem).rdd.flatMap(lambda row: row).collect()) for elem in numerical])sctr = chrt.Scatter(data_multi, x='balance', y='numTrans')chrt.show(sctr)# 或者这样#按字段将值分开data_multi ={elem:sample_data.select(elem).rdd.flatMap(lambda x:x).collect()\ for elem in ["balance","numTrans","numIntlTrans"]}#画散点图,plt.scatter(x,y)plt.scatter(data_multi["numTrans"],data_multi["balance"],c ='r',marker='o',label="numTrans-balance")plt.scatter(data_multi["numIntlTrans"],data_multi["balance"],c ='b',marker="x",label="numInt-balance")plt.grid(True)#网格plt.xlabel("x value")plt.ylabel("y value")plt.legend(loc='upper right')#图例的位置plt.title("scatter view")
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~