multiple x windows with plplot

Help
dirk
2006-03-02
2013-03-15
  • dirk
    dirk
    2006-03-02

    Hi all,
    how is it possible to create multiple x windows in a C/C++ program (not multiple graphes in one plot like in x01c) with plplot? Creating multple instances of plstream objects didn't work, I dont know why.
    (Using Pthreads should work, but is not what I really want)
    Any hints are welcome!
    Regards,
    Dirk

     
    • I would like to know the same thing... I programmed the following function to be similar to the matlab plot one.
      Upon multiple calls i would just like the plot to be refreshed or a new window to be opened... however... none of this happens.

      Here it is the function I am speaking about:
      void plot( float* y_T, int N )
      {
          PLFLT *x = new PLFLT[N];
          PLFLT *y  = new PLFLT[N];
          for (int i = 0; i < N; i++) {
              x[ i ] = i;
              y[ i ] = y_T[ i ];
          }
         
          // Initialize PLplot.
          plstream *pls = new plstream();
          plsdev( "gcw" );                 /* USE GNOME OUTPUT WINDOW LIBRARY BY DEFAULT */
          plscolbg (255,255,255);         /* SET THE GRAPH BACKGROUND */
          pls->init();                      /* INITIALIZE THE WIDGET */
          pls->font(2);                     /* CHOOSE THE FONT */
          pls->adv(0);                     /* advance to next page */
         
          pls->vpor( 0.1,0.9,0.1,0.9 );    /* position of graph inside window */       
            pls->wind( 0, N, 0, 400);         /* set axis x-range, y-range (matlab axis command)*/
         
          // Draw axis with their style
          plrgb(0,0,0); pls->box("bnstg", 0.0, 0, "bnstvg", 0.0, 0);
         
          // Plot ampl vs freq.
          plcol0(1); c_plpoin( N, x, y, 'o' ); /* plot stem graph */
          plrgb(1,0,1); pls->line( N, x, y ); /* plot line junction points */
         
          // Put labels on.
          plrgb(0,0,0); pls->mtex("b", 3.2, 0.5, 0.5, "Frequency");
          plrgb(0,0,0); pls->mtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)");

          delete[] x;
          delete[] y;
          delete pls;
      }