Commit bf635432c45e530a02e65e7f335a1a19b6d1a8a1
1 parent
dc86a171
Text size, thickness, yLimits support added
Showing
1 changed file
with
6 additions
and
2 deletions
openbr/core/plot.cpp
| ... | ... | @@ -222,9 +222,12 @@ bool Plot(const QStringList &files, const File &destination, bool show) |
| 222 | 222 | |
| 223 | 223 | const QString title = destination.get<QString>("title", QString()); |
| 224 | 224 | const QString thickness = QString::number(destination.get<float>("thickness", 1)); |
| 225 | - const QString yLimit = QString::number(destination.get<float>("yLimit",1)); | |
| 225 | + const QString textSize = QString::number(destination.get<float>("textSize",12)); | |
| 226 | + | |
| 226 | 227 | const QPointF legendPoint = destination.get<QPointF>("legendPosition",QPointF()); |
| 227 | 228 | const QString legendPosition = legendPoint.isNull() ? "'right'" : "c" + QtUtils::toString(legendPoint); |
| 229 | + const QPointF yLimitPoint = destination.get<QPointF>("yLimits",QPointF()); | |
| 230 | + const QString yLimits = yLimitPoint.isNull() ? QString() : "c" + QtUtils::toString(yLimitPoint); | |
| 228 | 231 | |
| 229 | 232 | RPlot p(files, destination); |
| 230 | 233 | |
| ... | ... | @@ -256,7 +259,8 @@ bool Plot(const QStringList &files, const File &destination, bool show) |
| 256 | 259 | (minimalist ? "" : " + scale_x_log10(labels=c(1,5,10,50,100), breaks=c(1,5,10,50,100)) + annotation_logticks(sides=\"b\")") + |
| 257 | 260 | (p.major.size > 1 ? getScale("colour", p.major.header, p.major.size) : QString()) + |
| 258 | 261 | (p.minor.size > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minor.header) : QString()) + |
| 259 | - QString(" + theme_minimal() + theme(legend.title = element_text(size = 16)) + theme(plot.title = element_text(size = 16)) + theme(axis.text = element_text(size = 16)) + theme(axis.title.x = element_text(size = 16)) + theme(axis.title.y = element_text(size = 16)) + theme(legend.position=%1) + theme(legend.background = element_rect(fill = 'white')) + theme(panel.grid.major = element_line(colour = \"gray\")) + theme(panel.grid.minor = element_line(colour = \"gray\", linetype = \"dashed\")) + theme(legend.text = element_text(size = 16)) + scale_y_continuous(labels=percent, limits=c(0, %2))\n\n").arg(legendPosition,yLimit))); | |
| 262 | + (yLimits.isEmpty() ? QString(" + scale_y_continuous(labels=percent)") : QString(" + scale_y_continuous(labels=percent, limits=%3)").arg(yLimits)) + | |
| 263 | + QString(" + theme_minimal() + theme(legend.title = element_text(size = %1), plot.title = element_text(size = %1), axis.text = element_text(size = %1), axis.title.x = element_text(size = %1), axis.title.y = element_text(size = %1), legend.position=%2, legend.background = element_rect(fill = 'white'), panel.grid.major = element_line(colour = \"gray\"), panel.grid.minor = element_line(colour = \"gray\", linetype = \"dashed\"), legend.text = element_text(size = %1))\n\n").arg(textSize,legendPosition))); | |
| 260 | 264 | |
| 261 | 265 | p.file.write(qPrintable(QString("qplot(factor(%1)%2, data=BC, %3").arg(p.major.smooth ? (p.minor.header.isEmpty() ? "Algorithm" : p.minor.header) : p.major.header, (p.major.smooth || p.minor.smooth) ? ", Y" : "", (p.major.smooth || p.minor.smooth) ? "geom=\"boxplot\"" : "geom=\"bar\", position=\"dodge\", weight=Y") + |
| 262 | 266 | (p.major.size > 1 ? QString(", fill=factor(%1)").arg(p.major.header) : QString()) + | ... | ... |