Ejemplo n.º 1
0
PlPlotWidget::PlPlotWidget(QWidget *parent) :
    QWidget(parent)
{
    setAttribute( Qt::WA_DeleteOnClose );

    plot = new QtExtWidget( parent->width(), parent->height(), parent ); //this should fit the widget box

    plmkstrm( &strm );// One window = One plot widget = one stream
    plsdev( "extqt" );
    plsetqtdev( plot );
    plinit();

    plot->setBackgroundColor(255,255,255,1);
    //resize( 400, 320 );
    pladv( 0 );
    unsigned int col = 255;
    plscolbg(col,col,col);
}
Ejemplo n.º 2
0
static PyObject * pl_partialInitXw(PyObject *self, PyObject *args)
{
    PLINT ipls;
    PLStream *pls;  
    TRY (PyArg_ParseTuple(args, ":pl_partialInitXw"));
    ipls=0;

    plmkstrm(&ipls);
    printf(" ipls=%d\n",ipls); 
    plgpls(&pls);   /* pls points directly to a structure PLStream */
    printf(" pls OK \n"); 

    /* Partially initialize X driver. */

    pllib_init();

    plsdev("xwin");
    pllib_devinit();
    plP_esc(PLESC_DEVINIT, NULL);

    printf("devinit  OK \n"); 

    return Py_BuildValue("i", ipls);
}
Ejemplo n.º 3
0
int
main( int argc, char *argv[] )
{
    PLINT digmax, cur_strm, new_strm;
    char  ver[80];

// plplot initialization

// Parse and process command line arguments

    plMergeOpts( options, "x01c options", notes );
    plparseopts( &argc, argv, PL_PARSE_FULL );

// Get version number, just for kicks

    plgver( ver );
    fprintf( stdout, "PLplot library version: %s\n", ver );

// Initialize plplot
// Divide page into 2x2 plots
// Note: calling plstar replaces separate calls to plssub and plinit
    plstar( 2, 2 );

// Select font set as per input flag

    if ( fontset )
        plfontld( 1 );
    else
        plfontld( 0 );

// Set up the data
// Original case

    xscale = 6.;
    yscale = 1.;
    xoff   = 0.;
    yoff   = 0.;

// Do a plot

    plot1( 0 );

// Set up the data

    xscale = 1.;
    yscale = 0.0014;
    yoff   = 0.0185;

// Do a plot

    digmax = 5;
    plsyax( digmax, 0 );

    plot1( 1 );

    plot2();

    plot3();

    //
    // Show how to save a plot:
    // Open a new device, make it current, copy parameters,
    // and replay the plot buffer
    //

    if ( f_name )   // command line option '-save filename'

    {
        printf( "The current plot was saved in color Postscript under the name `%s'.\n", f_name );
        plgstrm( &cur_strm );    // get current stream
        plmkstrm( &new_strm );   // create a new one

        plsfnam( f_name );       // file name
        plsdev( "psc" );         // device type

        plcpstrm( cur_strm, 0 ); // copy old stream parameters to new stream
        plreplot();              // do the save by replaying the plot buffer
        plend1();                // finish the device

        plsstrm( cur_strm );     // return to previous stream
    }

// Let's get some user input

    if ( locate_mode )
    {
        for (;; )
        {
            if ( !plGetCursor( &gin ) )
                break;
            if ( gin.keysym == PLK_Escape )
                break;

            pltext();
            printf( "subwin = %d, wx = %f,  wy = %f, dx = %f,  dy = %f\n",
                gin.subwindow, gin.wX, gin.wY, gin.dX, gin.dY );
            printf( "keysym = 0x%02x, button = 0x%02x, string = '%s', type = 0x%02x, state = 0x%02x\n",
                gin.keysym, gin.button, gin.string, gin.type, gin.state );
            plgra();
        }
    }

// Don't forget to call plend() to finish off!

    plend();
    exit( 0 );
}