当前位置: 首页>>代码示例>>C++>>正文


C++ Plotter类代码示例

本文整理汇总了C++中Plotter的典型用法代码示例。如果您正苦于以下问题:C++ Plotter类的具体用法?C++ Plotter怎么用?C++ Plotter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Plotter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PlotAll

static void PlotAll (Scene& scene, Plotter& plotter)
{
  Vector x(1,steps), Pot(1,steps);
  for (int i = 1; i <= steps; i++) {
    x(i) = xmin + (i-1)*(xmax-xmin)/(steps-1);
    Pot(i) = V(x(i));
  }
  plotter.clear();
  double ymin = -1, ymax = min(6.0,max(1.0,Max(Pot))); // betwwen 1 and 6 !!
  plotter.axisframe(xmin,xmax,ymin,ymax, "x","V(x), Psi(x)");
  plotter.style(plotter.LINES);

  plotter.plot(x,Pot);			// potential
  scene.Line(xmin,ymin,xmin,ymax);
  scene.Line(xmax,ymin,xmax,ymax);

  scene.SetColor(ColorB(255,0,0));	// wave function
  plotter.plot(x,Psi);

  scene.SetColor(ColorB(0,0,255));	// eigen energy
  scene.Line(xmin,E,xmax,E);	
  scene.SetTextStyle(Standard);
  char label[60];
  sprintf(label,"E=%.8g",E);
  scene.Write(xmin+0.01,E+0.05,label);
}
开发者ID:lucafuji,项目名称:Gene-Correlation,代码行数:26,代码来源:shooting.cpp

示例2: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Plotter w;
    w.show();
    return a.exec();
}
开发者ID:fariel1989,项目名称:Plotter,代码行数:7,代码来源:main.cpp

示例3: Plotter

void CMenuRecord::slot_do_boxing()
{
   // CDlgRecordWave *dlg = new CDlgRecordWave(this);

    Plotter *plotter = new Plotter(this);

    int numPoints = 100;
    QVector<QPointF> points0;
    QVector<QPointF> points1;
    for (int x = 0; x < numPoints; ++x) {
        points0.append(QPointF(x, uint(qrand()) % 100));
        points1.append(QPointF(x, uint(qrand()) % 100));
    }
    plotter->setCurveData(0, points0);
    plotter->setCurveData(1, points1);

    PlotSettings settings;
    settings.minX = 0.0;
    settings.maxX = 100.0;
    settings.minY = 0.0;
    settings.maxY = 100.0;
    plotter->setPlotSettings(settings);

   plotter->show();
}
开发者ID:zyzzyva8421,项目名称:monitor,代码行数:25,代码来源:menu_record.cpp

示例4: main

/* A dive plot widget prototype to show proof of concept.
 *
 * Based on example from GUI Programming with Qt4 (Summerfield/Blanchette).
 *
 * We read a dive in from a simple text file and render the dive plot on
 * a QWidget using basic QPainter operations.  We show the colour of the
 * depth profile changing with dy/dx, the ability to fill the enclosed area
 * with a gradient and some simple drawing and text placement.
 *
 * Panning and zooming are pretty much unaltered from the example, with the
 * exception of mods to reverse the direction of the vertical axis to use
 * a "going down means counting up" convention which makes more sense for
 * a dive.
 *
 * Aim is to show proof of concept to non-Qt programmers working on subsurface.
 * Question: what if any capabilities are needed that aren't on show here?
 *
*/
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Plotter plotter;
    plotter.setWindowTitle(QObject::tr("Dive Plotter"));
    readDive(&plotter, "dive.txt");
    plotter.show();
    return app.exec();
}
开发者ID:amitkc,项目名称:diveprofile,代码行数:27,代码来源:main.cpp

示例5: erase

 void paddleType::erase (Plotter& g)
 {
     if (oldLoc.getX() != loc.getX())
     {
         g.setColor(black);
         for(int i = -width/2; i <= width/2; i ++)
         {
             g.plot(oldLoc.getX() + i, oldLoc.getY(), SQUARE);
         }
     }
 }
开发者ID:Chuks101,项目名称:BREAK_____GAME,代码行数:11,代码来源:paddle.cpp

示例6: draw

 void paddleType::draw (Plotter& g)
 {
     if (oldLoc.getX() != loc.getX())
     {
         g.setColor(color);
         for(int i = -width/2; i <= width/2; i ++)
         {
             g.plot(loc.getX() + i, loc.getY(), SQUARE);
         }
     }
     oldLoc = loc;
 }
开发者ID:Chuks101,项目名称:BREAK_____GAME,代码行数:12,代码来源:paddle.cpp

示例7: main

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    Plotter plotter;
    plotter.setWindowTitle(QObject::tr("Plotter"));

	// function above - set data and paint plotter curves
    readFlightCurves(&plotter, "in1.txt");

    plotter.show();
    return app.exec();
}
开发者ID:,项目名称:,代码行数:12,代码来源:

示例8: Draw

void Ship::Draw(double x, double y)
{
    // draw ship
    Plotter p;




    for (int r = 0; r < 5; r++)
    {
        for (int c = 0; c < 5; c++)
        {
            p.setColor(rocket[r][c]);
            p.plot(x + c, y + r, SQUARE);
        }
    }

}
开发者ID:maggieschmeltekopf,项目名称:1430groupproject,代码行数:18,代码来源:Ship.cpp

示例9: main

int main(int argc, char** argv) {
	if(argc<2){
		cout << "Configuration file is not specified." << endl ;
		return -1;
	}

	Configuration* config = new Configuration(argv[1]);
	Plotter* plot = new Plotter(gnuPlot, config);

	cout << "generating voronoi diagram..." << endl ;
	float* xValues = new float[100];
	float* yValues = new float[100];
	long count = 100;
	for(int i=0;i<count;i++){
		xValues[i] = utility::unifRand(-10, 10);
		yValues[i] = utility::unifRand(-10, 10);
	}

	VoronoiDiagramGenerator vdg;
	vdg.generateVoronoi(xValues,yValues,count, -10,10,-10,10,0);

	cout << "here it comes..." << endl ;
	vdg.resetIterator();

	float x1,y1,x2,y2;

	printf("\n-------------------------------\n");
	while(vdg.getNext(x1,y1,x2,y2))
	{
		plot->drawLine(x1,y1,x2, y2);
		printf("GOT Line (%f,%f)->(%f,%f)\n",x1,y1,x2, y2);

	}

	plot->close();
	delete config;
	delete plot;
	return 0;
}
开发者ID:ahmadyan,项目名称:RRT,代码行数:39,代码来源:main.cpp

示例10: plot

void Histogram::plot(Plotter& plotter) {
    const double tot = static_cast<double>(total());
    const double order_error = log10(error());

    std::ostringstream cmd;
    cmd << "set title 'O(Error) = " << order_error << "'\n"
        << "set xrange [-pi:pi]\n"
        << "set yrange [" << 0.0 << ":" << (maximum + minimum) << "]\n"
        << "plot '-' with linespoints pointtype 5"
        << " linecolor rgbcolor 'black' title 'Reference',"
        << " '-' with linespoints pointtype 7"
        << " linecolor rgbcolor 'blue' title 'Simulation'\n";
    for (unsigned k = 0; k < nbins; k++)
        cmd << angle(k, nbins) << " " << reference[k] << "\n";
    cmd << "\ne\n";
    for (unsigned k = 0; k < nbins; k++)
        cmd << angle(k, nbins) << " "
            << static_cast<double>(histogram[k]) / tot << "\n";
    cmd << "\ne\n";
    plotter.send(cmd.str());
}
开发者ID:jmbr,项目名称:baoab-constraints,代码行数:21,代码来源:Histogram.cpp

示例11: draw_axes

int draw_axes(Plotter& plot, WorldPt cross, Color col_ax, int ax_thickness,
		float x_tic, float y_tic, bool labels, int width, int prec,
		Color col_lab)
{
	int const EPS = 1.0e-6f;
	int const fontsize = 15;

	float tic_pos;
	float direction;
	float limit;
	float tic_length;

	WorldPt wl;
	WorldPt wu;
	WorldPt p;
	ScrPt pv;

	int labelPixs;

	Color col_prev;
	int thick_prev;

	String str;

	Font my_font;
	if (!my_font.LoadFromFile("FreeMono.ttf", fontsize))
	{
		return EXIT_FAILURE;
	}

	col_prev = plot.get_draw_col();
	plot.set_draw_col(col_ax);
	thick_prev = plot.get_draw_thick();
	plot.set_draw_thick(ax_thickness);

	plot.get_world_ext(wl, wu);

	p.x = wl.x;
	p.y = cross.y;
	plot.move(p);

	p.x = wu.x;
	plot.draw(p);

	p.x = cross.x;
	p.y = wl.y;
	plot.move(p);

	p.y = wu.y;
	plot.draw(p);

	direction = 1.0f;
	limit = wu.x * (1.0f + EPS);

	if (limit == 0.0f)
	{
		limit = EPS * abs(wl.x);
	}
	x_tic = abs(x_tic);
	tic_length = 0.01f * (wu.y - wl.y);

	while (true)
	{
		tic_pos = cross.x + x_tic;
		while (direction * tic_pos <= limit)
		{
			p.x = tic_pos;
			p.y = cross.y;

			if (labels)
			{
				plot.world2scr(p, pv);

				labelPixs = 6 * width * fontsize / 10;
				pv.x -= labelPixs / 2;

				ostringstream ss;
				ss << setw(width) << setprecision(prec) << fixed << right
						<< tic_pos;
				str.SetText(ss.str());
				str.SetFont(my_font);
				str.SetColor(col_lab);
				str.SetSize(fontsize);
				str.SetPosition(pv.x, pv.y);
				plot.Draw(str);
			}

			plot.move(p);
			p.y += tic_length;
			plot.draw(p);
			tic_pos += x_tic;
		}

		if (direction < 0.0f)
		{
			break;
		}

		direction = -1.0f;
		limit = direction * wl.x;
//.........这里部分代码省略.........
开发者ID:broeckho,项目名称:gobelijn,代码行数:101,代码来源:draw_axes.cpp

示例12: main

int main() {
   float lumi = 2260.;
   TString dir = "/Users/dygyun/Top/HET_v763";
   //TString dir = "/xrootd/store/user/tjkim/ntuples/hep/V6";
   TFile * fA = TFile::Open(dir+"/hep_TT_powheg.root");
   TFile * fB = TFile::Open(dir+"/hep_TT_powheg.root");
   TFile * fC = TFile::Open(dir+"/hep_WJets.root");
   TFile * fD = TFile::Open(dir+"/hep_DYJets.root");
   TFile * fE = TFile::Open(dir+"/hep_DYJets_10to50.root");
   TFile * fI = TFile::Open(dir+"/hep_SingleTop_t.root");
   TFile * fJ = TFile::Open(dir+"/hep_SingleTbar_t.root");
   TFile * fK = TFile::Open(dir+"/hep_SingleTop_tW.root");
   TFile * fL = TFile::Open(dir+"/hep_SingleTbar_tW.root");
   TFile * fN = TFile::Open(dir+"/hep_WW.root");
   TFile * fO = TFile::Open(dir+"/hep_WZ.root");
   TFile * fM = TFile::Open(dir+"/hep_ZZ.root");
//   TFile * fP = TFile::Open(dir+"/hep_qcd.root");
   
   TH1F * hBsemi = (TH1F*) fA->Get("TopTree/EventSummary");
   TH1F * hB = (TH1F*) fB->Get("TopTree/EventSummary");
   TH1F * hC = (TH1F*) fC->Get("TopTree/EventSummary");
   TH1F * hD = (TH1F*) fD->Get("TopTree/EventSummary");
   TH1F * hE = (TH1F*) fE->Get("TopTree/EventSummary");
   TH1F * hI = (TH1F*) fI->Get("TopTree/EventSummary");
   TH1F * hJ = (TH1F*) fJ->Get("TopTree/EventSummary");
   TH1F * hK = (TH1F*) fK->Get("TopTree/EventSummary");
   TH1F * hL = (TH1F*) fL->Get("TopTree/EventSummary");
   TH1F * hN = (TH1F*) fN->Get("TopTree/EventSummary");
   TH1F * hO = (TH1F*) fO->Get("TopTree/EventSummary");
   TH1F * hM = (TH1F*) fM->Get("TopTree/EventSummary");
 //  TH1F * hP = (TH1F*) fP->Get("");
   int nevt = -1;

   MyAnalysis *A = new MyAnalysis();
   TChain* ch = new TChain("TopTree/events");
   ch->Add(Form("%s/hep_data_json.root",dir.Data()), nevt);
   ch->Process(A);
   
   MyAnalysis_others *B = new MyAnalysis_others(1,1,831.8,lumi,hB->GetBinContent(1));
   TChain* ch2 = new TChain("TopTree/events");
   ch2->Add(Form("%s/hep_TT_powheg.root",dir.Data()), nevt);
   ch2->Process(B);
   //////
   MyAnalysis_Sig *Bsemi = new MyAnalysis_Sig(1,1,831.8,lumi,hBsemi->GetBinContent(1));
   TChain* ch2semi = new TChain("TopTree/events");
   ch2semi->Add(Form("%s/hep_TT_powheg.root",dir.Data()), nevt);
ch2semi->Process(Bsemi);
///////// 
   MyAnalysis *C = new MyAnalysis(1,1,61524,lumi,hC->GetBinContent(2));
   TChain* ch3 = new TChain("TopTree/events");
   ch3->Add(Form("%s/hep_WJets.root",dir.Data()),nevt);
   ch3->Process(C);
   
   MyAnalysis *D = new MyAnalysis(1,1,6025.2,lumi,hD->GetBinContent(1));
   TChain* ch4 = new TChain("TopTree/events");
   ch4->Add(Form("%s/hep_DYJets.root",dir.Data()),nevt);
   ch4->Process(D);
  
   MyAnalysis *E = new MyAnalysis(1,1,18610.0,lumi,hE->GetBinContent(1));
   TChain* ch5 = new TChain("TopTree/events");
   ch5->Add(Form("%s/hep_DYJets_10to50.root",dir.Data()),nevt);
   ch5->Process(E);
 
   MyAnalysis *I = new MyAnalysis(1,1,44.33,lumi,hI->GetBinContent(1));
   TChain* ch6 = new TChain("TopTree/events");
   ch6->Add(Form("%s/hep_SingleTop_t.root",dir.Data()),nevt);
   ch6->Process(I);
  
   MyAnalysis *J = new MyAnalysis(1,1,26.38,lumi,hJ->GetBinContent(1));
   TChain* ch7 = new TChain("TopTree/events");
   ch7->Add(Form("%s/hep_SingleTbar_t.root",dir.Data()),nevt);
   ch7->Process(J);

   MyAnalysis *K = new MyAnalysis(1,1,35.6,lumi,hK->GetBinContent(1));
   TChain* ch8 = new TChain("TopTree/events");
   ch8->Add(Form("%s/hep_SingleTop_tW.root",dir.Data()),nevt);
   ch8->Process(K);

   MyAnalysis *L = new MyAnalysis(1,1,35.6,lumi,hL->GetBinContent(1));
   TChain* ch9 = new TChain("TopTree/events");
   ch9->Add(Form("%s/hep_SingleTbar_tW.root",dir.Data()),nevt);
   ch9->Process(L);
   
   MyAnalysis *N = new MyAnalysis(1,1,118.7,lumi,hN->GetBinContent(1));
   TChain* ch10 = new TChain("TopTree/events");
   ch10->Add(Form("%s/hep_WW.root",dir.Data()),nevt);
   ch10->Process(N);

   MyAnalysis *O = new MyAnalysis(1,1,47.13,lumi,hO->GetBinContent(1));
   TChain* ch11 = new TChain("TopTree/events");
   ch11->Add(Form("%s/hep_WZ.root",dir.Data()),nevt);
   ch11->Process(O);
   
   MyAnalysis *M = new MyAnalysis(1,1,16.523,lumi,hM->GetBinContent(1));
   TChain* ch12 = new TChain("TopTree/events");
   ch12->Add(Form("%s/hep_ZZ.root",dir.Data()),nevt);
   ch12->Process(M);
 
Plotter P;

//.........这里部分代码省略.........
开发者ID:dygyun,项目名称:TopSemiLepton,代码行数:101,代码来源:example_qcd.C

示例13: main

int main(int argc, char *argv[])
{

/************************************************* example as a standalone window ************************************************************/
/*	
	//create an application
	QApplication app(argc, argv);					
   
	// create and fill the data vector
	QVector<QPointF> data1;
	for (float i=0;i<20;i+=0.1)
		data1.append(QPointF(i,sin(i)));

	// create and fill another data vector
	QVector<QPointF> data2;
	for (float i=0;i<20;i+=0.1)
		data2.append(QPointF(i,sin(i/2)));

	//creat the plotter and set its data
	Plotter *plotter = new Plotter;							// create a plotter
	plotter->setPlotSettings(PlotSettings(0,20,-2,2));		//initialise the axis
	plotter->setCurveData(0,data1);							//set the first plotter data set
	plotter->setCurveData(1,data2);							//set the second plotter data set
	
	//show the plotter widget
	plotter->show();										
    
	//execute the application
	return app.exec();						
*/
/*********************************************************************************************************************************************/


/******************************************** example of use as a widget among others *********************************************************/
	
	//create an application
	QApplication app(argc, argv);				

	// create a window
    QWidget *window = new QWidget;
	window->setWindowTitle("Plotter widget application");

	// create a label
	QLabel *label = new QLabel("<h2><i><font color=blue> Plot example </font> </i></h2>");
	
	//create the plotter and its data
	Plotter *plotter = new Plotter;	
	plotter->setPlotSettings(PlotSettings(0,20,-2,2));		
	
	QVector<QPointF> data1;
	for (float i=0;i<20;i+=0.1)
		data1.append(QPointF(i,sin(i)));
	QVector<QPointF> data2;
	for (float i=0;i<20;i+=0.1)
		data2.append(QPointF(i,sin(i/2)));
	
	plotter->setCurveData(0,data1);							
	plotter->setCurveData(1,data2);							
	

	//layout the widgets
	QVBoxLayout *layout = new QVBoxLayout;
	layout -> addWidget (label);
	layout -> addWidget (plotter);
	window->setLayout(layout);
	
	//show the window
	window->show();

	//execute the application
	return app.exec();	
	
/*********************************************************************************************************************************************/


}
开发者ID:pyrech,项目名称:telemetre,代码行数:76,代码来源:main.cpp

示例14: Plotter

/**
  * Creates an exact copy of this diagram.
  */
Plotter* Plotter::clone() const
{
    Plotter* newDiagram = new Plotter( new Private( *d ) );
    newDiagram->setType( type() );
    return newDiagram;
}
开发者ID:czchen,项目名称:debian-massif-visualizer,代码行数:9,代码来源:KDChartPlotter.cpp

示例15: printPicture

//Picture that prints rocket
void printPicture(char ch)
{
    Plotter screen;
    int x=200;
    int y=200;

    if(ch=='@')
      {
          screen.setColor(darkgreen);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }
      else if(ch=='0')
      {
          screen.setColor(darkgreen);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
       else if(ch=='8')
      {
          screen.setColor(green);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
       else if(ch=='b')
      {
          screen.setColor(blue);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
       else if(ch=='C')
      {
          screen.setColor(yellow);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
       else if(ch=='G')
      {
          screen.setColor(darkyellow);
          screen.plot(x,y,SQUARE);
          x++;
          y++;

      }
      else if(ch=='O')
      {
          screen.setColor(black);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }


      else if(ch=='#')
      {
          screen.setColor(red);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }
      else if (ch==';')
      {
          screen.setColor(red);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }

      else if(ch==',')
      {
          screen.setColor(white);
          screen.plot(x,y,SQUARE);
          x++;
          y++;
      }

      else if(ch=='+')
      {
        screen.setColor(grey);
         screen.plot(x,y,SQUARE);
         x++;
          y++;
      }
      else if(ch=='`')
      {
         screen.setColor(grey);
         screen.plot(x,y,SQUARE);
         x++;
         y++;
      }
//.........这里部分代码省略.........
开发者ID:maggieschmeltekopf,项目名称:1430groupproject,代码行数:101,代码来源:Picture.cpp


注:本文中的Plotter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。