Commit ef0a2f6e authored by Peter van 't Hof's avatar Peter van 't Hof

Remove legends on plot when there to many samples

parent b5ea73df
......@@ -208,6 +208,7 @@ object BammetricsReport extends ReportBuilder {
xlabel = xlabel,
ylabel = ylabel,
title = title,
hideLegend = results.size > 40,
removeZero = removeZero).runLocal()
}
......
......@@ -11,6 +11,7 @@ parser$add_argument('--xlabel', dest='xlabel', type='character')
parser$add_argument('--ylabel', dest='ylabel', type='character', required=TRUE)
parser$add_argument('--llabel', dest='llabel', type='character')
parser$add_argument('--title', dest='title', type='character')
parser$add_argument('--hideLegend', dest='hideLegend', type='character', default="false")
parser$add_argument('--removeZero', dest='removeZero', type='character', default="false")
arguments <- parser$parse_args()
......@@ -21,6 +22,8 @@ DF <- read.table(arguments$input, header=TRUE)
if (is.null(arguments$xlabel)) xlab <- colnames(DF)[1] else xlab <- arguments$xlabel
if (is.null(arguments$hideLegend) || arguments$hideLegend == "false") legendPosition <- "right" else legendPosition <- "none"
colnames(DF)[1] <- "Rank"
DF1 <- melt(DF, id.var="Rank")
......@@ -35,6 +38,7 @@ ggplot(DF1, aes(x = Rank, y = value, group = variable, color = variable)) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, size = 8)) +
ggtitle(arguments$title) +
theme_bw() +
theme(legend.position = legendPosition) +
geom_line()
dev.off()
......@@ -36,6 +36,7 @@ class LinePlot(val parent: Configurable) extends Rscript {
var ylabel: Option[String] = config("ylabel")
var llabel: Option[String] = config("llabel")
var title: Option[String] = config("title")
var hideLegend: Boolean = config("hide_legend", default = false)
var removeZero: Boolean = config("removeZero", default = false)
override def cmd = super.cmd ++
......@@ -47,6 +48,7 @@ class LinePlot(val parent: Configurable) extends Rscript {
ylabel.map(Seq("--ylabel", _)).getOrElse(Seq()) ++
llabel.map(Seq("--llabel", _)).getOrElse(Seq()) ++
title.map(Seq("--title", _)).getOrElse(Seq()) ++
(if (hideLegend) Seq("--hideLegend", "true") else Seq()) ++
(if (removeZero) Seq("--removeZero", "true") else Seq())
}
......@@ -57,6 +59,7 @@ object LinePlot {
xlabel: Option[String] = None,
ylabel: Option[String] = None,
width: Int = 1200,
hideLegend: Boolean = false,
removeZero: Boolean = false,
title: Option[String] = None): LinePlot = {
val plot = new LinePlot(root)
......@@ -65,6 +68,7 @@ object LinePlot {
plot.xlabel = xlabel
plot.ylabel = ylabel
plot.width = Some(width)
plot.hideLegend = hideLegend
plot.removeZero = removeZero
plot.title = title
plot
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment