Replies: 2 comments 3 replies
-
From eyeballing the code, it looks like you misplaced a parenthesis. list(p_category == "up" ~ scale_y_continuous(breaks = c(100),labels=c("no p-value")),
p_category == "middle" ~ scale_y_continuous(limits = c(0,3))) |
Beta Was this translation helpful? Give feedback.
-
Sorry, I cannot reproduce the issue. Where is In addition, if this is just about getting help with this problem, please try a site like stackoverflow first, as the pool of people who might know the solution to the problem is likely much larger. If it turns out it is a bug, please feel free to file a report. |
Beta Was this translation helpful? Give feedback.
-
I am trying to use facetted_pos_scales from ggh4x to change my y-axis parameters within my panels. I am using it in combination with facet_grid, but unfortunately I keep getting the error Input must be a vector, not
NULL
with everything I try.When I try similar things with the Iris dataset, I do not get the same error. I hope you can help me.
The code for my plot is:
plot_object<-ggplot(data, aes(log2_fold_change, minus_log10_p_value_bh_adj)) +
geom_vline(xintercept = 0, linetype = "dashed") +
geom_hline(data=filter(test_volcano, p_category=="middle"), aes(yintercept=1.3),linetype="dashed") +
geom_violin(data=test_volcano[test_volcano$log2_fold_change== -100,],aes(log2_fold_change, minus_log10_p_value_bh_adj),width=3,color="grey",trim=F,bounds=c(0,Inf))+
geom_violin(data=test_volcano[test_volcano$log2_fold_change== 100,],aes(log2_fold_change, minus_log10_p_value_bh_adj),width=3,color="grey",trim=F,bounds=c(0,Inf))+
geom_violin(data=test_volcano[test_volcano$minus_log10_p_value_bh_adj== 100,],aes(log2_fold_change, minus_log10_p_value_bh_adj),width=0.125,color="grey",trim=F)+
geom_point(aes(fill = lipid_class,alpha=Significant),size = 3, shape = 21, stroke = 0.2,color="white") +
scale_alpha_discrete(range = c(0.3, 1))+
scale_fill_manual(values = color_vector) +
guides(alpha = "none") +
scale_x_continuous(limits = c(-105,105),breaks = c(-100,-2,-1,0,1,2,100), labels = c("only\npresent\nin group A",-2,-1,0,1,2,"only\npresent\nin group B")) +
scale_x_break(c(-95, -2),scales=7)+
scale_x_break(c(2, 95))+
labs(x = "log2(fold change)", y = "-log10(BH adjusted p-value)", fill = "Lipid class",
title=" ") +
theme_classic()+
theme(axis.title.x.top = element_blank(),
axis.text.x.top = element_blank(),
axis.ticks.x.top = element_blank(),
axis.line.x.top = element_blank(),
text = element_text(size = 14),
strip.text.y = element_blank())+
facet_grid(p_category~.,scales = "free_y",space="free_y")
plot_object+
facetted_pos_scales(
y = list(p_category == "up" ~ scale_y_continuous(breaks = c(100),labels=c("no p-value"),
p_category == "middle" ~ scale_y_continuous(limits = c(0,3))))
I added my dataframe as csv here, because I think I will not get the error with a randomly produced dataset.
data_for_plot.csv
Beta Was this translation helpful? Give feedback.
All reactions