Trying to plot a profile by cluster and output is wrong

70 Views Asked by At

I'm trying to make a plot like this:

Profile Plot by Phenotype

When I attempt with x=variable, y=value, and group=[an identified cluster], I get the following plot.

Profile Plot of Variables by Cluster

I start with scaled model indicators, which are columns including age, vital signs, laboratory values, and medications. I also have id and cluster as variables.

melt_mod_indic_z<-melt(mod_indic_z, id.vars=c('cluster'))

ggplot(melt_mod_indic_z) +
geom_line(aes(variable, value, group = cluster,
color = cluster))

Is there a way to correct this? Thanks in advance!

0

There are 0 best solutions below