colour changes

This commit is contained in:
Tanushree Tunstall 2022-08-13 15:40:25 +01:00
parent c6a720770d
commit c8f3ddf892
5 changed files with 34 additions and 17 deletions

View file

@ -124,6 +124,8 @@ bp_stability_hmap <- function(plot_df = merged_df3
, axis.title.y = element_text(size = my_yaxts )
, plot.title = element_text(size = my_pts
, hjust = 0.5)
, panel.grid = element_blank()
, panel.background = element_rect(fill = "transparent", colour=NA)
) +
labs(title = p_title

View file

@ -2,7 +2,8 @@
generate_distance_colour_map = function(plot_df,
xvar_colname = "position",
lig_dist_colname = "ligand_distance",
lig_dist_colours = c("green", "yellow", "orange", "red"),
#lig_dist_colours = c("green", "yellow", "orange", "red"),
lig_dist_colours = c("tan", "black"),
debug = TRUE
)
{
@ -74,9 +75,9 @@ generate_distance_legend = function(plot_df,
geom_tile(aes(fill = .data[[lig_dist_colname]])
, colour = "white") +
scale_fill_gradient2(midpoint = lig_mean
, low = "green"
, mid = "yellow"
, high = "red"
, low = "tan"
, mid = "grey50"
, high = "black"
, breaks = labels
, limits = c(lig_min, lig_max)
, labels = labelsD

View file

@ -201,7 +201,7 @@ LogoPlotSnps <- function(plot_df
cat('\nSelected colour scheme:', my_logo_col
, "\nUsing grey theme")
theme_bgc = "grey"
theme_bgc = "white"
xfont_bgc = "black"
yfont_bgc = "black"
xtt_col = "black"

View file

@ -0,0 +1,60 @@
# 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",
"green"="green",
"transparent"="transparent",
"slategrey"="slategrey",
"navyblue"="navyblue",
"purple"="purple"
),
expand=c(0,0)
) +
scale_fill_manual(values = c(
"brown"="brown",
"green"="green",
"transparent"="transparent",
"slategrey"="slategrey",
"navyblue"="navyblue",
"purple"="purple"
),
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)
}