You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you so much for this package -- it's been really helpful for visualisations!
This is not a big issue, but I'm trying to adjust the visualisations (colours, text size, etc) and not sure whether these functions are compatible with the usual ggplot functions?
For example, this works great:
pathway_pca(abundance = metacyc_abundance %>% column_to_rownames("pathway"),
metadata = metadata, group = "Plot")
But when I try to adjust with custom colours, nothing changes.
Thank you for your question and for using our package! I understand your desire to customize the visualizations using familiar ggplot2 syntax. While we would love to directly support ggplot2 functions, there are some limitations due to our use of the ggh4x package.
However, you can still achieve the customization you're looking for by accessing and modifying the individual layers of the plot. Here's how you can adjust the colors in your example:
pca_picrust<- pathway_pca(abundance=metacyc_abundance %>% column_to_rownames("pathway"),
metadata=metadata,
group="Plot")
plot_colors<- c("#DD5129", "#FAB255", "#0F7BA2", "#43B284", "#4c2f61")
# Modify the color scale of the specific layerpca_picrust$layers[[2]]$aes_params$colour<-NULLpca_picrust$layers[[2]]$mapping$colour<- quote(Plot)
pca_picrust+ scale_color_manual(values=plot_colors)
In this approach, we're first removing the hard-coded color mapping from the second layer (which typically contains the points), and then reassigning the color mapping to the 'Plot' variable. After these modifications, the scale_color_manual() function should work as expected.
For other ggplot2 customizations, you may need to use a similar approach of identifying and modifying specific layers. While it's not as straightforward as direct ggplot2 syntax, it does provide a way to achieve the customizations you're looking for.
We appreciate your feedback and will continue to explore ways to make our package more compatible with standard ggplot2 functions in future updates. If you have any more questions or need further clarification, please don't hesitate to ask!
Thank you so much for this package -- it's been really helpful for visualisations!
This is not a big issue, but I'm trying to adjust the visualisations (colours, text size, etc) and not sure whether these functions are compatible with the usual ggplot functions?
For example, this works great:
pathway_pca(abundance = metacyc_abundance %>% column_to_rownames("pathway"),
metadata = metadata, group = "Plot")
But when I try to adjust with custom colours, nothing changes.
plot_colors <- c("#DD5129", "#FAB255", "#0F7BA2", "#43B284", "#4c2f61")
pca_picrust <- pathway_pca(abundance = metacyc_abundance %>% column_to_rownames("pathway"),
metadata = metadata, group = "Plot")
pca_picrust + scale_color_manual(values = plot_colors)
The text was updated successfully, but these errors were encountered: