/** * Plots the loaded file to the miniplot and sets the guides * and the range * * @param filename :: The name of the workspace to plot */ void Stretch::handleSampleInputReady(const QString& filename) { plotMiniPlot(filename, 0); std::pair<double,double> range = getCurveRange(); setMiniPlotGuides(m_properties["EMin"], m_properties["EMax"], range); setPlotRange(m_properties["EMin"], m_properties["EMax"], range); }
void ALEXHistogramsWidget::plotDensity() { plot=ui->widPlotDensity; JKQTPdatastore* ds=plot->get_plotter()->getDatastore(); // empty datastore and grid plot->get_plotter()->clearGraphs(true); ds->clear(); plot->setGrid(false); // plot->get_plotter()->set_plotLabel("ALEX density plot"); plot->get_plotter()->getXAxis()->set_axisLabel("P"); plot->get_plotter()->getYAxis()->set_axisLabel("S"); int nbins=ui->spinBoxBins->value(); gsl_histogram2d * histAlex=gsl_histogram2d_calloc_uniform(nbins,nbins,ad->rangeALEX.minP,ad->rangeALEX.maxP,ad->rangeALEX.minS,ad->rangeALEX.maxS); for(int i=0; i<ad->burstVectorDual.size();++i) gsl_histogram2d_increment(histAlex, ad->burstVectorDual.at(i).proximityRatio, ad->burstVectorDual.at(i).stoichiometryRatio); // qDebug()<<histAlex->ny<<histAlex->nx; size_t colHist2D=ds->addCopiedImageAsColumnTranspose(histAlex->bin, histAlex->ny, histAlex->nx, tr("2Dhist")); // ds->getColumn(colHist2D).exchange(0, 1.0/0.0); JKQTPColumnMathImage* densityplot=new JKQTPColumnMathImage(plot->get_plotter()); // bin(i,j) = bin[i * ny + j]. densityplot->set_x(ad->rangeALEX.minP); densityplot->set_y(ad->rangeALEX.minS); plot->setAbsoluteX(ad->rangeALEX.minP,ad->rangeALEX.maxP); plot->setAbsoluteY(ad->rangeALEX.minS,ad->rangeALEX.maxS); densityplot->set_width(ad->rangeALEX.width()); densityplot->set_height(ad->rangeALEX.heigth()); densityplot->set_Nx(histAlex->nx); densityplot->set_Ny(histAlex->ny); densityplot->set_palette(ui->comboBoxPalette->colorPalette()); densityplot->set_imageColumn(colHist2D); densityplot->set_imageName(tr("#bursts")); // densityplot->set_infColor(Qt::transparent); densityplot->set_nanColor(Qt::transparent); plot->addGraph(densityplot); gsl_histogram2d_free(histAlex); // selection QColor fill=QColor("skyblue"); fill.setAlphaF(0.5); pltSelectionRect=new JKQTPgeoRectangle(plot->get_plotter(), 0,0,0,0, QColor("black"), 1, Qt::DotLine, fill); pltSelectionRect->set_bottomleftrectangle(ad->FRETparams.MinP,ad->FRETparams.MinS,ad->FRETparams.MaxP-ad->FRETparams.MinP,ad->FRETparams.MaxS-ad->FRETparams.MinS); plot->addGraph(pltSelectionRect); setPlotRange(ad->rangeALEX,plot); }
void ALEXHistogramsWidget:: plotContour() { if(ad->isEmptyBurst()) return; plot=ui->widPlot; JKQTPdatastore* ds=plot->get_plotter()->getDatastore(); // empty datastore and grid plot->get_plotter()->clearGraphs(true); ds->clear(); plot->get_plotter()->setGrid(false); // plot->get_plotter()->set_plotLabel("ALEX density plot"); plot->get_plotter()->getXAxis()->set_axisLabel("P"); plot->get_plotter()->getYAxis()->set_axisLabel("S"); int nbins=ui->spinBoxBins->value(); gsl_histogram2d * histAlex=gsl_histogram2d_calloc_uniform(nbins,nbins,plotRangeContour.minP,plotRangeContour.maxP,plotRangeContour.minS,plotRangeContour.maxS); for(int i=0; i<ad->burstVectorDual.size();++i) gsl_histogram2d_increment(histAlex, ad->burstVectorDual.at(i).proximityRatio, ad->burstVectorDual.at(i).stoichiometryRatio); size_t colHist2D=ds->addCopiedImageAsColumnTranspose(histAlex->bin, histAlex->ny, histAlex->nx, tr("2Dhist")); JKQTPContour* cp=new JKQTPContour(plot->get_plotter()); // bin(i,j) = bin[i * ny + j]. cp->set_x(plotRangeContour.minP); cp->set_y(plotRangeContour.minS); plot->setAbsoluteX(ad->rangeALEX.minP,ad->rangeALEX.maxP); plot->setAbsoluteY(ad->rangeALEX.minS,ad->rangeALEX.maxS); cp->set_width(plotRangeContour.width()); cp->set_height(plotRangeContour.heigth()); cp->set_palette(ui->comboBoxPalette->colorPalette()); cp->set_Nx(histAlex->nx); cp->set_Ny(histAlex->ny); cp->set_imageColumn(colHist2D); cp->set_nanColor(Qt::transparent); cp->set_contourLevels(contourLevels); cp->set_relativeLevels(relativeLevels); plot->get_plotter()->set_showKey(true); plot->addGraph(cp); gsl_histogram2d_free(histAlex); // possible segmentation faults when calling draw() <-- but not if storing data in datastore setPlotRange(plotRangeContour,plot); }
void ALEXHistogramsWidget::zoomFull2DHistogram() { setPlotRange(ad->rangeALEX,ui->widPlotDensity); }