Commit abe33c8eba21e6dc4ceeb468fe9319a3d7d5a17b
1 parent
eedb1b6c
updated docs with plotting example
Showing
2 changed files
with
17 additions
and
12 deletions
docs/docs/api_docs/c_api/functions.md
| ... | ... | @@ -630,13 +630,18 @@ Key | Value | Description |
| 630 | 630 | --- | ---- | ----------- |
| 631 | 631 | title | [QString] | Plot title |
| 632 | 632 | size | float | Line width |
| 633 | -legendPosition | [QPointF] | Legend coordinates on plot | |
| 633 | +legendPosition | [QPointF] | Legend coordinates on plot, ex. legendPosition=(X,Y) | |
| 634 | 634 | textSize | float | Size of text for title, legend and axes |
| 635 | -xLab/yLab | [QString] | Label for x/y axis | |
| 635 | +xTitle/yTitle | [QString] | Title for x/y axis | |
| 636 | 636 | xLog/yLog | bool | Plot log scale for x/y axis |
| 637 | -xLimits/yLimits | [QPointF] | Set x/y axis limits | |
| 638 | -xLabels/yLabels | [QString] | Labels for ticks on x/y axis | |
| 639 | -xBreaks/yBreaks | [QString] | Specify breaks/ticks on x/y axis | |
| 637 | +xLimits/yLimits | [QPointF] | Set x/y axis limits, ex. xLimits=(lower,upper) | |
| 638 | +xLabels/yLabels | [QString] | Labels for ticks on x/y axis, ex. xLabeles=percent or xLabels=c(1,5,10) | |
| 639 | +xBreaks/yBreaks | [QString] | Specify breaks/ticks on x/y axis, ex. xBreaks=pretty_breaks(n=10) or xBreaks=c(1,5,10) | |
| 640 | + | |
| 641 | +If specifying plot options it is a good idea to wrap the destination file in single quotes to avoid parsing errors. | |
| 642 | +The example below plots plots the six br_eval results in the Algorithm_Dataset folder described above, sets the number of legend columns and specifies some options for the CMC plot. | |
| 643 | + | |
| 644 | +`br -plot Algorithm_Dataset/* 'destination.pdf[ncol=3,cmcOptions=[xLog=false,xLimits=(1,20),xBreaks=pretty_breaks(n=10),xTitle=Ranks 1 through 20]]'` | |
| 640 | 645 | |
| 641 | 646 | This function requires a current [R][R] installation with the following packages: |
| 642 | 647 | ... | ... |
openbr/core/plot.cpp
| ... | ... | @@ -282,7 +282,7 @@ struct RPlot |
| 282 | 282 | (opts.contains("size") ? QString(", size=I(%1)").arg(opts.get<QString>("size")) : QString()) + |
| 283 | 283 | (major.size > 1 ? QString(", colour=factor(%1)").arg(major.header) : QString()) + |
| 284 | 284 | (minor.size > 1 ? QString(", linetype=factor(%1)").arg(minor.header) : QString()) + |
| 285 | - (QString(", xlab=\"%1\", ylab=\"%2\") + theme_minimal()").arg(opts.get<QString>("xLab"), opts.get<QString>("yLab"))) + | |
| 285 | + (QString(", xlab=\"%1\", ylab=\"%2\") + theme_minimal()").arg(opts.get<QString>("xTitle"), opts.get<QString>("yTitle"))) + | |
| 286 | 286 | ((major.smooth || minor.smooth) && confidence != 0 && data != "CMC" ? QString(" + geom_errorbar(data=%1[seq(1, NROW(%1), by = 29),], aes(x=X, ymin=%2), width=0.1, alpha=I(1/2))").arg(data, flipY ? "(1-lower), ymax=(1-upper)" : "lower, ymax=upper") : QString()) + |
| 287 | 287 | (major.size > 1 ? getScale("colour", major.header, major.size) : QString()) + |
| 288 | 288 | (minor.size > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(minor.header) : QString()) + |
| ... | ... | @@ -318,10 +318,10 @@ bool Plot(const QStringList &files, const File &destination, bool show) |
| 318 | 318 | |
| 319 | 319 | // Use a br::file for simple storage of plot options |
| 320 | 320 | QMap<QString,File> optMap; |
| 321 | - optMap.insert("rocOptions", File(QString("[xLab=False Accept Rate,yLab=True Accept Rate,xLog=true,yLog=false]"))); | |
| 322 | - optMap.insert("detOptions", File(QString("[xLab=False Accept Rate,yLab=False Reject Rate,xLog=true,yLog=true]"))); | |
| 323 | - optMap.insert("ietOptions", File(QString("[xLab=False Positive Identification Rate (FPIR),yLab=False Negative Identification Rate (FNIR),xLog=true,yLog=true]"))); | |
| 324 | - optMap.insert("cmcOptions", File(QString("[xLab=Rank,yLab=Retrieval Rate,xLog=true,yLog=false,size=1,xLabels=c(1,5,10,50,100),xBreaks=c(1,5,10,50,100)]"))); | |
| 321 | + optMap.insert("rocOptions", File(QString("[xTitle=False Accept Rate,yTitle=True Accept Rate,xLog=true,yLog=false]"))); | |
| 322 | + optMap.insert("detOptions", File(QString("[xTitle=False Accept Rate,yTitle=False Reject Rate,xLog=true,yLog=true]"))); | |
| 323 | + optMap.insert("ietOptions", File(QString("[xTitle=False Positive Identification Rate (FPIR),yTitle=False Negative Identification Rate (FNIR),xLog=true,yLog=true]"))); | |
| 324 | + optMap.insert("cmcOptions", File(QString("[xTitle=Rank,yTitle=Retrieval Rate,xLog=true,yLog=false,size=1,xLabels=c(1,5,10,50,100),xBreaks=c(1,5,10,50,100)]"))); | |
| 325 | 325 | |
| 326 | 326 | foreach (const QString &key, optMap.keys()) { |
| 327 | 327 | const QStringList options = destination.get<QStringList>(key, QStringList()); |
| ... | ... | @@ -424,8 +424,8 @@ bool PlotDetection(const QStringList &files, const File &destination, bool show) |
| 424 | 424 | |
| 425 | 425 | // Use a br::file for simple storage of plot options |
| 426 | 426 | QMap<QString,File> optMap; |
| 427 | - optMap.insert("rocOptions", File(QString("[xLab=False Accepts Per Image,yLab=True Accept Rate,xLog=true,yLog=false]"))); | |
| 428 | - optMap.insert("prOptions", File(QString("[xLab=False Accept Rate,yLab=False Reject Rate,xLog=true,yLog=true]"))); | |
| 427 | + optMap.insert("rocOptions", File(QString("[xTitle=False Accepts Per Image,yTitle=True Accept Rate,xLog=true,yLog=false]"))); | |
| 428 | + optMap.insert("prOptions", File(QString("[xTitle=False Accept Rate,yTitle=False Reject Rate,xLog=true,yLog=true]"))); | |
| 429 | 429 | |
| 430 | 430 | foreach (const QString &key, optMap.keys()) { |
| 431 | 431 | const QStringList options = destination.get<QStringList>(key, QStringList()); | ... | ... |