JKQTPlotter: IMPROVED/REWORKED: reworked JKQTPErrorPlotstyle and error indicator plotting so error-inidcators can be specified as ORed combination of flags from JKQTPErrorPlotstyleElements, added additional error indicator styles (half-bars, arrows...)

This commit is contained in:
jkriege2 2022-09-14 22:03:46 +02:00
parent 16df80c8c7
commit 3c22130902
46 changed files with 281 additions and 128 deletions

View File

@ -106,6 +106,14 @@ if(JKQtPlotter_BUILD_TOOLS)
)
add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listlinedecorators)
add_custom_target(JKQTPlotter_GenerateDocImages_listerrorindicators
COMMENT "Building JKQTPlotter Documentation Images: listerrorindicators"
COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --listerrorindicators --iconsize=32 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/errorindicators/"
WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR}
DEPENDS jkqtplotter_doc_imagegenerator
)
add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listerrorindicators)
endif(JKQtPlotter_BUILD_TOOLS)

View File

@ -28,6 +28,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
<li>FIXED plot-size calculation for filled graphs</li>
<li>REORGANIZED: separated line-graphs from jkqtpscatter.h/.cpp into jkqtplines.h/.cpp</li>
<li>IMPROVED: QT6-compatibility by removing deprecated warnings</li>
<li>IMPROVED/REWORKED: reworked JKQTPErrorPlotstyle and error indicator plotting so error-inidcators can be specified as ORed combination of flags from JKQTPErrorPlotstyleElements, added additional error indicator styles (half-bars, arrows...)</li>
<li>NEW: JKQTPFilledCurveXGraph and JKQTPFilledCurveYGraph can now plot wiggle plots with different fill styles above and below the baseline (feature request <a href="https://github.com/jkriege2/JKQtPlotter/issues/68">#68 Wiggle Plots</a> from <a href="https://github.com/xichaoqiang">user:xichaoqiang</a> </li>
<li>NEW/BREAKING CHANGE: data tooltip can now also be shown when "just" moving the mouse (so far this was only possible when dragging the mouse with a button pressed). This also removes JKQtPlotter::getActMouseLeftAsToolTip() and adds JKQtPlotter::getActMouseMoveToolTip() instead! Also the default toolbars and context menus changed!</li>
<li>NEW: new "seaborn" style for plots, see \ref jkqtpplotter_styling </li>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -83,6 +83,14 @@ inline QString JKQTPDoubleToQString(double value, int prec = 10, char f = 'g', Q
}
/** \brief convert a double to a string
* \ingroup jkqtptools_string
*/
inline QString& JKQTPExtendString(QString& s, const QString& separator, const QString& extension) {
if (s.size()>0) s+=separator;
s+=extension;
return s;
}
/** \brief convert a string to lower-case characters
* \ingroup jkqtptools_string

View File

@ -359,6 +359,32 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
else if (xErrorStyle!=JKQTPNoError && xErrorColumnLower>=0) { xl=datastore->get(xErrorColumnLower,static_cast<size_t>(i)); plotlowerbarx=true; }
double yl=0; if (yErrorSymmetric) { yl=ye; plotlowerbary=plotupperbary||(yl>0); }
else if (yErrorStyle!=JKQTPNoError && yErrorColumnLower>=0) { yl=datastore->get(yErrorColumnLower,static_cast<size_t>(i)); plotlowerbary=true; }
if (xErrorStyle.testFlag(JKQTPErrorDirectionOutwards)) {
if (xv>=0.0) { xl=0; plotlowerbarx=false; }
else { xe=0; plotupperbarx=false; }
} else if (xErrorStyle.testFlag(JKQTPErrorDirectionInwards)) {
if (xv<0.0) { xl=0; plotlowerbarx=false; }
else { xe=0; plotupperbarx=false; }
} else if (xErrorStyle.testFlag(JKQTPErrorDirectionAbove)) {
xl=0; plotlowerbarx=false;
} else if (xErrorStyle.testFlag(JKQTPErrorDirectionBelow)) {
xe=0; plotupperbarx=false;
}
if (yErrorStyle.testFlag(JKQTPErrorDirectionOutwards)) {
if (yv>=0.0) { yl=0; plotlowerbary=false; }
else { ye=0; plotupperbary=false; }
} else if (yErrorStyle.testFlag(JKQTPErrorDirectionInwards)) {
if (yv<0.0) { yl=0; plotlowerbary=false; }
else { ye=0; plotupperbary=false; }
} else if (yErrorStyle.testFlag(JKQTPErrorDirectionAbove)) {
yl=0; plotlowerbary=false;
} else if (yErrorStyle.testFlag(JKQTPErrorDirectionBelow)) {
ye=0; plotupperbary=false;
}
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(xe) && JKQTPIsOKFloat(ye) && JKQTPIsOKFloat(xl) && JKQTPIsOKFloat(yl)) {
double x=parentGraph->transformX(xv+xrelshift*deltax); bool xok=JKQTPIsOKFloat(x);
double y=parentGraph->transformY(yv+yrelshift*deltay); bool yok=JKQTPIsOKFloat(y);
@ -367,7 +393,7 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
defaultErrorColor = defaultErrorColor && !this->intPlotXYErrorIndicatorsGetColor(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, yErrorColumn, xErrorStyle, yErrorStyle, i, terrCol, terrFillCol);
// x-errorpolygons
if (/*pastFirst &&*/ (xErrorStyle==JKQTPErrorPolygons || xErrorStyle==JKQTPErrorBarsPolygons || xErrorStyle==JKQTPErrorSimpleBarsPolygons)) {
if (xErrorStyle.testFlag(JKQTPErrorPolygons)) {
double xl2m=parentGraph->transformX(xv+xrelshift*deltax-xl);
double xl2p=parentGraph->transformX(xv+xrelshift*deltax+xe);
double yl2=y;
@ -379,7 +405,7 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
}
// y-errorpolygons
if (/*pastFirst &&*/ (yErrorStyle==JKQTPErrorPolygons || yErrorStyle==JKQTPErrorBarsPolygons || yErrorStyle==JKQTPErrorSimpleBarsPolygons)) {
if (yErrorStyle.testFlag(JKQTPErrorPolygons)) {
double yl2m=parentGraph->transformY(yv+yrelshift*deltay-yl);
double yl2p=parentGraph->transformY(yv+yrelshift*deltay+ye);
@ -393,9 +419,7 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
//x-errorbars
if ((xErrorColumn>=0 || xErrorColumnLower>=0)
&& (xErrorStyle==JKQTPErrorBars || xErrorStyle==JKQTPErrorBarsLines|| xErrorStyle==JKQTPErrorBarsPolygons
|| xErrorStyle==JKQTPErrorSimpleBars || xErrorStyle==JKQTPErrorSimpleBarsLines|| xErrorStyle==JKQTPErrorSimpleBarsPolygons))
if ((xErrorColumn>=0 || xErrorColumnLower>=0) && (xErrorStyle.testFlag(JKQTPErrorSimpleBars)))
{
double x0=parentGraph->transformX(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=parentGraph->transformX(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
@ -406,22 +430,12 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
QList<QLineF> elines;
if (x0ok&&x1ok&&xok&&yok) {
elines<<QLineF(x0, y, x1, y);
if (xErrorStyle==JKQTPErrorBars || xErrorStyle==JKQTPErrorBarsLines|| xErrorStyle==JKQTPErrorBarsPolygons) {
if (plotlowerbarx) elines<<QLineF(x0,y-ebs_px/2.0,x0,y+ebs_px/2.0);
if (plotupperbarx) elines<<QLineF(x1,y-ebs_px/2.0,x1,y+ebs_px/2.0);
}
} else if (x0ok&&!x1ok&&xok&&yok) {
elines<<QLineF(x0, y, x, y);
if (xErrorStyle==JKQTPErrorBars || xErrorStyle==JKQTPErrorBarsLines|| xErrorStyle==JKQTPErrorBarsPolygons) {
if (plotlowerbarx) elines<<QLineF(x0,y-ebs_px/2.0,x0,y+ebs_px/2.0);
}
if (x0<x) elines<<QLineF(x,y,parentGraph->transformX(parent->getXMax()),y);
else elines<<QLineF(x,y,parentGraph->transformX(parent->getXMin()),y);
} else if (!x0ok&&x1ok&&xok&&yok) {
elines<<QLineF(x1, y, x, y);
if (xErrorStyle==JKQTPErrorBars || xErrorStyle==JKQTPErrorBarsLines|| xErrorStyle==JKQTPErrorBarsPolygons) {
if (plotupperbarx) elines<<QLineF(x1,y-ebs_px/2.0,x1,y+ebs_px/2.0);
}
if (x1<x) elines<<QLineF(x,y,parentGraph->transformX(parent->getXMin()),y);
else elines<<QLineF(x,y,parentGraph->transformX(parent->getXMax()),y);
}
@ -430,10 +444,50 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
if (l.length()>0) painter.drawLine(l);
}
}
// x-bar indicators
if ((xErrorColumn>=0 || xErrorColumnLower>=0) && (xErrorStyle.testFlag(JKQTPErrorIndicatorBar)))
{
double x0=parentGraph->transformX(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=parentGraph->transformX(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
painter.setBrush(pp.color());
if (x0ok&&xok && plotlowerbarx) painter.drawLine(QLineF(x0, y-ebs_px/2.0,x0, y+ebs_px/2.0));
if (x1ok&&xok && plotupperbarx) painter.drawLine(QLineF(x1, y-ebs_px/2.0,x1, y+ebs_px/2.0));
}
// x-inwardArrow indicators
if ((xErrorColumn>=0 || xErrorColumnLower>=0) && (xErrorStyle.testFlag(JKQTPErrorIndicatorInwardArrows)))
{
double x0=parentGraph->transformX(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=parentGraph->transformX(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
painter.setBrush(pp.color());
if (x0ok&&xok && plotlowerbarx) painter.drawPolygon(QPolygonF()<<QPointF(x0,y)<<QPointF(x0-ebs_px/2.0,y+ebs_px/2.0)<<QPointF(x0-ebs_px/2.0,y-ebs_px/2.0));
if (x1ok&&xok && plotupperbarx) painter.drawPolygon(QPolygonF()<<QPointF(x1,y)<<QPointF(x1+ebs_px/2.0,y+ebs_px/2.0)<<QPointF(x1+ebs_px/2.0,y-ebs_px/2.0));
}
// x-arrow indicators
if ((xErrorColumn>=0 || xErrorColumnLower>=0) && (xErrorStyle.testFlag(JKQTPErrorIndicatorArrows)))
{
double x0=parentGraph->transformX(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=parentGraph->transformX(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
painter.setBrush(pp.color());
if (x0ok&&xok && plotlowerbarx) painter.drawPolygon(QPolygonF()<<QPointF(x0,y)<<QPointF(x0+ebs_px/2.0,y+ebs_px/2.0)<<QPointF(x0+ebs_px/2.0,y-ebs_px/2.0));
if (x1ok&&xok && plotupperbarx) painter.drawPolygon(QPolygonF()<<QPointF(x1,y)<<QPointF(x1-ebs_px/2.0,y+ebs_px/2.0)<<QPointF(x1-ebs_px/2.0,y-ebs_px/2.0));
}
// y-errorbars
if ((yErrorColumn>=0 || yErrorColumnLower>=0)
&& (yErrorStyle==JKQTPErrorBars || yErrorStyle==JKQTPErrorBarsLines || yErrorStyle==JKQTPErrorBarsPolygons
|| yErrorStyle==JKQTPErrorSimpleBars || yErrorStyle==JKQTPErrorSimpleBarsLines || yErrorStyle==JKQTPErrorSimpleBarsPolygons))
if ((yErrorColumn>=0 || yErrorColumnLower>=0) && (yErrorStyle.testFlag(JKQTPErrorSimpleBars)))
{
double y0=parentGraph->transformY(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=parentGraph->transformY(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
@ -441,25 +495,16 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
painter.setBrush(pp.color());
QList<QLineF> elines;
if (y0ok&&y1ok&&xok&&yok) {
elines<<QLineF(x, y0, x, y1);
if (yErrorStyle==JKQTPErrorBars || yErrorStyle==JKQTPErrorBarsLines || yErrorStyle==JKQTPErrorBarsPolygons) {
if (plotlowerbary) elines<<QLineF(x-ebs_px/2.0,y0,x+ebs_px/2.0,y0);
if (plotupperbary) elines<<QLineF(x-ebs_px/2.0,y1,x+ebs_px/2.0,y1);
}
} else if (y0ok&&!y1ok&&xok&&yok) { // upper errorbar OK, lower errorbar NAN
elines<<QLineF(x, y0, x, y);
if (yErrorStyle==JKQTPErrorBars || yErrorStyle==JKQTPErrorBarsLines || yErrorStyle==JKQTPErrorBarsPolygons) {
if (plotlowerbary) elines<<QLineF(x-ebs_px/2.0,y0,x+ebs_px/2.0,y0);
}
if (y0<y) elines<<QLineF(x,y,x,parentGraph->transformY(parent->getYMin()));
else elines<<QLineF(x,y,x,parentGraph->transformY(parent->getYMax())); // inverted axis!
} else if (!y0ok&&y1ok&&xok&&yok) {
elines<<QLineF(x, y1, x, y);
if (yErrorStyle==JKQTPErrorBars || yErrorStyle==JKQTPErrorBarsLines || yErrorStyle==JKQTPErrorBarsPolygons) {
if (plotupperbary) elines<<QLineF(x-ebs_px/2.0,y1,x+ebs_px/2.0,y1);
}
if (y1<y) elines<<QLineF(x,y,x,parentGraph->transformY(parent->getYMax()));
else elines<<QLineF(x,y,x,parentGraph->transformY(parent->getYMin()));
}
@ -468,69 +513,50 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
if (l.length()>0) painter.drawLine(l);
}
}
// half errorbars
if ((xErrorColumn>=0) && (xErrorStyle==JKQTPErrorHalfBarsAbove|| xErrorStyle==JKQTPErrorHalfBarsInwards|| xErrorStyle==JKQTPErrorHalfBarsBelow|| xErrorStyle==JKQTPErrorHalfBarsOutwards))
// y-bar indicators
if ((yErrorColumn>=0 || yErrorColumnLower>=0) && (yErrorStyle.testFlag(JKQTPErrorIndicatorBar)))
{
double x0=parentGraph->transformX(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=parentGraph->transformX(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
QList<QLineF> elines;
if ( (xErrorStyle==JKQTPErrorHalfBarsAbove
|| (xErrorStyle==JKQTPErrorHalfBarsOutwards && xv>0.0)
|| (xErrorStyle==JKQTPErrorHalfBarsInwards && xv<0.0))
&&x1ok&&xok&&yok) {
elines<<QLineF(x, y, x1, y);
elines<<QLineF(x1,y-ebs_px/2.0,x1,y+ebs_px/2.0);
} else if ((xErrorStyle==JKQTPErrorHalfBarsBelow
|| (xErrorStyle==JKQTPErrorHalfBarsOutwards && xv<=0.0)
|| (xErrorStyle==JKQTPErrorHalfBarsInwards && xv>=0.0))
&&x0ok&&xok&&yok) {
elines<<QLineF(x0, y, x, y);
elines<<QLineF(x0,y-ebs_px/2.0,x0,y+ebs_px/2.0);
}
for (QLineF& l: elines) {
l=JKQTPClipLine(l, cliprect);
if (l.length()>0) painter.drawLine(l);
}
double y0=parentGraph->transformY(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=parentGraph->transformY(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
painter.setBrush(pp.color());
if (y0ok&&xok && plotlowerbary) painter.drawLine(QLineF(x-ebs_px/2.0,y0,x+ebs_px/2.0,y0));
if (y1ok&&xok && plotupperbary) painter.drawLine(QLineF(x-ebs_px/2.0,y1,x+ebs_px/2.0,y1));
}
// half errorbars
if ((yErrorColumn>=0) && (yErrorStyle==JKQTPErrorHalfBarsAbove|| yErrorStyle==JKQTPErrorHalfBarsInwards|| yErrorStyle==JKQTPErrorHalfBarsBelow|| yErrorStyle==JKQTPErrorHalfBarsOutwards))
// y-inwardArrow indicators
if ((yErrorColumn>=0 || yErrorColumnLower>=0) && (yErrorStyle.testFlag(JKQTPErrorIndicatorInwardArrows)))
{
double y0=parentGraph->transformY(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=parentGraph->transformY(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
QList<QLineF> elines;
if ( (yErrorStyle==JKQTPErrorHalfBarsAbove
|| (yErrorStyle==JKQTPErrorHalfBarsOutwards && yv>0.0)
|| (yErrorStyle==JKQTPErrorHalfBarsInwards && yv<0.0))
&&yok&&y1ok&&xok) {
elines<<QLineF(x, y, x, y1);
elines<<QLineF(x-ebs_px/2.0,y1,x+ebs_px/2.0,y1);
} else if ((yErrorStyle==JKQTPErrorHalfBarsBelow
|| (yErrorStyle==JKQTPErrorHalfBarsOutwards && yv<=0.0)
|| (yErrorStyle==JKQTPErrorHalfBarsInwards && yv>=0.0))
&&y0ok&&yok&&xok) {
elines<<QLineF(x, y0, x, y);
elines<<QLineF(x-ebs_px/2.0,y0,x+ebs_px/2.0,y0);
}
for (QLineF& l: elines) {
l=JKQTPClipLine(l, cliprect);
if (l.length()>0) painter.drawLine(l);
}
double y0=parentGraph->transformY(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=parentGraph->transformY(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
painter.setBrush(pp.color());
if (y0ok&&xok && plotlowerbary) painter.drawPolygon(QPolygonF()<<QPointF(x,y0)<<QPointF(x-ebs_px/2.0,y0+ebs_px/2.0)<<QPointF(x+ebs_px/2.0,y0+ebs_px/2.0));
if (y1ok&&xok && plotupperbary) painter.drawPolygon(QPolygonF()<<QPointF(x,y1)<<QPointF(x-ebs_px/2.0,y1-ebs_px/2.0)<<QPointF(x+ebs_px/2.0,y1-ebs_px/2.0));
}
// y-arrow indicators
if ((yErrorColumn>=0 || yErrorColumnLower>=0) && (yErrorStyle.testFlag(JKQTPErrorIndicatorArrows)))
{
double y0=parentGraph->transformY(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=parentGraph->transformY(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen pp=p;
if (!defaultErrorColor) pp.setColor(terrCol);
painter.setPen(pp);
painter.setBrush(pp.color());
if (y0ok&&xok && plotlowerbary) painter.drawPolygon(QPolygonF()<<QPointF(x,y0)<<QPointF(x-ebs_px/2.0,y0-ebs_px/2.0)<<QPointF(x+ebs_px/2.0,y0-ebs_px/2.0));
if (y1ok&&xok && plotupperbary) painter.drawPolygon(QPolygonF()<<QPointF(x,y1)<<QPointF(x-ebs_px/2.0,y1+ebs_px/2.0)<<QPointF(x+ebs_px/2.0,y1+ebs_px/2.0));
}
// error boxes
if (yErrorStyle==JKQTPErrorBoxes || xErrorStyle==JKQTPErrorBoxes || yErrorStyle==JKQTPErrorEllipses || xErrorStyle==JKQTPErrorEllipses ) {
if (yErrorStyle.testFlag(JKQTPErrorBoxes) || xErrorStyle.testFlag(JKQTPErrorBoxes) || yErrorStyle.testFlag(JKQTPErrorEllipses) || xErrorStyle.testFlag(JKQTPErrorEllipses) ) {
double y0=parentGraph->transformY(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=parentGraph->transformY(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
double x0=parentGraph->transformX(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
@ -545,14 +571,14 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
const QRectF errRect=QRectF(QPointF(x0,y0), QPointF(x1,y1));
if (((y0ok&&y1ok)||(x0ok&&x1ok))&&cliprect.intersects(errRect)) {
if (yErrorStyle==JKQTPErrorEllipses || xErrorStyle==JKQTPErrorEllipses) painter.drawEllipse(errRect);
if (yErrorStyle.testFlag(JKQTPErrorEllipses) || xErrorStyle.testFlag(JKQTPErrorEllipses)) painter.drawEllipse(errRect);
else painter.drawRect(errRect);
}
}
// x-errorlines
if (pastFirst && (xErrorStyle==JKQTPErrorLines || xErrorStyle==JKQTPErrorBarsLines || xErrorStyle==JKQTPErrorSimpleBarsLines)) {
if (pastFirst && (xErrorStyle.testFlag(JKQTPErrorLines))) {
double xl1m=xmold;
double xl1p=xpold;
double yl1=yold;
@ -576,7 +602,7 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
// y-errorlines
if (pastFirst && (yErrorStyle==JKQTPErrorLines || yErrorStyle==JKQTPErrorBarsLines || yErrorStyle==JKQTPErrorSimpleBarsLines)) {
if (pastFirst && (yErrorStyle.testFlag(JKQTPErrorLines))) {
double yl1m=ymold;
double yl1p=ypold;
double xl1=xold;
@ -610,7 +636,7 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
}
}
// x-errorpolygons
if ((polyXTopPoints.size()>0 || polyXBottomPoints.size()>0) && (xErrorStyle==JKQTPErrorPolygons || xErrorStyle==JKQTPErrorBarsPolygons || xErrorStyle==JKQTPErrorSimpleBarsPolygons)) {
if ((polyXTopPoints.size()>0 || polyXBottomPoints.size()>0) && (xErrorStyle.testFlag(JKQTPErrorPolygons))) {
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setBrush(b);
painter.setPen(QPen(Qt::NoPen));
@ -625,7 +651,7 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
painter.drawConvexPolygon(poly.intersected(cliprect));
}
if ((polyYTopPoints.size()>0 || polyYBottomPoints.size()>0) && (yErrorStyle==JKQTPErrorPolygons || yErrorStyle==JKQTPErrorBarsPolygons || yErrorStyle==JKQTPErrorSimpleBarsPolygons)) {
if ((polyYTopPoints.size()>0 || polyYBottomPoints.size()>0) && (yErrorStyle.testFlag(JKQTPErrorPolygons))) {
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setBrush(b);
painter.setPen(QPen(Qt::NoPen));

View File

@ -192,24 +192,28 @@ JKQTPKeyLayout String2JKQTPKeyLayout(const QString& pos) {
QString JKQTPErrorPlotstyle2String(JKQTPErrorPlotstyle pos) {
switch(pos) {
case JKQTPErrorBoxes: return "error_box";
case JKQTPErrorEllipses: return "error_ell";
case JKQTPErrorLines: return "error_lines";
case JKQTPErrorBars: return "error_bars";
case JKQTPErrorHalfBarsAbove: return "error_bars_half_above";
case JKQTPErrorHalfBarsBelow: return "error_bars_half_below";
case JKQTPErrorHalfBarsInwards: return "error_bars_half_inwards";
case JKQTPErrorHalfBarsOutwards: return "error_bars_half_outwards";
case JKQTPErrorSimpleBars: return "error_simplebars";
case JKQTPErrorPolygons: return "error_polygons";
case JKQTPErrorBarsLines: return "error_bars_lines";
case JKQTPErrorBarsPolygons: return "error_bars_polygons";
case JKQTPErrorSimpleBarsLines: return "error_simplebars_lines";
case JKQTPErrorSimpleBarsPolygons: return "error_simplebars_polygons";
case JKQTPNoError: return "error_none";
}
return "";
QString s="";
if (pos==JKQTPNoError) return "error_none";
if (pos.testFlag(JKQTPErrorSimpleBars)&&pos.testFlag(JKQTPErrorIndicatorBar)) JKQTPExtendString(s, "+", "error_bars");
else if (pos.testFlag(JKQTPErrorSimpleBars)&&pos.testFlag(JKQTPErrorIndicatorArrows)) JKQTPExtendString(s, "+", "error_arrows");
else if (pos.testFlag(JKQTPErrorSimpleBars)&&pos.testFlag(JKQTPErrorIndicatorInwardArrows)) JKQTPExtendString(s, "+", "error_inwardarrows");
else if (pos.testFlag(JKQTPErrorSimpleBars)) JKQTPExtendString(s, "+", "error_simplebars");
if (pos.testFlag(JKQTPErrorLines)) JKQTPExtendString(s, "+", "error_lines");
if (pos.testFlag(JKQTPErrorPolygons)) JKQTPExtendString(s, "+", "error_polygons");
if (pos.testFlag(JKQTPErrorEllipses)) JKQTPExtendString(s, "+", "error_ell");
if (pos.testFlag(JKQTPErrorBoxes)) JKQTPExtendString(s, "+", "error_box");
if (pos.testFlag(JKQTPErrorDirectionOutwards)) JKQTPExtendString(s, "+", "outwards");
if (pos.testFlag(JKQTPErrorDirectionInwards)) JKQTPExtendString(s, "+", "inwards");
if (pos.testFlag(JKQTPErrorDirectionAbove)) JKQTPExtendString(s, "+", "above");
if (pos.testFlag(JKQTPErrorDirectionBelow)) JKQTPExtendString(s, "+", "below");
if (!pos.testFlag(JKQTPErrorSimpleBars)&&pos.testFlag(JKQTPErrorIndicatorBar)) JKQTPExtendString(s, "+", "bars");
if (!pos.testFlag(JKQTPErrorSimpleBars)&&pos.testFlag(JKQTPErrorIndicatorArrows)) JKQTPExtendString(s, "+", "arrows");
if (!pos.testFlag(JKQTPErrorSimpleBars)&&pos.testFlag(JKQTPErrorIndicatorInwardArrows)) JKQTPExtendString(s, "+", "inwardarrows");
return s;
}
JKQTPErrorPlotstyle String2JKQTPErrorPlotstyle(const QString& pos) {
@ -228,7 +232,27 @@ JKQTPErrorPlotstyle String2JKQTPErrorPlotstyle(const QString& pos) {
if (s=="error_bars_half_below") return JKQTPErrorHalfBarsBelow;
if (s=="error_bars_half_inwards") return JKQTPErrorHalfBarsInwards;
if (s=="error_bars_half_outwards") return JKQTPErrorHalfBarsOutwards;
return JKQTPNoError;
const QStringList sl=s.split("+");
JKQTPErrorPlotstyle es=JKQTPNoError;
for (const QString& s: sl) {
if (s=="error_arrows") es|=JKQTPErrorArrows;
if (s=="error_inwardarrows") es|=JKQTPErrorInwardArrows;
if (s=="error_bars") es|=JKQTPErrorBars;
if (s=="error_simplebars") es|=JKQTPErrorSimpleBars;
if (s=="error_lines") es|=JKQTPErrorLines;
if (s=="error_polygons") es|=JKQTPErrorPolygons;
if (s=="error_ell" || s=="error_ellipses") es|=JKQTPErrorEllipses;
if (s=="error_box" || s=="error_boxes") es|=JKQTPErrorBoxes;
if (s=="outwards") es|=JKQTPErrorDirectionOutwards;
if (s=="inwards") es|=JKQTPErrorDirectionInwards;
if (s=="above") es|=JKQTPErrorDirectionAbove;
if (s=="below") es|=JKQTPErrorDirectionBelow;
if (s=="bars"||s=="bar") es|=JKQTPErrorIndicatorBar;
if (s=="arrow" || s=="arrows") es|=JKQTPErrorIndicatorArrows;
if ( s=="inwardarrows" || s=="inwardsarrows" || s=="inwardarrow" || s=="inwardsarrow"
||s=="inward_arrows" || s=="inwards_arrows" || s=="inward_arrow" || s=="inwards_arrow") es|=JKQTPErrorIndicatorInwardArrows;
}
return es;
}

View File

@ -1,7 +1,7 @@
/*
Copyright (c) 2008-2022 Jan W. Krieger (<jan@jkrieger.de>)
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@ -44,6 +44,7 @@
#include <stdexcept>
#include <cctype>
#include <QColor>
#include <QFlags>
#include "jkqtcommon/jkqtpstringtools.h"
#include "jkqtcommon/jkqtpdebuggingtools.h"
#include "jkqtcommon/jkqtpmathtools.h"
@ -571,28 +572,42 @@ struct JKQTPLOTTER_LIB_EXPORT JKQTPGridPrintingItem {
/** \brief plot styles for the error information
* \ingroup jkqtplotter_basegraphserrors
*/
enum JKQTPErrorPlotstyle {
JKQTPErrorEllipses=10, /*!< \brief an ellipse spanned by the errors \image html JKQTPErrorEllipses.png */
JKQTPErrorBoxes=9, /*!< \brief a box spanned by the errors \image html JKQTPErrorBoxes.png */
JKQTPErrorSimpleBarsPolygons=8, /*!< \brief simplified error barsand polygons for each data point \image html JKQTPErrorSimpleBarsPolygons.png */
JKQTPErrorSimpleBarsLines=7, /*!< \brief simplified error bars and line for each data point \image html JKQTPErrorSimpleBarsLines.png */
JKQTPErrorSimpleBars=6, /*!< \brief simplified error bars for each data point \image html JKQTPErrorSimpleBars.png */
JKQTPErrorLines=5, /*!< \brief a second and third graph line above and below the actual data which indicates the error value \image html JKQTPErrorLines.png */
JKQTPErrorBars=4, /*!< \brief error bars for each data point \image html JKQTPErrorBars.png */
JKQTPErrorHalfBarsOutwards=11, /*!< \brief half error bars for each data point, pointing outwards \image html JKQTPErrorHalfBarsOutwards.png */
JKQTPErrorHalfBarsInwards=12, /*!< \brief half error bars for each data point, pointing inwards \image html JKQTPErrorHalfBarsInwards.png */
JKQTPErrorHalfBarsAbove=13, /*!< \brief half error bars for each data point, pointing up \image html JKQTPErrorHalfBarsAbove.png */
JKQTPErrorHalfBarsBelow=14, /*!< \brief half error bars for each data point, pointing down \image html JKQTPErrorHalfBarsBelow.png */
JKQTPErrorPolygons=3, /*!< \brief line error lines, but with filled range in between \image html JKQTPErrorPolygons.png */
JKQTPErrorBarsLines=2, /*!< \brief error bars and lines for each data point \image html JKQTPErrorBarsLines.png */
JKQTPErrorBarsPolygons=1, /*!< \brief error bars and polygons for each data point \image html JKQTPErrorBarsPolygons.png */
JKQTPNoError=0 /*!< \brief don't show error information \image html JKQTPNoError.png */
enum JKQTPErrorPlotstyleElements {
JKQTPNoError=0x00, /*!< \brief don't show error information \image html errorindicators/JKQTPNoError.png */
JKQTPErrorSimpleBars=0x01, /*!< \brief simplified error bars for each data point \image html errorindicators/JKQTPErrorSimpleBars.png */
JKQTPErrorLines=0x04, /*!< \brief a second and third graph line above and below the actual data which indicates the error value \image html errorindicators/JKQTPErrorLines.png */
JKQTPErrorPolygons=0x08, /*!< \brief line error lines, but with filled range in between \image html errorindicators/JKQTPErrorPolygons.png */
JKQTPErrorEllipses=0x10, /*!< \brief an ellipse spanned by the errors \image html errorindicators/JKQTPErrorEllipses.png */
JKQTPErrorBoxes=0x20, /*!< \brief a box spanned by the errors \image html errorindicators/JKQTPErrorBoxes.png */
JKQTPErrorDirectionBoth=0x000, /*!< \brief do not draw half error-bars, but in both directions (default) \image html errorindicators/JKQTPErrorBars.png */
JKQTPErrorDirectionOutwards=0x100, /*!< \brief used to specify the directon of half error bars: outwards pointing \image html errorindicators/JKQTPErrorHalfBarsOutwards.png */
JKQTPErrorDirectionInwards=0x200, /*!< \brief used to specify the directon of half error bars: inwards pointing \image html errorindicators/JKQTPErrorHalfBarsInwards.png */
JKQTPErrorDirectionAbove=04200, /*!< \brief used to specify the directon of half error bars: above pointing \image html errorindicators/JKQTPErrorHalfBarsAbove.png */
JKQTPErrorDirectionBelow=0x800, /*!< \brief used to specify the directon of half error bars: below pointing \image html errorindicators/JKQTPErrorHalfBarsBelow.png */
JKQTPErrorIndicatorNone=0x0000, /*!< \brief used to specify that error bars shall be un-decorated i.e. "simple error-bars" */
JKQTPErrorIndicatorBar=0x1000, /*!< \brief used to specify that error bars shall be decorated by bars \image html errorindicators/JKQTPErrorIndicatorBar.png */
JKQTPErrorIndicatorArrows=0x2000, /*!< \brief used to specify that error bars shall be decorated by arrows \image html errorindicators/JKQTPErrorIndicatorArrows.png */
JKQTPErrorIndicatorInwardArrows=0x4000, /*!< \brief used to specify that error bars shall be decorated by arrows \image html errorindicators/JKQTPErrorIndicatorInwardArrows.png */
JKQTPErrorArrows=JKQTPErrorSimpleBars|JKQTPErrorIndicatorArrows, /*!< \brief error bars decorated with arrows for each data point \image html errorindicators/JKQTPErrorArrows.png */
JKQTPErrorInwardArrows=JKQTPErrorSimpleBars|JKQTPErrorIndicatorInwardArrows, /*!< \brief error bars decorated with inwards-pointing arrows for each data point \image html errorindicators/JKQTPErrorInwardArrows.png */
JKQTPErrorBars=JKQTPErrorSimpleBars|JKQTPErrorIndicatorBar, /*!< \brief error bars for each data point \image html errorindicators/JKQTPErrorBars.png */
JKQTPErrorSimpleBarsPolygons=JKQTPErrorSimpleBars|JKQTPErrorPolygons, /*!< \brief simplified error barsand polygons for each data point \image html errorindicators/JKQTPErrorSimpleBarsPolygons.png */
JKQTPErrorSimpleBarsLines=JKQTPErrorSimpleBars|JKQTPErrorLines, /*!< \brief simplified error bars and line for each data point \image html errorindicators/JKQTPErrorSimpleBarsLines.png */
JKQTPErrorHalfBarsOutwards=JKQTPErrorBars|JKQTPErrorDirectionOutwards, /*!< \brief half error bars for each data point, pointing outwards \image html errorindicators/JKQTPErrorHalfBarsOutwards.png */
JKQTPErrorHalfBarsInwards=JKQTPErrorBars|JKQTPErrorDirectionInwards, /*!< \brief half error bars for each data point, pointing inwards \image html errorindicators/JKQTPErrorHalfBarsInwards.png */
JKQTPErrorHalfBarsAbove=JKQTPErrorBars|JKQTPErrorDirectionAbove, /*!< \brief half error bars for each data point, pointing up \image html errorindicators/JKQTPErrorHalfBarsAbove.png */
JKQTPErrorHalfBarsBelow=JKQTPErrorBars|JKQTPErrorDirectionBelow, /*!< \brief half error bars for each data point, pointing down \image html errorindicators/JKQTPErrorHalfBarsBelow.png */
JKQTPErrorBarsLines=JKQTPErrorBars|JKQTPErrorLines, /*!< \brief error bars and lines for each data point \image html errorindicators/JKQTPErrorBarsLines.png */
JKQTPErrorBarsPolygons=JKQTPErrorBars|JKQTPErrorPolygons, /*!< \brief error bars and polygons for each data point \image html errorindicators/JKQTPErrorBarsPolygons.png */
};
Q_DECLARE_FLAGS(JKQTPErrorPlotstyle, JKQTPErrorPlotstyleElements)
Q_DECLARE_OPERATORS_FOR_FLAGS(JKQTPErrorPlotstyle)
/** \brief converts a JKQTPErrorPlotstyle variable into a human-readable string

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -23,8 +23,11 @@
#include "jkqtcommon/jkqtpstringtools.h"
#include "jkqtcommon/jkqtpdrawingtools.h"
#include "jkqtcommon/jkqtpenhancedpainter.h"
#include "jkqtplotter/jkqtpbaseplotter.h"
#include "jkqtplotter/graphs/jkqtplines.h"
#include <iostream>
void startPainting(QImage& img, JKQTPEnhancedPainter& p, int iconsizex, int iconsizey, QColor backgroundColor) {
img=QImage(QSize(iconsizex,iconsizey),QImage::Format_ARGB32_Premultiplied);
img.fill(backgroundColor);
@ -54,10 +57,12 @@ int main(int argc, char* argv[])
parser.addVersionOption();
QCommandLineOption outputDirectoryOption("outputdir", "write results into this directory.", "outputdir", app.applicationDirPath());
parser.addOption(outputDirectoryOption);
QCommandLineOption listsymbolsOption("listsymbols", "list all symbols in the given output file and generate images.");
QCommandLineOption listsymbolsOption("listsymbols", "generate example images for all symbols.");
parser.addOption(listsymbolsOption);
QCommandLineOption listlinedecoratorsOption("listlinedecorators", "list all line-endings in the given output file and generate images.");
QCommandLineOption listlinedecoratorsOption("listlinedecorators", "generate example images for all line-decorators.");
parser.addOption(listlinedecoratorsOption);
QCommandLineOption listerrorindicatorsOption("listerrorindicators", "generate example images for all error-indicators.");
parser.addOption(listerrorindicatorsOption);
QCommandLineOption iconsizeOption("iconsize", "typical size of the generatued images.", "iconsize", "24");
parser.addOption(iconsizeOption);
QCommandLineOption backgroundOption("background", "background color.", "background", "white");
@ -67,6 +72,7 @@ int main(int argc, char* argv[])
const QDir outputDir(parser.value(outputDirectoryOption));
const bool listsymbols=parser.isSet(listsymbolsOption);
const bool listlinedecorators=parser.isSet(listlinedecoratorsOption);
const bool listerrorindicators=parser.isSet(listerrorindicatorsOption);
const int iconsize=parser.value(iconsizeOption).toInt();
const QColor backgroundColor = jkqtp_String2QColor(parser.value(backgroundOption));
@ -137,5 +143,70 @@ int main(int argc, char* argv[])
stopPaintingAndSave(img, p, outputDir.absoluteFilePath(JKQTPLineDecoratorStyle2String(s)+".png"));
}
}
if (listerrorindicators) {
JKQTBasePlotter plot(true);
JKQTPDatastore* ds=plot.getDatastore();
size_t cx=ds->addCopiedColumn(QVector<double>{-1.5,-0.5,0.5,1.5,2.5},"x");
size_t cy=ds->addCopiedColumn(QVector<double>{-0.75,-0.3,-0.05,0.2,0.65},"y");
size_t cex=ds->addCopiedColumn(QVector<double>{0,0.2,0.1,0.45,0},"ex");
size_t cey=ds->addCopiedColumn(QVector<double>{0.05,0.1,0.3,0.3,0.05},"ey");
plot.setXY(-0.8,2.2,-0.5,0.7);
plot.setWidgetSize(150,50);
plot.setShowKey(false);
plot.setGrid(false);
plot.getXAxis()->setShowZeroAxis(false);
plot.getYAxis()->setShowZeroAxis(false);
plot.getXAxis()->setDrawMode1(JKQTPCADMnone);
plot.getXAxis()->setDrawMode2(JKQTPCADMnone);
plot.getYAxis()->setDrawMode1(JKQTPCADMnone);
plot.getYAxis()->setDrawMode2(JKQTPCADMnone);
JKQTPXYLineErrorGraph* g=new JKQTPXYLineErrorGraph(&plot);
g->setDrawLine(false);
g->setLineStyle(Qt::DotLine);
g->setSymbolType(JKQTPCross);
g->setSymbolSize(6);
g->setXColumn(cx);
g->setYColumn(cy);
g->setXErrorColumn(cex);
g->setYErrorColumn(cey);
plot.addGraph(g);
const std::vector<std::tuple<QString, JKQTPErrorPlotstyle, JKQTPErrorPlotstyle, bool, bool>> plots=
{
{"JKQTPNoError", JKQTPNoError, JKQTPNoError, true, false},
{"JKQTPErrorSimpleBars", JKQTPErrorSimpleBars, JKQTPErrorSimpleBars, false, false},
{"JKQTPErrorLines", JKQTPNoError, JKQTPErrorLines, true, false},
{"JKQTPErrorPolygons", JKQTPNoError, JKQTPErrorPolygons, true, false},
{"JKQTPErrorEllipses", JKQTPErrorEllipses, JKQTPErrorEllipses, false, false},
{"JKQTPErrorBoxes", JKQTPErrorBoxes, JKQTPErrorBoxes, false, false},
{"JKQTPErrorArrows", JKQTPErrorArrows, JKQTPErrorArrows, false, false},
{"JKQTPErrorInwardArrows", JKQTPErrorInwardArrows, JKQTPErrorInwardArrows, false, false},
{"JKQTPErrorBars", JKQTPErrorBars, JKQTPErrorBars, false, false},
{"JKQTPErrorSimpleBarsPolygons", JKQTPNoError, JKQTPErrorSimpleBarsPolygons, true, false},
{"JKQTPErrorSimpleBarsLines", JKQTPNoError, JKQTPErrorSimpleBarsLines, true, false},
{"JKQTPErrorBarsLines", JKQTPNoError, JKQTPErrorBarsLines, true, false},
{"JKQTPErrorBarsPolygons", JKQTPNoError, JKQTPErrorBarsPolygons, true, false},
{"JKQTPErrorHalfBarsOutwards", JKQTPErrorHalfBarsOutwards, JKQTPErrorHalfBarsOutwards, false,true},
{"JKQTPErrorHalfBarsInwards", JKQTPErrorHalfBarsInwards, JKQTPErrorHalfBarsInwards, false,true},
{"JKQTPErrorHalfBarsAbove", JKQTPErrorHalfBarsAbove, JKQTPErrorHalfBarsAbove, false,true},
{"JKQTPErrorHalfBarsBelow", JKQTPErrorHalfBarsBelow, JKQTPErrorHalfBarsBelow, false,true},
{"JKQTPErrorIndicatorArrows", JKQTPErrorIndicatorArrows, JKQTPErrorIndicatorArrows, false, false},
{"JKQTPErrorIndicatorInwardArrows", JKQTPErrorIndicatorInwardArrows, JKQTPErrorIndicatorInwardArrows, false, false},
{"JKQTPErrorIndicatorBar", JKQTPErrorIndicatorBar, JKQTPErrorIndicatorBar, false, false},
};
for (const auto& d: plots) {
g->setDrawLine(std::get<3>(d));
g->setXErrorStyle(std::get<1>(d));
g->setYErrorStyle(std::get<2>(d));
plot.getXAxis()->setShowZeroAxis(std::get<4>(d));
plot.getYAxis()->setShowZeroAxis(std::get<4>(d));
plot.saveAsPixelImage(outputDir.absoluteFilePath(std::get<0>(d)+".png"), false, "png");
}
}
return EXIT_SUCCESS;
}