| 269 | // Properly |
| 270 | |
| 271 | bool PlotDetection(const QStringList &files, const File &destination, bool show) |
| 272 | { |
| 273 | qDebug("Plotting %d detection file(s) to %s", files.size(), qPrintable(destination)); |
| 274 | RPlot p(files, destination); |
| 275 | p.file.write("\nformatData(type=\"detection\")\n\n"); |
| 276 | |
| 277 | // Use a br::file for simple storage of plot options |
| 278 | QMap<QString,File> optMap; |
| 279 | optMap.insert("rocOptions", File(QString("[xTitle=False Accepts Per Image,yTitle=True Accept Rate,xLog=true,yLog=false]"))); |
| 280 | optMap.insert("prOptions", File(QString("[xTitle=False Accept Rate,yTitle=False Reject Rate,xLog=true,yLog=true]"))); |
| 281 | |
| 282 | foreach (const QString &key, optMap.keys()) { |
| 283 | const QStringList options = destination.get<QStringList>(key, QStringList()); |
| 284 | foreach (const QString &option, options) { |
| 285 | QStringList words = QtUtils::parse(option, '='); |
| 286 | QtUtils::checkArgsSize(words[0], words, 1, 2); |
| 287 | optMap[key].set(words[0], words[1]); |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | QString plotType("line"); |
| 292 | if (filesHaveSinglePoint(files)) |
| 293 | plotType = QString("point"); |
| 294 | |
| 295 | QString plot = "plot <- plotLine(lineData=%1, options=list(%2), flipY=%3, geometry=%4)\nplot\n"; |
| 296 | foreach (const QString &type, QStringList() << "Discrete" << "Continuous") { |
| 297 | optMap["rocOptions"].set("title", type); |
| 298 | p.file.write(qPrintable(QString(plot).arg(type + "ROC", toRList(optMap["rocOptions"]), "FALSE", "\"" + plotType + "\""))); |
| 299 | } |
| 300 | |
| 301 | foreach (const QString &type, QStringList() << "Discrete" << "Continuous") { |
| 302 | optMap["prOptions"].set("title", type); |
| 303 | p.file.write(qPrintable(QString(plot).arg(type + "PR", toRList(optMap["prOptions"]), "FALSE", "\"" + plotType + "\""))); |
| 304 | } |
| 305 | p.file.write("plot <- plotOverlap(overlapData=Overlap)\nplot\n"); |
| 306 | |
| 307 | p.file.write(qPrintable(QString("ggplot(AverageOverlap, aes(x=%1, y=%2, label=round(X,3)), main=\"Average Overlap\") + geom_text() + theme_minimal()").arg(p.minor.size > 1 ? p.minor.header : "'X'", p.major.size > 1 ? p.major.header : "'Y'") + |
| 308 | QString("%1%2\n\n").arg(p.minor.size > 1 ? "" : " + xlab(NULL)", p.major.size > 1 ? "" : " + ylab(NULL)"))); |
| 309 | |
| 310 | p.file.write(qPrintable(QString("ggplot(AverageOverlap, aes(x=%1, y=%2, fill=X)) + geom_tile() + scale_fill_continuous(\"Average Overlap\", guide=FALSE) + theme_minimal()").arg(p.minor.size > 1 ? p.minor.header : "'X'", p.major.size > 1 ? p.major.header : "'Y'") + |
| 311 | QString("%1%2\n\n").arg(p.minor.size > 1 ? "" : " + xlab(NULL)", p.major.size > 1 ? "" : " + ylab(NULL)"))); |
| 312 | |
| 313 | return p.finalize(show); |
| 314 | } |
| 315 | |
| 316 | bool PlotLandmarking(const QStringList &files, const File &destination, bool show) |
| 317 | { |
no test coverage detected