Skip to content

Commit

Permalink
update log2 and log10 axis and bar labels
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeConway committed Nov 29, 2016
1 parent af117bc commit d9000cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions R/MainBar.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ Make_main_bar <- function(Main_bar_data, Q, show_num, ratios, customQ, number_an

if(ylabel == "Intersection Size" && scale_intersections != "identity"){
ylabel <- paste("Intersection Size", paste0("( ", scale_intersections, " )"))
if(scale_intersections == "log2"){
Main_bar_data$freq <- round(log2(Main_bar_data$freq))
ymax <- log2(ymax)
}
if(scale_intersections == "log10"){
Main_bar_data$freq <- round(log10(Main_bar_data$freq))
ymax <- log10(ymax)
}
}

Main_bar_plot <- (ggplot(data = Main_bar_data, aes_string(x = "x", y = "freq"))
Expand Down
8 changes: 7 additions & 1 deletion R/SizeBar.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ Make_size_plot <- function(Set_size_data, sbar_color, ratios, ylabel, scale_sets

if(ylabel == "Set Size" && scale_sets != "identity"){
ylabel <- paste("Set Size", paste0("( ", scale_sets, " )"))
if(scale_sets == "log2"){
Set_size_data$y <- log2(Set_size_data$y)
}
if(scale_sets == "log10"){
Set_size_data$y <- log10(Set_size_data$y)
}
}

Size_plot <- (ggplot(data = Set_size_data, aes_string(x ="x", y = "y"))
Expand All @@ -66,7 +72,7 @@ Make_size_plot <- function(Set_size_data, sbar_color, ratios, ylabel, scale_sets
plot.margin=unit(c(-0.11,-1.3,0.5,0.5), "lines"),
axis.title.x = element_text(size = 8.3*x_axis_title_scale),
axis.text.x = element_text(size = 7*x_axis_tick_label_scale, angle = set_size_angle,
vjust = 1, hjust = 1),
vjust = 1, hjust = 0.5),
axis.line = element_line(colour = "gray0"),
axis.line.y = element_blank(),
axis.line.x = element_line(colour = "gray0", size = 0.3),
Expand Down

0 comments on commit d9000cf

Please sign in to comment.