コード例 #1
0
main(int argc, char* argv[]){ 
    static vec u(K+1);
    int k,n;
    std::string op=argv[1]; // command line argument
	val dx=1.0/K, dt=T/N, dx4=dx*dx*dx*dx, xk, tn; // discretization variables

    // Initialize
    for(k=0;k<=K;k++){
        xk=k*dx;
        u(k)=f(xk);
    }
    if(op=="plot") printf("set terminal x11 noraise\nset yrange [-5:5]\nset style data lines\n\n");

    val rho=NU*dt/dx4;    // rho = nu*dt/dx^4
    vec temp(K+1);
    temp=u;

    for(n=0;n<=N;n++){
		tn=n*dt;
        u=temp;
        for(k=0;k<=K;k++){   
            xk=k*dx;
            temp(k) = u(k) - rho*delta4(u,k);    
            //printu(u,tn,xk,K);
        }
        if(op=="plot0") plot0(u, tn, K-1, N);
        if(op=="plot1") plot1(u, tn, K-1, N);
        if(op=="plot3d") plot3d(u, tn, K-1, N);
        if(op=="approx") output(tn, 0.5, u(K/2), K-1, N);
    }

    return 0;
}
コード例 #2
0
ファイル: plotv2vsptComp.C プロジェクト: XuQiao/HI
void plotv2vsptComp(){
	TCanvas *c1 = new TCanvas();
	V2vsPt->SetLineColor(2);
	V2vsPt->SetTitle("v_{2} vs momentum");
	V2vsPt->GetXaxis()->SetTitle("p_{T} (GeV/c)");
	V2vsPt->GetYaxis()->SetTitle("v_{2} obs");
	V2vsPt->GetYaxis()->SetRangeUser(0,0.15);
	V2vsPt->Draw();
	TGraphErrors* gr[neta];
	TGraphErrors* gr1[neta];
        TLegend *tl = new TLegend(0.6,0.7,0.8,0.90);
	int color[neta]={1,2,4,2,6};
	int marker[neta]={20,24,29,34,25};
	for(int ieta=0;ieta<2;ieta++){
		gr[ieta] = plot(ieta,color[ieta],marker[ieta]);
		gr1[ieta] = plot1(ieta,color[ieta+2],marker[ieta+2]);
		gr[ieta]->Draw("Psame");
		gr1[ieta]->Draw("Psame");
		tl->AddEntry(gr[ieta],Form("w non-flowEP |eta|>%.1f gap",etap[ieta]),"lp");
		tl->AddEntry(gr1[ieta],Form("w/o non-flow EP |eta|>%.1f gap",etap[ieta]),"lp");
	}
        TLatex t;
        t.SetNDC();
        t.SetTextSize(0.04);
        t.DrawLatex(0.2,0.7,"2-sub event method");
	tl->SetFillColor(0);
	tl->SetTextSize(0.03);
	tl->SetBorderSize(0);
	tl->AddEntry(V2vsPt,"input v_{2}","lp");
	tl->Draw("same");
	c1->Print("v2vsptComp.png");
}
コード例 #3
0
ファイル: x26c.c プロジェクト: CronosProject/chronos
int
main( int argc, char *argv[] )
{
    int i;
// Parse and process command line arguments

    (void) plparseopts( &argc, argv, PL_PARSE_FULL );

// Initialize plplot

    plinit();
    plfont( 2 );

// Make log plots using two different styles.

    i = 0;
    while ( x_labels[i] != NULL )
    {
        plot1( 0, x_labels[i], y_labels[i], alty_labels[i],
            legend_texts[i], title_labels[i], line_labels[i] );
        i++;
    }

    plend();
    exit( 0 );
}
コード例 #4
0
int main(){

	const int N = 8;
	const int N3 = N*N*N;
	float w = 100;

	// Initialize raw color data
	Color bulk[N3];
	for(int i=0; i<N3; ++i){
		float f = float(i)/N3;
		bulk[i].set(f, 1-f, cos(f*6.2832*6)*0.5+0.5, 1);
	}

	// Create a wrapper around raw data to obtain slices
	Data cols(&(bulk[0][0]), 4,N,N,N);

	GLV glv;

	// These plots will show all the xy slices	
	Plot plots[N];
	for(int i=0; i<N; ++i){
		plots[i].add(*new PlotDensity);
		plots[i].set(Rect(w*i,0, w,w));
		plots[i].showGrid(false);
		plots[i].data() = cols.slice(cols.size(0,1,2)*i).shape(4,N,N);
		//plots[i].data() = cols.slice(cols.size(0,1,2)*i + 2).shape(1,N,N).stride(4);
		glv << plots[i];
	}

	// This plot will show a flattened 1D color array
	Plot plot1(Rect(0,w+40*0, w*N,40), *new PlotDensity);
	
	// These plots will show flattened color component arrays
	Plot plotR(Rect(0,w+40*1, w*N,40), *new PlotDensity(Color(1,0,0)));
	Plot plotG(Rect(0,w+40*2, w*N,40), *new PlotDensity(Color(0,1,0)));
	Plot plotB(Rect(0,w+40*3, w*N,40), *new PlotDensity(Color(0,0,1)));

	plot1.data() = cols.slice(0).shape(4, cols.size(1,2,3));
	plotR.data() = cols.slice(0).shape(1, cols.size(1,2,3)).stride(4);
	plotG.data() = cols.slice(1).shape(1, cols.size(1,2,3)).stride(4);
	plotB.data() = cols.slice(2).shape(1, cols.size(1,2,3)).stride(4);

	glv << plot1 << plotR << plotG << plotB;
			
	Window win(0,0, "Density Plot", &glv);
	win.fit();
// 3% = base
// 7% = rectangles

//	plot1.name("plot1");
//	plotR.name("plotR");
//	std::string s;
//	glv.modelToString(s);
//	printf("%s\n", s.c_str());

	Application::run();
}
コード例 #5
0
ファイル: scopeplot.cpp プロジェクト: cureton/qsstv
void scopePlot::add1(double *data, unsigned long len,QString curveName,QString yLeftLabel)
{
  x.resize(len);
  c1.resize(len);
  for (unsigned long i = 0; i < len; i++)
    {
      x[i]=(double)(i+xOffset)*xScaleMul;
      c1[i]=data[i];
    }
  plot1(curveName,yLeftLabel);
}
コード例 #6
0
ファイル: xtk01.c プロジェクト: distanceModling/DAKOTA
void myplot1()
{
/* Set up the data */
/* Original case */

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

/* Do a plot */

    plot1();
}
コード例 #7
0
ファイル: xtk01.c プロジェクト: FreeScienceCommunity/PLPlot
void myplot1()
{
// Set up the data
// Original case

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

// Do a plot

    plot1();
}
コード例 #8
0
ファイル: experiments.cpp プロジェクト: ziyan/unfollow
void plotParitialDegDistribution(const PNGraph& graph, std::vector<int>& nodeList) {
	std::map<int, int> inDegDistMap;
	std::map<int, int> outDegDistMap;
	
	for (int i = 0; i < nodeList.size(); ++i) {
		int curNodeId = nodeList[i];
		if (!graph->IsNode(curNodeId)) continue;
		TNGraph::TNodeI ni = graph->GetNI(curNodeId);

		int curNodeInDeg = ni.GetInDeg();
		if (inDegDistMap.find(curNodeInDeg) == inDegDistMap.end()) {
			inDegDistMap.insert(std::pair<int, int>(curNodeInDeg, 0));
		}
		inDegDistMap[curNodeInDeg]++;

		int curNodeOutDeg = ni.GetOutDeg();
		if (outDegDistMap.find(curNodeOutDeg) == outDegDistMap.end()) {
			outDegDistMap.insert(std::pair<int, int>(curNodeOutDeg, 0));
		}
		outDegDistMap[curNodeOutDeg]++;
		
	}
	
	TFltPrV inDegDist;
	for (std::map<int, int>::iterator itr = inDegDistMap.begin(); itr != inDegDistMap.end(); itr++) {
		inDegDist.Add(TFltPr(itr->first, itr->second));
	}

	TFltPrV outDegDist;
	for (std::map<int, int>::iterator itr = outDegDistMap.begin(); itr != outDegDistMap.end(); itr++) {
		outDegDist.Add(TFltPr(itr->first, itr->second));
	}
	
	TGnuPlot plot1("inDegDistParitial", "");
	plot1.AddPlot(inDegDist, gpwPoints, "");
	plot1.SetScale(gpsLog10XY);
	plot1.SavePng();

	TGnuPlot plot2("outDegDistParitial", "");
	plot2.AddPlot(outDegDist, gpwPoints, "");
	plot2.SetScale(gpsLog10XY);
	plot2.SavePng();

	TGnuPlot plot3("DegDistParitial", "");
	plot3.AddCmd("set key right top");
	plot3.AddPlot(inDegDist, gpwPoints, "In Degree");
	plot3.AddPlot(outDegDist, gpwPoints, "Out Degree");
	plot3.SetScale(gpsLog10XY);
	plot3.SavePng();
}
コード例 #9
0
ファイル: xtk01.c プロジェクト: distanceModling/DAKOTA
void myplot2()
{
    PLINT digmax;

/* Set up the data */

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

/* Do a plot */

    digmax = 5;
    plsyax(digmax, 0);
    plot1();
}
コード例 #10
0
main(int argc, char* argv[]){ 
    int k,n,i,j;
    std::string op=argv[1]; // command line argument
	val dx=1.0/K, dt=T/N, dx4=dx*dx*dx*dx, xk, tn; // discretization variables
    val rho=NU*dt/dx4;    // rho = nu*dt/dx^4
    static vec u(K-1), v(K+1);
    
    // We allocate 2 lower & 4 upper diagonal, according to the example
    static banded_matrix<val> U(K-1, K-1, 2, 4);
    vector<fortran_int_t> p(K-1);
    
    // Initialize matrix
    for(i=0; i<U.size1(); i++){
            U(i,i)=1.0+6.0*rho; 
            k=std::max(i-1,1);
            U(k,k-1)=U(k-1,k)=-4.0*rho;
            U(k,k+1)=U(k+1,k)=-4.0*rho;
            k=std::max(i-2,2);
            U(k,k-2)=U(k-2,k)=1.0*rho;
            U(k,k+2)=U(k+2,k)=1.0*rho;
        }
    // Boundary Conditions
    U(0,0)-=1.0*rho;
    U(K-2,K-2)-=1.0*rho;
    if(op=="matrix"){ printf("Pentadiagonal Matrix\n"); matprintf(U);}

    // Initial conditions
    for(k=0;k<=K;k++){
        xk=k*dx;
        v(k)=f(xk);
    }
    u=subrange(v,1,K);
    //printf("Original Vector\n"); vecprintf(u,dx);

    lapack::gbtrf(U, p); // LU-decompostion
    for(n=0;n<=N;n++){
        tn=n*dt;
        lapack::gbtrs(U, p, u); // Solve
        if(op=="plot0") plot0(u, tn, K-1, N);
        if(op=="plot1") plot1(u, tn, K-1, N);
        if(op=="plot3d" && (n-1)%NMOD==0) plot3d(u, tn, K-1, N);
        if(op=="approx") output(tn, 0.5, u(K/2-1), K-1, N);
    }
    return 0;
}
コード例 #11
0
ファイル: x15c.c プロジェクト: black13/lua-graphing
int
main( int argc, const char *argv[] )
{
    int   i, j;
    PLFLT xx, yy;

/* Parse and process command line arguments */

    (void) plparseopts( &argc, argv, PL_PARSE_FULL );

/* Set up color map 0 */
/*
 *  plscmap0n(3);
 */
/* Set up color map 1 */

    cmap1_init2();

/* Initialize plplot */

    plinit();

/* Set up data array */

    for ( i = 0; i < XPTS; i++ )
    {
        xx = (double) ( i - ( XPTS / 2 ) ) / (double) ( XPTS / 2 );
        for ( j = 0; j < YPTS; j++ )
        {
            yy = (double) ( j - ( YPTS / 2 ) ) / (double) ( YPTS / 2 ) - 1.0;

            z[i][j] = xx * xx - yy * yy + ( xx - yy ) / ( xx * xx + yy * yy + 0.1 );
        }
    }
    f2mnmx( &z[0][0], XPTS, YPTS, &zmin, &zmax );

    plot1();
    plot2();
    plot3();

    plend();
    exit( 0 );
}
コード例 #12
0
ファイル: experiments.cpp プロジェクト: ziyan/unfollow
void plotDegDistribution(const PNGraph& graph) {
	TFltPrV outDegDist;
	TSnap::GetOutDegCnt(graph, outDegDist);
	TGnuPlot plot1("outDegDist", "");
	plot1.AddPlot(outDegDist, gpwPoints, "");
	plot1.SetScale(gpsLog10XY);
	plot1.SavePng();

	TFltPrV inDegDist;
	TSnap::GetInDegCnt(graph, inDegDist);
	TGnuPlot plot2("inDegDist", "");
	plot2.AddPlot(inDegDist, gpwPoints, "");
	plot2.SetScale(gpsLog10XY);
	plot2.SavePng();

	TGnuPlot plot3("DegDist", "");
	plot3.AddCmd("set key right top");
	plot3.AddPlot(inDegDist, gpwPoints, "In degree");
	plot3.AddPlot(outDegDist, gpwPoints, "Out degree");
	plot3.SetScale(gpsLog10XY);
	plot3.SavePng();
}
コード例 #13
0
ファイル: x01c.c プロジェクト: CronosProject/chronos
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 );
}
コード例 #14
0
ファイル: x14c.c プロジェクト: distanceModling/DAKOTA
int
main(int argc, char *argv[])
{
    int i, digmax;
    int xleng0 = 400, yleng0 = 300, xoff0 = 200, yoff0 = 200;
    int xleng1 = 400, yleng1 = 300, xoff1 = 500, yoff1 = 500;

/* Select either TK or DP driver and use a small window */
/* Using DP results in a crash at the end due to some odd cleanup problems */
/* The geometry strings MUST be in writable memory */

    char geometry_master[] = "500x410+100+200";
    char geometry_slave[]  = "500x410+650+200";

    char driver[80];

/* plplot initialization */
/* Parse and process command line arguments */

    (void) plparseopts(&argc, argv, PL_PARSE_FULL);

    plgdev(driver);

    printf("Demo of multiple output streams via the %s driver.\n", driver);
    printf("Running with the second stream as slave to the first.\n");
    printf("\n");

/* Set up first stream */

    plsetopt("geometry", geometry_master);

    plsdev(driver);
    plssub(2, 2);
    plinit();

/* Start next stream */

    plsstrm(1);

/* Turn off pause to make this a slave (must follow master) */

    plsetopt("geometry", geometry_slave);
    plspause(0);
    plsdev(driver);
    plinit();

/* Set up the data & plot */
/* Original case */

    plsstrm(0);

    xscale = 6.;
    yscale = 1.;
    xoff = 0.;
    yoff = 0.;
    plot1();

/* Set up the data & plot */

    xscale = 1.;
    yscale = 1.e+6;
    plot1();

/* Set up the data & plot */

    xscale = 1.;
    yscale = 1.e-6;
    digmax = 2;
    plsyax(digmax, 0);
    plot1();

/* Set up the data & plot */

    xscale = 1.;
    yscale = 0.0014;
    yoff = 0.0185;
    digmax = 5;
    plsyax(digmax, 0);
    plot1();

/* To slave */
/* The pleop() ensures the eop indicator gets lit. */

    plsstrm(1);
    plot4();
    pleop();

/* Back to master */

    plsstrm(0);
    plot2();
    plot3();

/* To slave */

    plsstrm(1);
    plot5();
    pleop();

/* Back to master to wait for user to advance */

    plsstrm(0);
    pleop();

/* Call plend to finish off. */

    plend();
    exit(0);
}
コード例 #15
0
ファイル: main.c プロジェクト: imincik/pkg-grass
int main(int argc, char **argv)
{
    char *mapset;
    int ret, level;
    int i, stat = 0, type, display;
    int chcat = 0;
    int r, g, b;
    int has_color, has_fcolor;
    struct color_rgb color, fcolor;
    double size;
    int default_width;
    double width_scale;
    int verbose = FALSE;
    double minreg, maxreg, reg;
    char map_name[128];
    struct GModule *module;
    struct Option *map_opt;
    struct Option *color_opt, *fcolor_opt, *rgbcol_opt, *zcol_opt;
    struct Option *type_opt, *display_opt;
    struct Option *icon_opt, *size_opt, *sizecolumn_opt, *rotcolumn_opt;
    struct Option *where_opt;
    struct Option *field_opt, *cat_opt, *lfield_opt;
    struct Option *lcolor_opt, *bgcolor_opt, *bcolor_opt;
    struct Option *lsize_opt, *font_opt, *xref_opt, *yref_opt;
    struct Option *attrcol_opt, *maxreg_opt, *minreg_opt;
    struct Option *width_opt, *wcolumn_opt, *wscale_opt;
    struct Option *render_opt;
    struct Flag *verbose_flag;	/* please remove before GRASS 7 released */
    struct Flag *id_flag, *table_acolors_flag, *cats_acolors_flag, *x_flag,
	*zcol_flag;
    struct cat_list *Clist;
    int *cats, ncat;
    LATTR lattr;
    struct Map_info Map;
    struct field_info *fi;
    dbDriver *driver;
    dbHandle handle;
    struct Cell_head window;
    BOUND_BOX box;
    double overlap;

    /* Initialize the GIS calls */
    G_gisinit(argv[0]);

    module = G_define_module();
    module->keywords = _("display, vector");
    module->description = _("Displays user-specified vector map "
			    "in the active graphics frame.");
    
    map_opt = G_define_standard_option(G_OPT_V_MAP);

    display_opt = G_define_option();
    display_opt->key = "display";
    display_opt->type = TYPE_STRING;
    display_opt->required = YES;
    display_opt->multiple = YES;
    display_opt->answer = "shape";
    display_opt->options = "shape,cat,topo,dir,attr,zcoor";
    display_opt->description = _("Display");
    display_opt->descriptions = _("shape;Display geometry of features;"
				  "cat;Display category numbers of features;"
				  "topo;Display topology information (nodes, edges);"
				  "dir;Display direction of linear features;"
				  "attr;Display selected attribute based on 'attrcol';"
				  "zcoor;Display z-coordinate of features (only for 3D vector maps)");
    
    /* Query */
    type_opt = G_define_standard_option(G_OPT_V_TYPE);
    type_opt->answer = "point,line,boundary,centroid,area,face";
    type_opt->options = "point,line,boundary,centroid,area,face";
    type_opt->guisection = _("Selection");

    field_opt = G_define_standard_option(G_OPT_V_FIELD);
    field_opt->label =
	_("Layer number (if -1, all layers are displayed)");
    field_opt->gisprompt = "old_layer,layer,layer_all";
    field_opt->guisection = _("Selection");

    cat_opt = G_define_standard_option(G_OPT_V_CATS);
    cat_opt->guisection = _("Selection");

    where_opt = G_define_standard_option(G_OPT_WHERE);
    where_opt->guisection = _("Selection");

    /* Colors */
    color_opt = G_define_option();
    color_opt->key = "color";
    color_opt->type = TYPE_STRING;
    color_opt->answer = DEFAULT_FG_COLOR;
    color_opt->label = _("Feature color");
    color_opt->guisection = _("Colors");
    color_opt->gisprompt = "old_color,color,color_none";
    color_opt->description =
	_("Either a standard GRASS color, R:G:B triplet, or \"none\"");

    fcolor_opt = G_define_option();
    fcolor_opt->key = "fcolor";
    fcolor_opt->type = TYPE_STRING;
    fcolor_opt->answer = "200:200:200";
    fcolor_opt->label = _("Area fill color");
    fcolor_opt->guisection = _("Colors");
    fcolor_opt->gisprompt = "old_color,color,color_none";
    fcolor_opt->description =
	_("Either a standard GRASS color, R:G:B triplet, or \"none\"");

    rgbcol_opt = G_define_standard_option(G_OPT_COLUMN);
    rgbcol_opt->key = "rgb_column";
    rgbcol_opt->guisection = _("Colors");
    rgbcol_opt->description = _("Name of color definition column (for use with -a flag)");
    rgbcol_opt->answer = "GRASSRGB";

    zcol_opt = G_define_option();
    zcol_opt->key = "zcolor";
    zcol_opt->key_desc = "style";
    zcol_opt->type = TYPE_STRING;
    zcol_opt->required = NO;
    zcol_opt->description = _("Type of color table (for use with -z flag)");
    zcol_opt->answer = "terrain";
    zcol_opt->guisection = _("Colors");

    /* Lines */
    width_opt = G_define_option();
    width_opt->key = "width";
    width_opt->type = TYPE_INTEGER;
    width_opt->answer = "0";
    width_opt->guisection = _("Lines");
    width_opt->description = _("Line width");

    wcolumn_opt = G_define_standard_option(G_OPT_COLUMN);
    wcolumn_opt->key = "wcolumn";
    wcolumn_opt->guisection = _("Lines");
    wcolumn_opt->description =
	_("Name of column for line widths (these values will be scaled by wscale)");

    wscale_opt = G_define_option();
    wscale_opt->key = "wscale";
    wscale_opt->type = TYPE_DOUBLE;
    wscale_opt->answer = "1";
    wscale_opt->guisection = _("Lines");
    wscale_opt->description = _("Scale factor for wcolumn");

    /* Symbols */
    icon_opt = G_define_option();
    icon_opt->key = "icon";
    icon_opt->type = TYPE_STRING;
    icon_opt->required = NO;
    icon_opt->multiple = NO;
    icon_opt->guisection = _("Symbols");
    icon_opt->answer = "basic/x";
    /* This could also use ->gisprompt = "old,symbol,symbol" instead of ->options */
    icon_opt->options = icon_files();
    icon_opt->description = _("Point and centroid symbol");

    size_opt = G_define_option();
    size_opt->key = "size";
    size_opt->type = TYPE_DOUBLE;
    size_opt->answer = "5";
    size_opt->guisection = _("Symbols");
    size_opt->label = _("Symbol size");
    size_opt->description =
	_("When used with the size_column option this becomes the scale factor");

    sizecolumn_opt = G_define_standard_option(G_OPT_COLUMN);
    sizecolumn_opt->key = "size_column";
    sizecolumn_opt->guisection = _("Symbols");
    sizecolumn_opt->description =
	_("Name of numeric column containing symbol size");

    rotcolumn_opt = G_define_standard_option(G_OPT_COLUMN);
    rotcolumn_opt->key = "rot_column";
    rotcolumn_opt->guisection = _("Symbols");
    rotcolumn_opt->label =
	_("Name of numeric column containing symbol rotation angle");
    rotcolumn_opt->description =
	_("Measured in degrees CCW from east");

    /* Labels */
    lfield_opt = G_define_standard_option(G_OPT_V_FIELD);
    lfield_opt->key = "llayer";
    lfield_opt->guisection = _("Labels");
    lfield_opt->description =
	_("Layer number for labels (default: the given layer number)");

    attrcol_opt = G_define_standard_option(G_OPT_COLUMN);
    attrcol_opt->key = "attrcol";
    attrcol_opt->multiple = NO;	/* or fix attr.c, around line 102 */
    attrcol_opt->guisection = _("Labels");
    attrcol_opt->description = _("Name of column to be displayed");

    lcolor_opt = G_define_option();
    lcolor_opt->key = "lcolor";
    lcolor_opt->type = TYPE_STRING;
    lcolor_opt->answer = "red";
    lcolor_opt->label = _("Label color");
    lcolor_opt->guisection = _("Labels");
    lcolor_opt->gisprompt = "old_color,color,color";
    lcolor_opt->description = _("Either a standard color name or R:G:B triplet");

    bgcolor_opt = G_define_option();
    bgcolor_opt->key = "bgcolor";
    bgcolor_opt->type = TYPE_STRING;
    bgcolor_opt->answer = "none";
    bgcolor_opt->guisection = _("Labels");
    bgcolor_opt->label = _("Label background color");
    bgcolor_opt->gisprompt = "old_color,color,color_none";
    bgcolor_opt->description =
	_("Either a standard GRASS color, R:G:B triplet, or \"none\"");

    bcolor_opt = G_define_option();
    bcolor_opt->key = "bcolor";
    bcolor_opt->type = TYPE_STRING;
    bcolor_opt->answer = "none";
    bcolor_opt->guisection = _("Labels");
    bcolor_opt->label = _("Label border color");
    bcolor_opt->gisprompt = "old_color,color,color_none";
    bcolor_opt->description =
	_("Either a standard GRASS color, R:G:B triplet, or \"none\"");

    lsize_opt = G_define_option();
    lsize_opt->key = "lsize";
    lsize_opt->type = TYPE_INTEGER;
    lsize_opt->answer = "8";
    lsize_opt->guisection = _("Labels");
    lsize_opt->description = _("Label size (pixels)");

    font_opt = G_define_option();
    font_opt->key = "font";
    font_opt->type = TYPE_STRING;
    font_opt->guisection = _("Labels");
    font_opt->description = _("Font name");

    xref_opt = G_define_option();
    xref_opt->key = "xref";
    xref_opt->type = TYPE_STRING;
    xref_opt->guisection = _("Labels");
    xref_opt->answer = "left";
    xref_opt->options = "left,center,right";
    xref_opt->description = _("Label horizontal justification");

    yref_opt = G_define_option();
    yref_opt->key = "yref";
    yref_opt->type = TYPE_STRING;
    yref_opt->guisection = _("Labels");
    yref_opt->answer = "center";
    yref_opt->options = "top,center,bottom";
    yref_opt->description = _("Label vertical justification");

    minreg_opt = G_define_option();
    minreg_opt->key = "minreg";
    minreg_opt->type = TYPE_DOUBLE;
    minreg_opt->required = NO;
    minreg_opt->description =
	_("Minimum region size (average from height and width) "
	  "when map is displayed");

    maxreg_opt = G_define_option();
    maxreg_opt->key = "maxreg";
    maxreg_opt->type = TYPE_DOUBLE;
    maxreg_opt->required = NO;
    maxreg_opt->description =
	_("Maximum region size (average from height and width) "
	  "when map is displayed");

    render_opt = G_define_option();
    render_opt->key = "render";
    render_opt->type = TYPE_STRING;
    render_opt->required = NO;
    render_opt->multiple = NO;
    render_opt->answer = "c";
    render_opt->options = "g,r,d,c,l";
    render_opt->description = _("Rendering method for filled polygons");
    render_opt->descriptions =
	_("g;use the libgis render functions (features: clipping);"
	  "r;use the raster graphics library functions (features: polylines);"
	  "d;use the display library basic functions (features: polylines);"
	  "c;use the display library clipping functions (features: clipping);"
	  "l;use the display library culling functions (features: culling, polylines)");

    /* please remove before GRASS 7 released */
    verbose_flag = G_define_flag();
    verbose_flag->key = 'v';
    verbose_flag->description = _("Run verbosely");

    /* Colors */
    table_acolors_flag = G_define_flag();
    table_acolors_flag->key = 'a';
    table_acolors_flag->guisection = _("Colors");
    table_acolors_flag->description =
	_("Get colors from map table column (of form RRR:GGG:BBB)");

    cats_acolors_flag = G_define_flag();
    cats_acolors_flag->key = 'c';
    cats_acolors_flag->guisection = _("Colors");
    cats_acolors_flag->description =
	_("Random colors according to category number "
	  "(or layer number if 'layer=-1' is given)");

    /* Query */
    id_flag = G_define_flag();
    id_flag->key = 'i';
    id_flag->guisection = _("Selection");
    id_flag->description = _("Use values from 'cats' option as feature id");

    x_flag = G_define_flag();
    x_flag->key = 'x';
    x_flag->description =
	_("Don't add to list of vectors and commands in monitor "
	  "(it won't be drawn if the monitor is refreshed)");

    zcol_flag = G_define_flag();
    zcol_flag->key = 'z';
    zcol_flag->description = _("Colorize polygons according to z height");
    zcol_flag->guisection = _("Colors");

    /* Check command line */
    if (G_parser(argc, argv))
	exit(EXIT_FAILURE);

    if (G_strcasecmp(render_opt->answer, "g") == 0)
	render = RENDER_GPP;
    else if (G_strcasecmp(render_opt->answer, "r") == 0)
	render = RENDER_RPA;
    else if (G_strcasecmp(render_opt->answer, "d") == 0)
	render = RENDER_DP;
    else if (G_strcasecmp(render_opt->answer, "c") == 0)
	render = RENDER_DPC;
    else if (G_strcasecmp(render_opt->answer, "l") == 0)
	render = RENDER_DPL;
    else
	render = RENDER_GPP;

    /* please remove -v flag before GRASS 7 released */
    if (verbose_flag->answer) {
	G_putenv("GRASS_VERBOSE", "3");
	G_warning(_("The '-v' flag is superseded and will be removed "
		    "in future. Please use '--verbose' instead."));
    }
    /* but keep this */
    if (G_verbose() > G_verbose_std())
	verbose = TRUE;

    G_get_set_window(&window);

    if (R_open_driver() != 0)
	G_fatal_error(_("No graphics device selected"));

    /* Read map options */

    /* Check min/max region */
    reg = ((window.east - window.west) + (window.north - window.south)) / 2;
    if (minreg_opt->answer) {
	minreg = atof(minreg_opt->answer);

	if (reg < minreg) {
	    G_message(_("Region size is lower than minreg, nothing displayed."));
	    D_add_to_list(G_recreate_command());
	    exit(EXIT_SUCCESS);
	}
    }
    if (maxreg_opt->answer) {
	maxreg = atof(maxreg_opt->answer);

	if (reg > maxreg) {
	    G_message(_("Region size is greater than maxreg, nothing displayed."));
	    D_add_to_list(G_recreate_command());
	    exit(EXIT_SUCCESS);
	}
    }

    G_strcpy(map_name, map_opt->answer);

    default_width = atoi(width_opt->answer);
    if (default_width < 0)
	default_width = 0;
    width_scale = atof(wscale_opt->answer);

    if (table_acolors_flag->answer && cats_acolors_flag->answer) {
	cats_acolors_flag->answer = '\0';
	G_warning(_("The '-c' and '-a' flags cannot be used together, "
		    "the '-c' flag will be ignored!"));
    }

    color = G_standard_color_rgb(WHITE);
    ret = G_str_to_color(color_opt->answer, &r, &g, &b);
    if (ret == 1) {
	has_color = 1;
	color.r = r;
	color.g = g;
	color.b = b;
    }
    else if (ret == 2) {	/* none */
	has_color = 0;
    }
    else if (ret == 0) {	/* error */
	G_fatal_error(_("Unknown color: [%s]"), color_opt->answer);
    }

    fcolor = G_standard_color_rgb(WHITE);
    ret = G_str_to_color(fcolor_opt->answer, &r, &g, &b);
    if (ret == 1) {
	has_fcolor = 1;
	fcolor.r = r;
	fcolor.g = g;
	fcolor.b = b;
    }
    else if (ret == 2) {	/* none */
	has_fcolor = 0;
    }
    else if (ret == 0) {	/* error */
	G_fatal_error(_("Unknown color: '%s'"), fcolor_opt->answer);
    }

    size = atof(size_opt->answer);

    /* Make sure map is available */
    mapset = G_find_vector2(map_name, "");

    if (mapset == NULL)
	G_fatal_error(_("Vector map <%s> not found"), map_name);

    /* if where_opt was specified select categories from db 
     * otherwise parse cat_opt */
    Clist = Vect_new_cat_list();
    Clist->field = atoi(field_opt->answer);

    /* open vector */
    level = Vect_open_old(&Map, map_name, mapset);

    if (where_opt->answer) {
	if (Clist->field < 1)
	    G_fatal_error(_("'layer' must be > 0 for 'where'."));
	chcat = 1;
	if ((fi = Vect_get_field(&Map, Clist->field)) == NULL)
	    G_fatal_error(_("Database connection not defined"));
	if (fi != NULL) {
	    driver = db_start_driver(fi->driver);
	    if (driver == NULL)
		G_fatal_error(_("Unable to start driver <%s>"), fi->driver);

	    db_init_handle(&handle);
	    db_set_handle(&handle, fi->database, NULL);
	    if (db_open_database(driver, &handle) != DB_OK)
		G_fatal_error(_("Unable to open database <%s>"),
			      fi->database);

	    ncat =
		db_select_int(driver, fi->table, fi->key, where_opt->answer,
			      &cats);

	    db_close_database(driver);
	    db_shutdown_driver(driver);

	    Vect_array_to_cat_list(cats, ncat, Clist);
	}
    }
    else if (cat_opt->answer) {
	if (Clist->field < 1)
	    G_fatal_error(_("'layer' must be > 0 for 'cats'."));
	chcat = 1;
	ret = Vect_str_to_cat_list(cat_opt->answer, Clist);
	if (ret > 0)
	    G_warning(_("%d errors in cat option"), ret);
    }

    type = Vect_option_to_types(type_opt); 

    i = 0;
    display = 0;
    while (display_opt->answers[i]) {
	switch (display_opt->answers[i][0]) {
	case 's':
	    display |= DISP_SHAPE;
	    break;
	case 'c':
	    display |= DISP_CAT;
	    break;
	case 't':
	    display |= DISP_TOPO;
	    break;
	case 'd':
	    display |= DISP_DIR;
	    break;
	case 'a':
	    display |= DISP_ATTR;
	    break;
	case 'z':
	    display |= DISP_ZCOOR;
	    break;
	}
	i++;
    }

    /* Read label options */
    if (lfield_opt->answer != NULL)
	lattr.field = atoi(lfield_opt->answer);
    else
	lattr.field = Clist->field;

    lattr.color.R = lattr.color.G = lattr.color.B = 255;
    if (G_str_to_color(lcolor_opt->answer, &r, &g, &b)) {
	lattr.color.R = r;
	lattr.color.G = g;
	lattr.color.B = b;
    }
    lattr.has_bgcolor = 0;
    if (G_str_to_color(bgcolor_opt->answer, &r, &g, &b) == 1) {
	lattr.has_bgcolor = 1;
	lattr.bgcolor.R = r;
	lattr.bgcolor.G = g;
	lattr.bgcolor.B = b;
    }
    lattr.has_bcolor = 0;
    if (G_str_to_color(bcolor_opt->answer, &r, &g, &b) == 1) {
	lattr.has_bcolor = 1;
	lattr.bcolor.R = r;
	lattr.bcolor.G = g;
	lattr.bcolor.B = b;
    }

    lattr.size = atoi(lsize_opt->answer);
    lattr.font = font_opt->answer;
    switch (xref_opt->answer[0]) {
    case 'l':
	lattr.xref = LLEFT;
	break;
    case 'c':
	lattr.xref = LCENTER;
	break;
    case 'r':
	lattr.xref = LRIGHT;
	break;
    }
    switch (yref_opt->answer[0]) {
    case 't':
	lattr.yref = LTOP;
	break;
    case 'c':
	lattr.yref = LCENTER;
	break;
    case 'b':
	lattr.yref = LBOTTOM;
	break;
    }

    D_setup(0);

    G_setup_plot(D_get_d_north(), D_get_d_south(),
		 D_get_d_west(), D_get_d_east(), D_move_abs, D_cont_abs);

    if (verbose)
	G_message(_("Plotting ..."));

    if (level >= 2)
	Vect_get_map_box(&Map, &box);

    if (level >= 2 && (window.north < box.S || window.south > box.N ||
		       window.east < box.W ||
		       window.west > G_adjust_easting(box.E, &window))) {
	G_message(_("The bounding box of the map is outside the current region, "
		   "nothing drawn."));
	stat = 0;
    }
    else {
	overlap =
	    G_window_percentage_overlap(&window, box.N, box.S, box.E, box.W);
	G_debug(1, "overlap = %f \n", overlap);
	if (overlap < 1)
	    Vect_set_constraint_region(&Map, window.north, window.south,
				       window.east, window.west,
				       PORT_DOUBLE_MAX, -PORT_DOUBLE_MAX);

	/* default line width */
	if (!wcolumn_opt->answer)
	    D_line_width(default_width);

	if (type & GV_AREA) {
	    if (level >= 2) {
		if (display & DISP_SHAPE) {
		    stat = darea(&Map, Clist,
				 has_color ? &color : NULL,
				 has_fcolor ? &fcolor : NULL, chcat,
				 (int)id_flag->answer,
				 table_acolors_flag->answer,
				 cats_acolors_flag->answer, &window,
				 rgbcol_opt->answer, default_width,
				 wcolumn_opt->answer, width_scale,
				 zcol_flag->answer, zcol_opt->answer);
		}
		if (wcolumn_opt->answer)
		    D_line_width(default_width);
	    }
	    else
		G_warning(_("Unable to display areas, topology not available"));
	}

	if (display & DISP_SHAPE) {
	    if (id_flag->answer && level < 2) {
		G_warning(_("Unable to display lines by id, topology not available"));
	    }
	    else {
		stat = plot1(&Map, type, Clist,
			     has_color ? &color : NULL,
			     has_fcolor ? &fcolor : NULL, chcat, icon_opt->answer,
			     size, sizecolumn_opt->answer, rotcolumn_opt->answer,
			     (int)id_flag->answer, table_acolors_flag->answer,
			     cats_acolors_flag->answer, rgbcol_opt->answer,
			     default_width, wcolumn_opt->answer, width_scale,
			     zcol_flag->answer, zcol_opt->answer);
		if (wcolumn_opt->answer)
		    D_line_width(default_width);
	    }
	}

	if (has_color) {
	    R_RGB_color(color.r, color.g, color.b);
	    if (display & DISP_DIR)
                stat = dir(&Map, type, Clist, chcat, size);
	}

	/* reset line width: Do we need to get line width from display
	 * driver (not implemented)?  It will help restore previous line
	 * width (not just 0) determined by another module (e.g.,
	 * d.linewidth). */
	if (!wcolumn_opt->answer)
	    R_line_width(0);

	if (display & DISP_CAT)
	    stat = label(&Map, type, Clist, &lattr, chcat);

	if (display & DISP_ATTR)
	    stat =
		attr(&Map, type, attrcol_opt->answer, Clist, &lattr, chcat);

	if (display & DISP_ZCOOR)
	    stat = zcoor(&Map, type, &lattr);

	if (display & DISP_TOPO) {
	    if (level >= 2)
		stat = topo(&Map, type, &lattr);
	    else
		G_warning(_("Unable to display topology, not available"));
	}
    }

    if (!x_flag->answer) {
	D_add_to_list(G_recreate_command());

	D_set_dig_name(G_fully_qualified_name(map_name, mapset));
	D_add_to_dig_list(G_fully_qualified_name(map_name, mapset));
    }

    R_close_driver();

    if (verbose)
	G_done_msg(" ");

    Vect_close(&Map);
    Vect_destroy_cat_list(Clist);

    exit(stat);
}