minor tweaks in logo and corr plots
This commit is contained in:
parent
8ddca4a8b1
commit
40e4ddd70a
3 changed files with 24 additions and 9 deletions
|
@ -59,6 +59,9 @@ cat(paste0("Variables imported:"
|
||||||
corr_ps = "corr_PS.svg"
|
corr_ps = "corr_PS.svg"
|
||||||
plot_corr_ps = paste0(plotdir,"/", corr_ps)
|
plot_corr_ps = paste0(plotdir,"/", corr_ps)
|
||||||
|
|
||||||
|
corr_ps_duet_col = "corr_PS_duet_coloured.svg"
|
||||||
|
plot_corr_ps_duet_col = paste0(plotdir,"/", corr_ps_duet_col)
|
||||||
|
|
||||||
corr_upper_ps = "corr_upper_PS.svg"
|
corr_upper_ps = "corr_upper_PS.svg"
|
||||||
plot_corr_upper_ps = paste0(plotdir,"/", corr_upper_ps)
|
plot_corr_upper_ps = paste0(plotdir,"/", corr_upper_ps)
|
||||||
|
|
||||||
|
@ -193,10 +196,12 @@ head(my_corr_ps)
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
# generate corr PS plot 1: both panels
|
# generate corr PS plot 1: both panels
|
||||||
#---------------------------------------
|
#---------------------------------------
|
||||||
|
cat("Corr plot PS DUET with coloured dots:", plot_corr_ps)
|
||||||
cat("Corr plot PS:", plot_corr_ps)
|
|
||||||
svg(plot_corr_ps, width = 15, height = 15)
|
svg(plot_corr_ps, width = 15, height = 15)
|
||||||
|
|
||||||
|
#cat("Corr plot PS DUET with coloured dots:",plot_corr_ps_duet_col)
|
||||||
|
#svg(plot_corr_ps_duet_col, width = 15, height = 15)
|
||||||
|
|
||||||
OutPlot1 = pairs.panels(my_corr_ps[1:(length(my_corr_ps)-1)]
|
OutPlot1 = pairs.panels(my_corr_ps[1:(length(my_corr_ps)-1)]
|
||||||
, method = "spearman" # correlation method
|
, method = "spearman" # correlation method
|
||||||
, hist.col = "grey" ##00AFBB
|
, hist.col = "grey" ##00AFBB
|
||||||
|
|
|
@ -173,7 +173,6 @@ p3 = p2 +
|
||||||
|
|
||||||
p3
|
p3
|
||||||
|
|
||||||
|
|
||||||
# Now combine using cowplot, which ensures the plots are aligned
|
# Now combine using cowplot, which ensures the plots are aligned
|
||||||
suppressMessages( require(cowplot) )
|
suppressMessages( require(cowplot) )
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,7 @@ wide_df_or <- logo_data_or %>% spread(position, or_mychisq, fill = 0.0)
|
||||||
wide_df_or = as.matrix(wide_df_or)
|
wide_df_or = as.matrix(wide_df_or)
|
||||||
rownames(wide_df_or) = wide_df_or[,1]
|
rownames(wide_df_or) = wide_df_or[,1]
|
||||||
wide_df_or = wide_df_or[,-1]
|
wide_df_or = wide_df_or[,-1]
|
||||||
|
str(wide_df_or)
|
||||||
|
|
||||||
position_or = as.numeric(colnames(wide_df_or))
|
position_or = as.numeric(colnames(wide_df_or))
|
||||||
|
|
||||||
|
@ -124,22 +125,32 @@ position_or = as.numeric(colnames(wide_df_or))
|
||||||
#============================================
|
#============================================
|
||||||
# custom height (OR) logo plot: yayy works
|
# custom height (OR) logo plot: yayy works
|
||||||
|
|
||||||
ggseqlogo(wide_df_or, method="custom", seq_type="aa") + ylab("my custom height") +
|
cat("Logo plot with OR as y axis:", plot_logo_plot)
|
||||||
theme(legend.position = "bottom"
|
svg(plot_logo_plot, width = 30 , height = 6)
|
||||||
, axis.text.x = element_text(size = 11
|
|
||||||
|
logo_or = ggseqlogo(wide_df_or, method="custom", seq_type="aa") + ylab("my custom height") +
|
||||||
|
theme( axis.text.x = element_text(size = 16
|
||||||
, angle = 90
|
, angle = 90
|
||||||
, hjust = 1
|
, hjust = 1
|
||||||
, vjust = 0.4)
|
, vjust = 0.4)
|
||||||
, axis.text.y = element_text(size = 15
|
, axis.text.y = element_text(size = 22
|
||||||
, angle = 0
|
, angle = 0
|
||||||
, hjust = 1
|
, hjust = 1
|
||||||
, vjust = 0))+
|
, vjust = 0)
|
||||||
scale_x_discrete("Position"
|
, axis.title.y = element_text(size = 25)
|
||||||
|
, axis.title.x = element_text(size = 20)
|
||||||
|
#, legend.position = "bottom") +
|
||||||
|
, legend.position = "none")+
|
||||||
|
#, legend.text = element_text(size = 15)
|
||||||
|
#, legend.title = element_text(size = 15))+
|
||||||
|
scale_x_discrete("Position"
|
||||||
#, breaks
|
#, breaks
|
||||||
, labels = position_or
|
, labels = position_or
|
||||||
, limits = factor(1:length(position_or))) +
|
, limits = factor(1:length(position_or))) +
|
||||||
ylab("Odds Ratio")
|
ylab("Odds Ratio")
|
||||||
|
|
||||||
|
print(logo_or)
|
||||||
|
dev.off()
|
||||||
#%% end of logo plot with OR as height
|
#%% end of logo plot with OR as height
|
||||||
|
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue