Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to plot a set of points in python?

I have a set of points created through a python program which belongs to different clusters. I would like to plot it on a graph so that points in different clusters should be plotted with different colours.

UPDATE

In my case I have a univariate data ( marks of a test). Looking for a way to plot it.

I have two clusters that are stored in two arrays. Like x=[1,20,10,4], y=[1644,34444]. I would like to plot it like as in a cluster

like image 955
user567879 Avatar asked Jan 25 '26 08:01

user567879


1 Answers

you can use matplotlib. I'm not sure to understand exactly your need, but it could be something like this :

from pylab import *
for (x, y) in clusters:
    plot(x, y, '+')
show() # or savefig(<filename>)
like image 169
François Avatar answered Jan 26 '26 20:01

François



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!