cafferychen777 / ggpicrust2

Make Picrust2 Output Analysis and Visualization Easier
https://cafferychen777.github.io/ggpicrust2/
Other
92 stars 11 forks source link

pathway_errorbar(): color was not mapped on the road when saving #49

Closed kestlermai closed 10 months ago

kestlermai commented 10 months ago

Hello @cafferychen777, I used the ggsave function to save the pathway_errorbar in pdf format, and found that the color was not mapped on the road, but was saved in png format, so the color could normally mapp in the road. What's the problem? Code: library(ggpicrust2) library(tidyverse) library(GGally) library(ggprism) library(patchwork) library(ggh4x) data("ko_abundance") data("metadata") kegg_abundance <- ko2kegg_abundance(data = ko_abundance) daa_results_df <- pathway_daa(kegg_abundance, metadata = metadata, group = "Environment", daa_method = "LinDA") daa_annotated_results_df <- pathway_annotation(pathway = "KO", daa_results_df = daa_results_df, ko_to_kegg = TRUE) pathway_errorbar(abundance = kegg_abundance, daa_results_df = daa_annotated_results_df, Group = metadata$Environment, ko_to_kegg = TRUE, p_values_threshold = 0.05, order = "pathway_class", select = NULL, p_value_bar = TRUE, colors = NULL, x_lab = "pathway_name") ggsave(filename = "pathway_errobar1.pdf", width = 35, height = 15, units = "cm", dpi = 600) ggsave(filename = "pathway_errobar1.png", width = 35, height = 15, units = "cm", dpi = 600)

pathway_errobar1.pdf pathway_errobar1

cafferychen777 commented 10 months ago

Hello @kestlermai,

Thank you for sharing the details. I'm not quite clear on what you mean by "the color was not mapped on the road". Could you please elaborate on this issue a bit more or possibly share a visual comparison between the PNG and PDF outputs? This will help me better understand the problem and provide a potential solution.

Best regards,

Chen YANG

kestlermai commented 10 months ago

Thank you for your reply, maybe I'm not clear enough. My question is as follows:

When I used the ggsave function to save the pathway_errorbar in png format, like in the picture below: the color is displayed normally. ggsave(filename = "pathway_errobar1.png", width = 35, height = 15, units = "cm", dpi = 600) pathway_errobar1

When I used the ggsave function to save the pathway_errorbar in pdf format, as shown in the figure below: ggsave(filename = "pathway_errobar1.pdf", width = 35, height = 15, units = "cm", dpi = 600)

1692526895773
cafferychen777 commented 10 months ago

Hello @kestlermai ,

Thank you for providing more details. I used the same code on my end and the output appears normal for both PNG and PDF formats. It's possible that the issue might be related to your R version or even something specific to your computer. I recommend trying on a different computer or updating your R version to see if it resolves the issue.

Best regards,

Chen YANG

Screenshot 2023-08-20 at 18 49 35
kestlermai commented 10 months ago

Thank you very much for your reply, I fixed this problem after updating my R version