-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifying plot colors #155
Comments
I'm thinking to rework the plotting such that In the meantime, you can use: data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")
model <- latrend(method, latrendData, nClusters = 3)
ggplot() +
geom_line( data = trajectories(model), aes( x = Time, y = Y, group = Id)) +
facet_wrap(~ Cluster) +
geom_line(data = clusterTrajectories(model), aes(x = Time, y = Y, color = Cluster)) |
Got it, thank you very much, Niek! |
Hi Niek, I am trying to add the percentage of each cluster in parentheses in the facet to the plot with black individual trajectories and colored cluster trajectories. What would be the easiest way to do this? Something like this?
|
I'm not familiar with ggplot's labeller. An alternative way is to create a new cluster column with the labels that you want (that's how I implemented it in You can use df_kml_model_cluster_traj$ClusterLabel = factor(df_kml_model_cluster_traj$Cluster, levels = clusterNames(kml_model_4), labels = clusLabels) Then use ClusterLabel as the grouping/facet/color variable in ggplot |
When I follow the above, the labels now appear. However, each facet now contains all the individual trajectories. I wonder if this is because the df_kml_model_traj does not have the ClusterLabel variable? |
Yes you'll need to add identical labels to that data frame too |
Hello,
Previously in plotting the individual and cluster trajectories, the individual trajectories were black, and the cluster trajectories were colored (red, blue, green, etc.) like so:
However, now this is reversed where the individual trajectories are colored and the cluster trajectories are black (my plot below). How can I revert to the original version?
Thank you!
The text was updated successfully, but these errors were encountered: