Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only label selected breaks

Tags:

r

ggplot2

Due to space constraints on the axes (log-transformed) I would like to only label select breaks while displaying breaks for a continuous sequence. Of course the following results in an error:

scale_x_continuous(breaks=c(-10,0,10,20,30),labels=c(-10,0,10,30))

Error: breaks and labels have unequal lengths

Is there a method to get around this problem?

like image 518
interpost Avatar asked Mar 18 '23 05:03

interpost


1 Answers

Please try:

scale_x_continuous(breaks=c(-10,0,10,20,30), labels=c(-10,0,10,"",30))
like image 122
KFB Avatar answered Mar 26 '23 03:03

KFB