various heat-bar/position tile faff
This commit is contained in:
parent
94454d6fba
commit
5cbaef3d36
4 changed files with 140 additions and 48 deletions
59
scripts/plotting/position_annotation.R
Normal file
59
scripts/plotting/position_annotation.R
Normal file
|
@ -0,0 +1,59 @@
|
|||
# position_annotation takes a Data Frame (df) and returns a ggplot object.
|
||||
#
|
||||
# This plots position tiles for the (up to) three ligands as well as drug
|
||||
position_annotation=function(plot_df, bg="transparent"){
|
||||
x_ats = 12
|
||||
x_tangle = 90
|
||||
x_tts = 20
|
||||
y_tts = 23
|
||||
xtt_col = "black"
|
||||
ytt_col = "black"
|
||||
leg_dir = "horizontal"
|
||||
leg_ts = 15
|
||||
leg_tts = 16
|
||||
leg_pos = "none"
|
||||
|
||||
#plot_df = generate_distance_colour_map(plot_df, debug=TRUE)
|
||||
|
||||
ggplot(plot_df,
|
||||
aes(x=factor(position), # THIS STUPID FUCKING FACTOR THING
|
||||
)
|
||||
) +
|
||||
geom_tile(aes(y=0, fill= bg_all, colour = bg_all)
|
||||
) +
|
||||
geom_tile(aes(y=1, fill= col_bg1, colour = col_bg1)
|
||||
) +
|
||||
geom_tile(aes(y=2, fill= col_bg2, colour = col_bg2)
|
||||
) +
|
||||
geom_tile(aes(y=3, fill= col_bg3, colour = col_bg3)
|
||||
) +
|
||||
|
||||
scale_x_discrete("Position", labels=factor(plot_df$position)) +
|
||||
scale_color_manual(values = c(
|
||||
"brown"="brown",
|
||||
"purple"="purple",
|
||||
"transparent"="transparent",
|
||||
"blue"="blue", "cyan"="cyan",
|
||||
"cornflowerblue"="cornflowerblue"
|
||||
),
|
||||
expand=c(0,0)
|
||||
) +
|
||||
scale_fill_manual(values = c(
|
||||
"brown"="brown",
|
||||
"purple"="purple",
|
||||
"transparent"="transparent",
|
||||
"blue"="blue",
|
||||
"cyan"="cyan",
|
||||
"cornflowerblue"="cornflowerblue"
|
||||
),
|
||||
expand=c(0,0)
|
||||
) +
|
||||
#scale_x_continuous(expand=c(0,0)) +
|
||||
#scale_y_continuous(expand=c(0,0)) +
|
||||
theme_nothing() +
|
||||
|
||||
theme(plot.background = element_rect(fill = bg, colour=NA),
|
||||
plot.margin = margin(t=0,b=0)) +
|
||||
labs(x = NULL, y = NULL)
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue