Reputation: 41
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'
Upvotes: 4
Views: 2985
Reputation: 2242
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.
Upvotes: 1
Reputation: 51
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...
Upvotes: 5
Reputation: 21
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!
Upvotes: 2