Reputation: 447
I have this dataframe composed of sample IDs, PCA values and respective population. my dataframe
I have generated the MDS plot for this data using ggplot in python using the following command:
from ggplot import *
print ggplot(aes(x='C1', y='C2'), data=mds)+ geom_point(alpha=0.6, colour='black', fill='red') + ggtitle('My plot')
and the plot looks like this: My MDS plot
I was wondering how I can assign different colors to each individual based on their population lable?
Upvotes: 2
Views: 1721
Reputation: 13284
This should do:
from ggplot import *
p = ggplot(aes(x='C1', y='C2', color='Population'), data=mds)+ geom_point(alpha=0.6) + ggtitle('My plot')
print p
Make sure to have the quotes around your column names and to have the color
argument inside your aes
function.
Upvotes: 4