Python中的散点图
我有一个尺寸为100x2的向量x,以及向量y = {1,-1}的相应二进制标签,长度为100。数据点对应于标签,例如红色为-1,对于给定数据点,黄色为1。
我一直在研究matplotlib和FCN散点,但是它仅接受一个特征向量及其标签。
我将感谢任何帮助。
I have a vector X of size 100x2 and the corresponding binary labels in a vector y ={1, -1} of length 100. I would like to plot the scattered data with s.t. I get the features on the axis and the color of the data point corresponds to a label e.g. red is -1, yellow is 1 for a given data point.
I've been looking into matplotlib and the fcn scatter however it accepts only a single feature vector and its label.
I would be grateful for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
seaborn
(或Matplotlib)轻松执行此操作。以下是代码。使用Seaborn Scactplot
输出SNS STACTPLOT
You can do this easily using
seaborn
(or matplotlib as well). Below is the code.Use Seaborn scatterplot
Output sns scatterplot