void FFT::output(QList<Column *> columns) { ApplicationWindow *app = (ApplicationWindow *)parent(); QString tableName = app->generateUniqueName(objectName()); Table *t = app->newHiddenTable(tableName, d_explanation, columns); MultiLayer *ml = app->multilayerPlot( t, QStringList() << tableName + "_" + tr("Amplitude"), 0); if (!ml) return; Graph *g = ml->activeGraph(); if (g) { g->setCurvePen(0, QPen(ColorBox::color(d_curveColorIndex), 1)); Plot *plot = g->plotWidget(); plot->setTitle(QString()); if (!d_inverse) plot->setAxisTitle(QwtPlot::xBottom, tr("Frequency") + " (" + tr("Hz") + ")"); else plot->setAxisTitle(QwtPlot::xBottom, tr("Time") + +" (" + tr("s") + ")"); plot->setAxisTitle(QwtPlot::yLeft, tr("Amplitude")); plot->replot(); } ml->showMaximized(); }
void Correlation::addResultCurve() { int cols = d_table->tableCols(); int cols2 = cols+1; d_table->addCol(); d_table->addCol(); int n = d_table->tableRows()/2; for (int i = 0; i<d_table->tableRows(); i++) { double y = 0; if(i < n) y = d_x[d_n - n + i]; else y = d_x[i-n]; d_table->setText(i, cols, QString::number(i - n)); d_table->setText(i, cols2, QString::number(y)); } QStringList l = d_table->colNames().grep(tr("Lag")); QString id = QString::number((int)l.size()+1); QString label = name() + id; d_table->setColName(cols, tr("Lag") + id); d_table->setColName(cols2, label); d_table->setColPlotDesignation(cols, Table::X); d_table->setHeaderColType(); ApplicationWindow *app = (ApplicationWindow *)parent(); MultiLayer *ml = app->newGraph(name() + tr("Plot")); ml->activeGraph()->insertCurve(d_table, d_table->name() + "_" + label, 0); }
void FFT::output(const QString &text) { ApplicationWindow *app = (ApplicationWindow *)parent(); QString tableName = app->generateUniqueName(QString(objectName())); d_result_table = app->newHiddenTable(tableName, d_explanation, d_n, 5, text); if (d_graphics_display){ MultiLayer *ml = 0; if (!d_output_graph){ ml = createOutputGraph(); d_output_graph = ml->activeGraph(); } d_output_graph->setTitle(QString()); if (!d_inverse) d_output_graph->setXAxisTitle(tr("Frequency") + " (" + tr("Hz") + ")"); else d_output_graph->setXAxisTitle(tr("Time") + + " (" + tr("s") + ")"); d_output_graph->setYAxisTitle(tr("Amplitude")); d_output_graph->insertCurve(d_result_table, 0, tableName + "_" + tr("Amplitude"), 0); d_output_graph->setCurvePen(d_output_graph->curves() - 1, QPen(ColorBox::color(d_curveColorIndex), 1)); d_output_graph->replot(); if (ml) ml->showMaximized(); } }
MultiLayer * Filter::createOutputGraph() { ApplicationWindow *app = dynamic_cast<ApplicationWindow *>(this->parent()); if (!app) { throw std::logic_error("Parent of Filter is not ApplicationWindow as expected."); } MultiLayer *ml = app->newGraph(objectName() + tr("Plot")); d_output_graph = ml->activeGraph(); return ml; }
/** * @param g :: The Graph widget which will display the curve * @param distr :: True if this is a distribution, * not applicable here. * @param style :: The graph style to use * @param multipleSpectra :: True if there are multiple spectra, * not applicable here. */ void MantidMDCurve::init(Graph *g, bool distr, GraphOptions::CurveType style, bool multipleSpectra) { UNUSED_ARG(distr); UNUSED_ARG(multipleSpectra); IMDWorkspace_const_sptr ws = boost::dynamic_pointer_cast<IMDWorkspace>( AnalysisDataService::Instance().retrieve(m_wsName.toStdString())); if (!ws) { std::string message = "Could not extract IMDWorkspace of name: " + m_wsName.toStdString(); throw std::runtime_error(message); } if (ws->getNonIntegratedDimensions().size() != 1) { std::string message = "This plot only applies to MD Workspaces with a " "single expanded dimension"; throw std::invalid_argument(message); } this->setTitle(m_wsName + "-signal"); const bool log = g->isLog(QwtPlot::yLeft); MantidQwtIMDWorkspaceData data(ws, log); setData(data); int lineWidth = 1; MultiLayer *ml = dynamic_cast<MultiLayer *>(g->parent()->parent()->parent()); if (ml && (style == GraphOptions::Unspecified || ml->applicationWindow()->applyCurveStyleToMantid)) { // FIXME: Style HorizontalSteps does NOT seem to be applied applyStyleChoice(style, ml, lineWidth); } else { setStyle(QwtPlotCurve::Lines); } g->insertCurve(this, lineWidth); // set the option to draw all error bars from the global settings if (hasErrorBars()) { setErrorBars(true, g->multiLayer()->applicationWindow()->drawAllErrors); } // Initialise error bar colour to match curve colour m_errorSettings->m_color = pen().color(); m_errorSettings->setWidth(pen().widthF()); connect(g, SIGNAL(axisScaleChanged(int, bool)), this, SLOT(axisScaleChanged(int, bool))); observePostDelete(); connect(this, SIGNAL(resetData(const QString &)), this, SLOT(dataReset(const QString &))); observeAfterReplace(); observeADSClear(); }
void EnrichmentDialog::frameApplyTo() { if (!d_app) return; switch(frameApplyToBox->currentIndex()){ case 0://this layer { FrameWidget *fw = qobject_cast<FrameWidget *>(d_widget); if (fw) setFrameTo(fw); } break; case 1://this layer { QList <FrameWidget *> lst = d_plot->enrichmentsList(); foreach(FrameWidget *fw, lst) setFrameTo(fw); } break; case 2://this window { QList<Graph *> layersLst = d_plot->multiLayer()->layersList(); foreach(Graph *g, layersLst){ QList <FrameWidget *> lst = g->enrichmentsList(); foreach(FrameWidget *fw, lst) setFrameTo(fw); } } break; case 3://all windows { QList<MdiSubWindow *> windows = d_app->windowsList(); foreach(MdiSubWindow *w, windows){ MultiLayer *ml = qobject_cast<MultiLayer *>(w); if (!ml) continue; QList<Graph *> layersLst = ml->layersList(); foreach(Graph *g, layersLst){ QList <FrameWidget *> lst = g->enrichmentsList(); foreach(FrameWidget *fw, lst) setFrameTo(fw); } }
void Correlation::addResultCurve() { ApplicationWindow *app = (ApplicationWindow *)parent(); if (!app) return; int rows = d_table->numRows(); int cols = d_table->numCols(); int cols2 = cols+1; d_table->addCol(); d_table->addCol(); int n = rows/2; double x_temp[rows], y_temp[rows]; for (int i = 0; i<rows; i++) { x_temp[i] = i - n; if(i < n) y_temp[i] = d_x[d_n - n + i]; else y_temp[i] = d_x[i-n]; d_table->column(cols)->setValueAt(i, x_temp[i]); d_table->column(cols2)->setValueAt(i, y_temp[i]); } QStringList l = d_table->colNames().grep(tr("Lag")); QString id = QString::number((int)l.size()+1); QString label = name() + id; d_table->setColName(cols, tr("Lag") + id); d_table->setColName(cols2, label); d_table->setColPlotDesignation(cols, SciDAVis::X); MultiLayer *ml = app->newGraph(name() + tr("Plot")); if (!ml) return; DataCurve *c = new DataCurve(d_table, d_table->colName(cols), d_table->colName(cols2)); c->setData(x_temp, y_temp, rows); c->setPen(QPen(ColorBox::color(d_curveColorIndex), 1)); ml->activeGraph()->insertPlotItem(c, Graph::Line); ml->activeGraph()->updatePlot(); }
QPixmap ImageWidget::windowPixmap(ApplicationWindow *mw, const QString& name, const QSize& size) { if (!mw || name.isEmpty()) return QPixmap(); MdiSubWindow *w = mw->window(name); MultiLayer *ml = qobject_cast<MultiLayer *> (w); if (ml) return ml->canvasPixmap(size); Graph3D *g = qobject_cast<Graph3D *> (w); if (g) return g->surface()->renderPixmap(size.width(), size.height()); Table *t = qobject_cast<Table *> (w); if (t) return QPixmap::grabWidget(t->table()); return QPixmap(); }
/** Creates a MultiLayer graph and plots this MantidMatrix as a Spectrogram. @param type :: The "curve" type. @return Pointer to the created graph. */ MultiLayer *MantidMatrix::plotGraph2D(Graph::CurveType type) { if (numRows() == 1) { QMessageBox::critical(0, "MantidPlot - Error", "Cannot plot a workspace with only one spectrum."); return NULL; } QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); ApplicationWindow *a = applicationWindow(); MultiLayer *g = a->multilayerPlot(a->generateUniqueName(tr("Graph"))); attachMultilayer(g); //#799 fix for multiple dialog creation on double clicking/ on right click // menu scale on 2d plot // a->connectMultilayerPlot(g); Graph *plot = g->activeGraph(); plotSpectrogram(plot, a, type, false, NULL); // g->confirmClose(false); QApplication::restoreOverrideCursor(); return g; }
void FFT::output(const QString &text) { ApplicationWindow *app = (ApplicationWindow *)parent(); QString tableName = app->generateUniqueName(QString(name())); Table *t = app->newHiddenTable(tableName, d_explanation, d_n, 5, text); MultiLayer *ml = app->multilayerPlot(t, QStringList() << tableName + "_" + tr("Amplitude"), 0); if (!ml) return; Graph* g = ml->activeGraph(); if ( g ) { Plot* plot = g->plotWidget(); plot->setTitle(QString()); if (!d_inverse) plot->setAxisTitle(QwtPlot::xBottom, tr("Frequency") + " (" + tr("Hz") + ")"); else plot->setAxisTitle(QwtPlot::xBottom, tr("Time") + + " (" + tr("s") + ")"); plot->setAxisTitle(QwtPlot::yLeft, tr("Amplitude")); plot->replot(); } ml->showMaximized(); }
MultiLayer * Filter::createOutputGraph() { MultiLayer *ml = ((ApplicationWindow *)parent())->newGraph(objectName() + tr("Plot")); d_output_graph = ml->activeGraph(); return ml; }
void LineProfileTool::calculateLineProfile(const QPoint& start, const QPoint& end) { QRect rect = d_target->rect(); if (!rect.contains(start) || !rect.contains(end)){ QMessageBox::warning(d_graph, tr("QtiPlot - Pixel selection warning"), tr("Please select the end line point inside the image rectangle!")); return; } QPoint o = d_target->origin(); QPixmap pic = d_target->pixmap(); QImage image = pic.convertToImage(); int x1 = start.x()-o.x(); int x2 = end.x()-o.x(); int y1 = start.y()-o.y(); int y2 = end.y()-o.y(); QSize realSize = pic.size(); QSize actualSize = d_target->size(); if (realSize != actualSize){ double ratioX = (double)realSize.width()/(double)actualSize.width(); double ratioY = (double)realSize.height()/(double)actualSize.height(); x1 = int(x1*ratioX); x2 = int(x2*ratioX); y1 = int(y1*ratioY); y2 = int(y2*ratioY); } QString text = tr("pixel") + "\tx\ty\t" + tr("intensity") + "\n"; //uses the fast Bresenham's line-drawing algorithm #define sgn(x) ((x<0)?-1:((x>0)?1:0)) int i,dx,dy,sdx,sdy,dxabs,dyabs,x,y,px,py,n; dx=x2-x1; //the horizontal distance of the line dy=y2-y1; //the vertical distance of the line dxabs=abs(dx); dyabs=abs(dy); sdx=sgn(dx); sdy=sgn(dy); x=dyabs>>1; y=dxabs>>1; px=x1; py=y1; if (dxabs>=dyabs){ //the line is more horizontal than vertical for(i=0;i<dxabs;i++){ y+=dyabs; if (y>=dxabs){ y-=dxabs; py+=sdy; } px+=sdx; n=dxabs; text+=QString::number(i)+"\t"; text+=QString::number(px)+"\t"; text+=QString::number(py)+"\t"; text+=QString::number(averageImagePixel(image, px, py, true))+"\n"; } } else {// the line is more vertical than horizontal for(i=0;i<dyabs;i++){ x+=dxabs; if (x>=dyabs){ x-=dyabs; px+=sdx; } py+=sdy; n=dyabs; text+=QString::number(i)+"\t"; text+=QString::number(px)+"\t"; text+=QString::number(py)+"\t"; text+=QString::number(averageImagePixel(image, px, py, false))+"\n"; } } Table *t = d_app->newTable(tr("Table") + "1", n, 4, text); MultiLayer* plot = d_app->multilayerPlot(t, QStringList(QString(t->objectName())+"_intensity"), 0); Graph *g = (Graph*)plot->activeGraph(); if (g){ g->setTitle(""); g->setXAxisTitle(tr("pixels")); g->setYAxisTitle(tr("pixel intensity (a.u.)")); } }
/** * @param g :: The Graph widget which will display the curve * @param distr :: True for a distribution * @param style :: The curve type to use */ void MantidMatrixCurve::init(Graph *g, bool distr, GraphOptions::CurveType style) { // Will throw if name not found but return NULL ptr if the type is incorrect MatrixWorkspace_const_sptr workspace = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>( m_wsName.toStdString()); if (!workspace) // The respective *Data classes will check for index validity { std::stringstream ss; ss << "Workspace named '" << m_wsName.toStdString() << "' found but it is not a MatrixWorkspace. ID='" << AnalysisDataService::Instance().retrieve(m_wsName.toStdString())->id() << "'"; throw std::invalid_argument(ss.str()); } // Set the curve name if it the non-naming constructor was called if (this->title().isEmpty()) { // If there's only one spectrum in the workspace, title is simply workspace // name if (workspace->getNumberHistograms() == 1) this->setTitle(m_wsName); else this->setTitle(createCurveName(workspace)); } Mantid::API::MatrixWorkspace_const_sptr matrixWS = boost::dynamic_pointer_cast<const Mantid::API::MatrixWorkspace>( workspace); // we need to censor the data if there is a log scale because it can't deal // with negative values, only the y-axis has been found to be problem so far const bool log = g->isLog(QwtPlot::yLeft); // Y units are the same for both spectrum and bin plots, e.g. counts m_yUnits.reset(new Mantid::Kernel::Units::Label(matrixWS->YUnit(), matrixWS->YUnitLabel())); if (m_indexType == Spectrum) // Spectrum plot { QwtWorkspaceSpectrumData data(*matrixWS, m_index, log, distr); setData(data); // For spectrum plots, X axis are actual X axis, e.g. TOF m_xUnits = matrixWS->getAxis(0)->unit(); } else // Bin plot { QwtWorkspaceBinData data(*matrixWS, m_index, log); setData(data); // For bin plots, X axis are "spectra axis", e.g. spectra numbers m_xUnits = matrixWS->getAxis(1)->unit(); } if (!m_xUnits) { m_xUnits.reset(new Mantid::Kernel::Units::Empty()); } int lineWidth = 1; MultiLayer *ml = dynamic_cast<MultiLayer *>(g->parent()->parent()->parent()); if (ml && (style == GraphOptions::Unspecified || ml->applicationWindow()->applyCurveStyleToMantid)) { applyStyleChoice(style, ml, lineWidth); } else if (matrixWS->isHistogramData() && !matrixWS->isDistribution()) { setStyle(QwtPlotCurve::Steps); setCurveAttribute( Inverted, true); // this is the Steps style modifier that makes horizontal steps } else { setStyle(QwtPlotCurve::Lines); } g->insertCurve(this, lineWidth); // set the option to draw all error bars from the global settings if (hasErrorBars()) { setErrorBars(true, g->multiLayer()->applicationWindow()->drawAllErrors); } // Initialise error bar colour to match curve colour m_errorSettings->m_color = pen().color(); m_errorSettings->setWidth(pen().widthF()); connect(g, SIGNAL(axisScaleChanged(int, bool)), this, SLOT(axisScaleChanged(int, bool))); observePostDelete(); connect(this, SIGNAL(resetData(const QString &)), this, SLOT(dataReset(const QString &))); observeAfterReplace(); observeADSClear(); }
void FFT::outputGraphs() { createOutputGraph(); MultiLayer *ml = d_output_graph->multiLayer(); d_output_graph->setTitle(QString::null); d_output_graph->setYAxisTitle(tr("Angle (deg)")); d_output_graph->enableAxis(QwtPlot::xTop, true); d_output_graph->enableAxis(QwtPlot::yRight, true); if (!d_inverse) d_output_graph->setAxisTitle(QwtPlot::xTop, tr("Frequency") + " (" + tr("Hz") + ")"); else d_output_graph->setAxisTitle(QwtPlot::xTop, tr("Time") + + " (" + tr("s") + ")"); ScaleDraw *sd = (ScaleDraw *)d_output_graph->axisScaleDraw(QwtPlot::yLeft); if (sd) sd->setShowTicksPolicy(ScaleDraw::HideBegin); sd = (ScaleDraw *)d_output_graph->axisScaleDraw(QwtPlot::yRight); if (sd) sd->setShowTicksPolicy(ScaleDraw::HideBegin); sd = (ScaleDraw *)d_output_graph->axisScaleDraw(QwtPlot::xBottom); if (sd){ sd->setShowTicksPolicy(ScaleDraw::HideBeginEnd); sd->enableComponent(QwtAbstractScaleDraw::Backbone, false); } QString tableName = d_result_table->objectName(); PlotCurve *pc = d_output_graph->insertCurve(d_result_table, 0, tableName + "_" + tr("Angle"), 0); pc->setPen(QPen(d_curveColor, 1)); d_output_graph->removeLegend(); d_output_graph->updatePlot(); Graph *g = ml->addLayer(0, 0, 0, 0, true); g->setTitle(QString::null); if (!d_inverse) g->setXAxisTitle(tr("Frequency") + " (" + tr("Hz") + ")"); else g->setXAxisTitle(tr("Time") + + " (" + tr("s") + ")"); g->setYAxisTitle(tr("Amplitude")); g->removeLegend(); sd = (ScaleDraw *)g->axisScaleDraw(QwtPlot::xTop); if (sd) sd->setShowTicksPolicy(ScaleDraw::HideBeginEnd); PlotCurve *c = g->insertCurve(d_result_table, 0, tableName + "_" + tr("Amplitude"), 0); c->setPen(QPen(d_curveColor, 1)); g->updatePlot(); double rb = g->axisScaleDiv(QwtPlot::xBottom)->upperBound(); d_output_graph->setAxisScale(QwtPlot::xBottom, 0, rb); d_output_graph->setAxisScale(QwtPlot::xTop, 0, rb); g->setAxisScale(QwtPlot::xBottom, 0, rb); g->setAxisScale(QwtPlot::xTop, 0, rb); ml->setAlignPolicy(MultiLayer::AlignCanvases); ml->setRows(2); ml->setCols(1); ml->setSpacing(0, 0); ml->linkXLayerAxes(); ml->setCommonLayerAxes(false, true); ml->arrangeLayers(false, false); }
void CurvesDialog::init() { if (d_app){ bool currentFolderOnly = d_app->d_show_current_folder; boxShowCurrentFolder->setChecked(currentFolderOnly); showCurrentFolder(currentFolderOnly); QStringList matrices = d_app->matrixNames(); if (!matrices.isEmpty ()){ boxMatrixStyle->show(); available->addItems(matrices); } int style = d_app->defaultCurveStyle; if (style == Graph::Line) boxStyle->setCurrentItem(0); else if (style == Graph::Scatter) boxStyle->setCurrentItem(1); else if (style == Graph::LineSymbols) boxStyle->setCurrentItem(2); else if (style == Graph::VerticalDropLines) boxStyle->setCurrentItem(3); else if (style == Graph::Spline) boxStyle->setCurrentItem(4); else if (style == Graph::VerticalSteps) boxStyle->setCurrentItem(5); else if (style == Graph::HorizontalSteps) boxStyle->setCurrentItem(6); else if (style == Graph::Area) boxStyle->setCurrentItem(7); else if (style == Graph::VerticalBars) boxStyle->setCurrentItem(8); else if (style == Graph::HorizontalBars) boxStyle->setCurrentItem(9); } QList<MdiSubWindow *> wList = d_app->windowsList(); foreach(MdiSubWindow* w, wList) { MultiLayer* ml = dynamic_cast<MultiLayer*>(w); if (ml)// layers are numbered starting from 1 { for(int i=1;i<=ml->layers();i++) { Graph* g = ml->layer(i); if (g) { for(int j=0;j<g->curves();j++) { MantidMatrixCurve* c = dynamic_cast<MantidMatrixCurve*>(g->curve(j)); if (c) { available->addItem(c->title().text()); // Store copies of the curves // Necessary because a curve is deleted when it's removed from a plot d_plotCurves[c->title().text()] = c->clone(g); ml->setCloseOnEmpty(false); } } } } } }
void ErrDialog::add() { ApplicationWindow *app = qobject_cast<ApplicationWindow *>(parent()); if (!app) return; MultiLayer *plot = (MultiLayer *)app->activeWindow(ApplicationWindow::MultiLayerWindow); if (!plot) return; Graph* g = plot->activeLayer(); if (!g) return; QString name = nameLabel->currentText(); DataCurve *curve = g->dataCurve(name); if (!curve){ QMessageBox::critical(app, tr("QtiPlot - Error"), tr("This feature is not available for user defined function curves!")); return; } int direction = xErrBox->isChecked() ? 0 : 1; ErrorBarsCurve *er = NULL; if (columnBox->isChecked()){ QString errColumnName = tableNamesBox->currentText() + "_" + colNamesBox->currentText(); Table *errTable = app->table(errColumnName); if (!errTable) return; /*if (w->numRows() != errTable->numRows()){ QMessageBox::critical(app, tr("QtiPlot - Error"), tr("The selected columns have different numbers of rows!")); return; }*/ if (errTable->isEmptyColumn(errTable->colIndex(errColumnName))){ QMessageBox::critical(app, tr("QtiPlot - Error"), tr("The selected error column is empty!")); return; } er = g->addErrorBars(curve, errTable, errColumnName, direction); } else { Table *t = curve->table(); if (!t) return; if (direction == ErrorBarsCurve::Horizontal) t->addCol(Table::xErr); else t->addCol(Table::yErr); int r = curve->dataSize(); int rows = t->numRows(); int col = t->numCols() - 1; int ycol = t->colIndex(curve->title().text()); if (!direction) ycol = t->colIndex(curve->xColumnName()); QVarLengthArray<double> Y(r); if (direction == ErrorBarsCurve::Horizontal){ for (int i = 0; i < r; i++) Y[i] = curve->x(i); } else { for (int i = 0; i < r; i++) Y[i] = curve->y(i); } if (percentBox->isChecked()){ double prc = 0.01*valueBox->value(); int aux = 0; for (int i = curve->startRow(); i <= curve->endRow(); i++){ if (!t->text(i, ycol).isEmpty() && aux < r){ t->setCell(i, col, Y[aux]*prc); aux++; } } } else if (standardBox->isChecked() || standardErrorBox->isChecked()){ double sd = gsl_stats_sd(Y.data(), 1, r); if (standardErrorBox->isChecked()) sd /= sqrt(r); for (int i = 0; i < rows; i++){ if (!t->text(i, ycol).isEmpty()) t->setCell(i, col, sd); } } er = g->addErrorBars(curve, t, t->colName(col), direction); } if (er){ er->setColor(curve->pen().color()); g->replot(); plot->notifyChanges(); } }
void PlotWizard::plot2D(const QStringList& colList) { ApplicationWindow *app = (ApplicationWindow *)this->parent(); if (!app) return; QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); MultiLayer* g = new MultiLayer(app); app->initMultilayerPlot(g, ""); Graph *ag = g->activeLayer(); app->setPreferences(ag); int curves = (int)colList.count(); int errorBars = 0; for (int i = 0; i < curves; i++) { if (colList[i].contains("(yErr)") || colList[i].contains("(xErr)")) errorBars++; } for (int i = 0; i < curves; i++){ QString s = colList[i]; int pos = s.find(":", 0); QString caption = s.left(pos) + "_"; Table *w = (Table *)app->table(caption); int posX = s.find("(X)", pos); QString xColName = caption + s.mid(pos+2, posX-pos-2); posX = s.find(",", posX); int posY = s.find("(Y)", posX); QString yColName = caption+s.mid(posX+2, posY-posX-2); PlotCurve *c = NULL; if (s.contains("(yErr)") || s.contains("(xErr)")){ posY = s.find(",", posY); int posErr, errType; if (s.contains("(yErr)")){ errType = ErrorBarsCurve::Vertical; posErr = s.find("(yErr)", posY); } else { errType = ErrorBarsCurve::Horizontal; posErr = s.find("(xErr)",posY); } QString errColName = caption+s.mid(posY+2, posErr-posY-2); c = (PlotCurve *)ag->addErrorBars(xColName, yColName, w, errColName, errType); } else c = (PlotCurve *)ag->insertCurve(w, xColName, yColName, app->defaultCurveStyle); CurveLayout cl = ag->initCurveLayout(app->defaultCurveStyle, curves - errorBars); cl.lWidth = app->defaultCurveLineWidth; cl.sSize = app->defaultSymbolSize; ag->updateCurveLayout(c, &cl); } ag->updatePlot(); ag->updateAxesTitles(); ag->newLegend(); g->arrangeLayers(false, true); QApplication::restoreOverrideCursor(); }