You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for writing a really helpful script! I am trying to change the y-axis of the top panel in a facet_wrap but having a little trouble. I would like the y-axis of the top facet to go from 0 to 600 in increments of 200. My script and a few details on the data set are below. The current script simply returns the same set of facets as would be produced without the facetted_pos_scales arguments. I could get the middle facet to reverse the y-axis using the example you provided but can't quite figure out how to do my specific task.
Hello -
Thanks for writing a really helpful script! I am trying to change the y-axis of the top panel in a facet_wrap but having a little trouble. I would like the y-axis of the top facet to go from 0 to 600 in increments of 200. My script and a few details on the data set are below. The current script simply returns the same set of facets as would be produced without the facetted_pos_scales arguments. I could get the middle facet to reverse the y-axis using the example you provided but can't quite figure out how to do my specific task.
subsetbar %>% ggplot(aes(x=total,y=n,fill=sum_type)) + geom_bar(stat = "identity",position=position_dodge(.7)) +
facet_wrap(sum_type ~.,ncol=1,scales = "free_y") +
scale_x_continuous(breaks = seq(0,70,4),labels = seq(0,70,4)) + theme_bw() +
xlab("total gene copies across haplotypes") + ylab("number of genes") +
theme(legend.text=element_text(size=20),legend.title = element_text(size = 20),strip.text.x = element_blank()) +
#facetted_pos_scales(y = list(NULL, scale_y_continuous(trans = "reverse")))
facetted_pos_scales(y = list(sum_type == "sumAC" ~ scale_y_continuous(breaks = seq(0,600,200))))
A tibble: 6 × 3
Groups: sum_type [1]
sum_type total n
1 sumAC 0 15
2 sumAC 1 13
3 sumAC 2 10
4 sumAC 3 8
5 sumAC 4 6
6 sumAC 5 10
example_facet_wrap.pdf
The text was updated successfully, but these errors were encountered: