cafferychen777 / ggpicrust2

Make Picrust2 Output Analysis and Visualization Easier
https://cafferychen777.github.io/ggpicrust2/
MIT License
109 stars 13 forks source link

Error in `plot_theme()`: ! The `legend.text.align` theme element is not defined in the element hierarchy. #98

Closed lananh-ngn closed 8 months ago

lananh-ngn commented 8 months ago

Hello, thank you for developing this package. Describe the Bug I tried to run with the example data. It works after calling ggpicrust2() ("ggpicrust2 analysis completed"). However, when I call with results_file_input[[1]]$plot, I have the following error:

Error in `plot_theme()`:
! The `legend.text.align` theme element is not defined in the element hierarchy.
data(ko_abundance)
data(metadata)
results_file_input <- ggpicrust2(data = ko_abundance,
                                 metadata = metadata,
                                 group = "Environment",
                                 pathway = "KO",
                                 daa_method = "LinDA",
                                 ko_to_kegg = TRUE,
                                 order = "pathway_class",
                                 p_values_bar = TRUE,
                                 x_lab = "pathway_name")
results_file_input[[1]]$plot

Similarly, Describe the Bug When I run with MetaCyc pathway, I get the following error:

Error in `guide_transform()`:
! <Guide> classes have been rewritten as <ggproto> classes.
The old S3 guide methods have been superseded..
data(metacyc_abundance)
results_file_input <- ggpicrust2(data = metacyc_abundance,
                                 metadata = metadata,
                                 group = "Environment",
                                 pathway = "MetaCyc",
                                 daa_method = "LinDA",
                                 ko_to_kegg = FALSE,
                                 order = "group",
                                 p_values_bar = TRUE,
                                 x_lab = "description")
results_file_input[[1]]$plot

Environment Information:

Thank you in advance, Best.

EDIT: Apparently, it comes from an incompatibility between ggplot2 and ggprism.

lananh-ngn commented 8 months ago

The solution for me was to downgrade to ggplot2 3.4.0.

cafferychen777 commented 8 months ago

Hello Lan Anh,

Thank you for your message and for using ggpicrust2. I'm glad to hear that downgrading to ggplot2 version 3.4.0 resolved the issue you encountered. Your feedback is valuable, and I appreciate you sharing your solution with the community.

If you have any further questions or encounter any other issues, please feel free to reach out.

Best regards, Chen YANG