Thursday, December 1, 2011

Some basic graph objects in pstricks (2) ---- Lines

Command "\psline[parameters]{arrowstyle}(x1,y1)(x2,y2)...(xn,yn)" draws a line through points (x1,x2),(x2,y2)...(xn,yn).

Command "\pspolygon" is similar to "\psline", except that it draws a closed path and when a star is added, the closed area is filled with linecolor.

Arrowstyle can be specified to tell pstricks which type of arrowhead the line terminated. The most used parameters include "linecolor", "linewidth", "linestyle" "linearc" and "cornersize". Linecolor and linewidth have the its literal meanings. Linestyle can take values "none,solid,dashed,dotted". When "dashed" is used, paramter "dash=len1 len2" can be used to specify the dash pattern. And when "dotted" is used, paramete "dotsep=len" can be used to specify the distance between the nearest two dots. If you want the line have round corners, parameter "linearc" is very useful. This parameter specifies the radius of arcs drawn at the corners. To show the points on the line, "showpoints=true" can be useful. To show how these commands and parameters are used, there is an example.

      {<->}(1,1) (4,4)
      dash=3pt 3pt]{->}(1,4) (4,1)

The lines looks like this:
Fig.1 Lines drawn using Pstricks
Files Download: tex ps pdf

1 comment:

  1. Very nice illustration of the use of \pspolygon[par], parameters.

    Thank you,

    -peter rejto


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.