0

Look I will put 2 images of the same plot, the only thing I made was changing the size of it, expanding the size of the plot to the sizes before saving it as an image. But the code is the same in both plots. How can I make this not to happen?

enter image description here

here I attach same plot with different size, see how much change the columns, now there is a new column with máximum of 15 that was not before !!!:

enter image description here

Here I attach my code for the plot:

plot<-ggplot(DT,aes(x=Date,y=n_per_week,fill=var2))+
  geom_bar(stat="identity", size= 4)+
  theme(plot.title = element_text(hjust = 0.5))+
  ylab("N")+xlab("Date (Month-Year)")+
  scale_x_date(date_labels = "%m-%y")+
  theme_minimal(base_size = 11, base_family = "")

How can I make this changes not to happen !!

Thanks in advance !

  • Do you by any chance happen to have a `limits` argument somewhere in your code, and do you get a warning message that some data was removed when you create your first plot? – coffeinjunky Aug 07 '18 at 06:38
  • Hi coffeinjunky, the code I use is the one I attached below. So I dont have any limits argument, and I dont receive any warning message. Thanks btw. – Rafa Coderch Aug 07 '18 at 06:41
  • 2
    Can you add the data to make the problem reproducable? And could you post what exactly you have changed in the code? – coffeinjunky Aug 07 '18 at 06:44
  • the code is the same in both plots. I just expanded the plot a Little bit to the sizes. I will try to make a fake dataset to share ! – Rafa Coderch Aug 07 '18 at 06:49
  • 1
    It's not just that some bars dissapear, but the bars that seem to match position are sometimes completely different sizes. Either something very funky is going on, or more likely, you by accident changed something more than just the size... – Axeman Aug 07 '18 at 08:33
  • Hi Axeman, thanks for the answer, I just changed the size. I didnt touch a single line of code between these 2 plots. Maybe it has something to do with this line : scale_x_date(date_labels = "%m-%y") ? Every movement I do in the size while I am viewing the plot the columns change. – Rafa Coderch Aug 07 '18 at 09:31
  • 1
    @RafaCoderch: Please share sample of your data using `dput()` (not `str` or `head` or picture/screenshot) so others can help. See more here https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example?rq=1 – Tung Aug 07 '18 at 13:07
  • The lines are very thin - sometimes they render and sometimes they don't. I would try setting `width` (perhaps `size` will work) to make the bars thicker. They might then overlap, but at least you can see them – Richard Telford Aug 07 '18 at 16:30

0 Answers0