python - Plotting Parallel Coordinates in pandas with different colours -


i have data frame this:

    0   1   2   3   4   5   6   7   8   9   cluster 0   0.018420    0.003357    0.002626    -0.015603   -0.009005   -0.023671   -0.016316   0.066504    -0.039526   0.037820    1   0.017684    0.003434    -0.003338   -0.003904   -0.021871   -0.009454   -0.013772   -0.004610   -0.006150   -0.005746   2   0.018857    0.003987    0.001749    -0.019840   0.011184    -0.020451   0.082434    -0.008789   0.000449    0.005445    against 3   0.020454    0.026437    0.036899    0.027168    -0.018483   -0.001076   0.005831    -0.002117   -0.011288   0.007491    4   0.018006    0.005365    0.001298    -0.006953   0.017034    0.006931    0.000268    0.001615    0.016707    -0.017798   against  df.columns index([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, u'cluster'], dtype='object') 

the last column 'cluster' specifies whether observation belong "for" cluster or "against" cluster.

i want plot such observations "for" same coloured while "against" same colour. there 2740 obs, transparency in lines required give better visualisation.

i did following , plotting same colour red both classes when specifying colour option.

parallel_coordinates(y_embed,'cluster',color=["r" if c=="for" else "g" c in y_embed.cluster]) 

where y_embed data frame.

if don't mention colour option plot 2 colours default. want put own colour option.

any advice?

the color argument list of colors 1 color each cluster, not 1 color each row. can make plot green 1 cluster , magenta other cluster this:

parallel_coordinates(data,'cluster',color=['g','m']) 

to make lines transparent can use rgba values colors.

parallel_coordinates(data,'cluster',color=[[1,0,0,0.2],[0,1,0,0.9]]) 

here first set red , partially transparent , second green , opaque.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -