0

I've tried everywhere to find a solution for my problem, without success. In my company we have a R project, where we use our own colors to print the plots. One of our colleagues is having trouble with it, and we can't figure it out why (since the plot is working fine for all other colleagues and we all -including her- have the same version of R, R Studio and packages).

The problem is when she is printing the plots, the legend is totally weird and printing way more information (from other plots). We tried everything we could think of...

Unfortunetely I can't display the whole code/plots since is confidential information, but I hope this can help:

correct plot should look like this

incorrect plot look like this

The code is more or less, this one:

  ggplot(df , aes(x = factor(columnA), y = value ,fill=factor(variable))) +
  geom_bar(stat='identity',position="stack")+
  labs(x=element_blank(),y="label")+
  scale_x_discrete(breaks = df$columnA ,labels=str_wrap(df$columnB, 15) ) +
  ggtitle("Confidential tile") +
  theme_ourown + #we have our own theme as well
  theme(panel.grid.major = element_line(colour = "grey90"),
        axis.ticks = element_blank(), axis.title = element_blank(), axis.text.x = element_text(colour = "grey30"),
        axis.text.y = element_blank(), legend.title = element_blank(), plot.title = element_text(hjust = 0.5),
        legend.text = element_text(size = rel(1.33)), legend.key.size = unit(1, "cm")) +
  scale_fill_manual(values = report_colours) + #here is our colors
  coord_polar()

Well, thank you all in advance!

stefan
  • 90,330
  • 6
  • 25
  • 51
  • Welcome to SO! It would be easier to help you if you provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including a snippet of your data or some fake data. If you want to post your data type `dput(df)` into the console and copy the output starting with `structure(....` into your post. We don't need you real data. Some fake data with the same data types is sufficient, e.g. you could replace your labels by `LETTERS`. Same for the colors. – stefan Sep 28 '22 at 17:33

0 Answers0