3

I'm using geom_bar_pattern to try to put stripes in an stacked barplot. I could run the command once, but I'm trying to do it again and it doesn't work. The error is

Error in seq.default(from, to, by) : invalid '(to - from)/by'

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
  • Hi Esteban. You're unlikely to get helpful answers to this question, because you haven't provided a reproducible example to help others solve your problem. Please take the [tour] if you haven't already, and check this [answer](https://stackoverflow.com/a/5963610/4676560) for help on reproducing a problem. – Captain Hat Nov 07 '22 at 10:13

3 Answers3

4

I received the same error and realized that this was due to the limited size of my screen. I was able to see the figure and resolve the error by expanding the built-in plot viewer...

EBar
  • 41
  • 2
2

I just got the same error message with geom_bar_pattern. In my case it was entirely a matter of spacing in the plot: I had a long string of text for one axis ticks. When I reduced that, I immediately got rid of the issue! Not sure if it's the same situation in your case, but I thought I'd answer just in case this could help... Good luck!

Ilaria
  • 21
  • 1
0

As the others have said, it has to do with the visualization space. If you cannot make the built-in plot viewer big enough, output the visualization to a pdf or png and it should work, something like:

p<-ggplot(Data,aes(x,y,pattern=Group))+
geom_bar_pattern()

pdf("FileName.pdf",width=12,height=9)
p
dev.off()

Then open "FileName.pdf" with a pdf reader / viewer.

Dylan_Gomes
  • 2,066
  • 14
  • 29