Thursday, December 8, 2011

A Powerful Pstricks Tool ---- Psgrid

Making grid with pstricks is very easy. You can just include "\psgrid" in your pspicture environment (note that psgrid can also used outside pspicture environment), then a beautiful grid will be drawn, just like the following:


Fig.1 The simplest usage of psgrid

Command "\psgrid" can be followed with three arguments, i.e., "\psgrid(x0,y0)(x1,y1)(x2,y2)". (x1,y1) and (x2,y2) are the opposing corner of the grid area. The dedault value of (x1,y1) is (0,0). If (x1,y1) and (x2,y2) are both not specified, in a pspicture environment the coordinate of the current pspicture will be used, and outside a pspicture environment (10,10) will be used. By default, the intervals are labeled. The horizontal labels will be placed at positions (*,y0) and the vertical labels will be placed at positions (x0,*). If (x0,y0) is omitted, (x1,y1) will be used.

The appearance of the grid can be changed if some parameters are applied."(sub)gridwidth","(sub)gridcolor" can be used to change the width and color of the main grid and sub grid. When (sub)griddots=num and num is a positive value , the (sub)grid lines are dotted with num dots per division. gridlabels and gridlabelcolor can used to control the size and color of the grid lables, and the default value of these two parameters is 10pt and black. If a positive int number(num) is set to parameter subgriddiv, then the main grid will be divided into num parts, and the default value is 5.

In the following example we will examine "\psgrid" in detail.

    \newrgbcolor{mycolor1}{0.5 0.3 0.3}
    \newrgbcolor{mycolor2}{0.3 0.5 0.5}

Fig.2 Psgrid with some options
Files Download: tex ps pdf

No comments:

Post a Comment

Creative Commons License
Except as otherwise noted, the content of this page is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.