For example, if you want the vertical extent of the plot to be, say 3', then you would need to shrink the horizontal extent until you get a small enough distance between tick marks. Change distance between x-axis ticks in ggplot2 Ask Question Asked 10 years, 5 months ago Modified 9 years, 1 month ago Viewed 32k times Part of R Language Collective 9 Right now I am producing a line graph with three observations. If we want to adjust the positioning of our label text, we can use the theme and elementtext functions as well as the and the vjust commands of the ggplot2 package. Now we’ll combine the two plots with patchwork. To reduce the physical distance between tick marks, you would need to change the aspect ratio of the plot. These parameters are put into used to change in spacing between axis ticks in the base plot. P_top <- ggplot(tg, aes( x = factor(dose), y = len)) + geom_jitter( aes( shape = factor(dose)), width = 0.2, size = 2) + scale_shape_prism() + coord_cartesian( ylim = c( 1140, 1160)) + scale_y_continuous( breaks = c( 1140, 1160)) + guides( y = "prism_offset_minor") theme_outlier <- function( palette = "black_and_white", base_size = 14, base_family = "sans", base_fontface = "bold", base_line_size = base_size / 14, base_rect_size = base_size / 14, axis_text_angle = 0, border = FALSE) p_top <- p_top + theme_outlier() p_top Method 1: Using xaxp & yaxp method The first tick mark, last tick, and a number of tick mark parameters are given represented by a,b,c shown in the below syntax.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |