First some data is added to the internal datastore (mostly, like explained in several other examples, like e.g. Line Graph with Different Symbols and Line Styles). The (in a loop) several graphs are added, each with a distinct style for its error indicators:
QVector<JKQTPErrorPlotstyle> errorStyles {
JKQTPNoError,
JKQTPErrorBars,
JKQTPErrorSimpleBars,
JKQTPErrorLines,
JKQTPErrorPolygons,
JKQTPErrorBoxes,
JKQTPErrorEllipses,
JKQTPErrorBarsPolygons,
JKQTPErrorBarsLines,
JKQTPErrorSimpleBarsLines,
JKQTPErrorSimpleBarsPolygons };
QVector<bool> showXandYError { false , true , true , false , false , true , true , false , false , false , false };
for (int errorID=0; errorID<errorStyles.size(); errorID++) {
QVector<double> Y;
for (auto& xx: X) {
Y<<xx*0.5+static_cast<double>(errorID)*2.5;
}
graph->
setYColumn(ds->addCopiedColumn(Y,
"y"+QString::number(errorID)));
if (showXandYError[errorID]) {
}
c.setAlphaF(0.3);
plot.addGraph(graph);
}
QColor getErrorFillColor() const
get the fill color of the error indicators
void setErrorBarCapSize(double __value)
size of the error bar end markers [pt]
void setErrorLineWidth(double __value)
set the width [pt] of the error indicator (out)lines
void setErrorFillColor(const QColor &__value)
set the fill color of the error indicators
void setLineWidth(double __value)
set the line width of the graph line (in pt)
void setLineStyle(Qt::PenStyle __value)
set the style of the graph line
void setSymbolLineWidth(double __value)
set the line width of the graph symbol outline (in pt)
void setSymbolSize(double __value)
set the size (=diameter in pt) of the graph symbol (in pt)
void setSymbolType(JKQTPGraphSymbols __value)
set the type of the graph symbol
virtual void setTitle(const QString &__value)
sets the title of the plot (for display in key!).
void setXErrorColumn(int __value)
the column that contains the error of the x-component of the datapoints
void setXErrorStyle(JKQTPErrorPlotstyle __value)
how to draw the errors (if available) of the x-value
void setYColumn(int __value)
the column that contains the y-component of the datapoints
void setXColumn(int __value)
the column that contains the x-component of the datapoints
This implements xy line plots with x and y error indicators.
Definition jkqtplines.h:113
void setDrawLine(bool __value)
indicates whether to draw a line or not
void setYErrorColumn(int __value)
the column that contains the error of the x-component of the datapoints
void setYErrorStyle(JKQTPErrorPlotstyle __value)
how to draw the errors (if available) of the x-value
JKQTPLOTTER_LIB_EXPORT QString JKQTPErrorPlotstyle2String(JKQTPErrorPlotstyle pos)
converts a JKQTPErrorPlotstyle variable into a human-readable string
@ JKQTPErrorSimpleBars
simplified error bars for each data point
Definition jkqtptools.h:693
@ JKQTPErrorBarsPolygons
error bars and polygons for each data point
Definition jkqtptools.h:719
@ JKQTPErrorEllipses
an ellipse spanned by the errors
Definition jkqtptools.h:696
@ JKQTPErrorLines
a second and third graph line above and below the actual data which indicates the error value
Definition jkqtptools.h:694
@ JKQTPErrorPolygons
line error lines, but with filled range in between
Definition jkqtptools.h:695
@ JKQTPNoError
don't show error information
Definition jkqtptools.h:692
@ JKQTPErrorBoxes
a box spanned by the errors
Definition jkqtptools.h:697
@ JKQTPErrorSimpleBarsPolygons
simplified error barsand polygons for each data point
Definition jkqtptools.h:712
@ JKQTPErrorSimpleBarsLines
simplified error bars and line for each data point
Definition jkqtptools.h:713
@ JKQTPErrorBarsLines
error bars and lines for each data point
Definition jkqtptools.h:718
@ JKQTPErrorBars
error bars for each data point
Definition jkqtptools.h:711
There are several variables that can be used to further style the error indicator, like:
In addition the plot key is moved outside the pot and the grid in the plot is switched off:
plot.getXAxis()->setDrawGrid(false);
plot.getXAxis()->setDrawMinorGrid(false);
plot.getYAxis()->setDrawGrid(false);
plot.getYAxis()->setDrawMinorGrid(false);
@ JKQTPKeyOutsideRightTop
the key is positioned on the left side of the graph, towards the top
Definition jkqtptools.h:579