I am doing a figure and I want to fill a polygon with fillstyle=vlines or fillstyle=hlines but I want this filling in a different color to the black which is what throws by default. Besides this, I also want to change the separation between the lines. How can I do this?



enter image description here

The idea is to change the color of the command vlines.

enter image description here


Just 4 fun with PSTricks.

\foreach \i/\c in {1/red,2/green,3/blue,4/magenta,5/cyan,6/orange,7/black,8/yellow,9/pink,10/gray}{%
    \psframe[fillstyle=vlines,hatchcolor=\c,hatchsep=\i pt](6,6)

enter image description here


For instance:

\pspolygon[fillstyle=hlines, hatchcolor=blue,hatchsep=6pt]...

or, if you want to set it for all what you want to fill:

\psset{fillstyle=hlines, hatchcolor=blue,hatchsep=6pt}

The other parameters re explained in § 14 of pstuser.doc(version 1.5, 2007). Here is a summary:

hatchwidth = … defines the lines thickness (default 0.8pt)

hatchsep defaults to 4pt.

hatchangle = … defines the angle of the hatch lines with the horizontal (for hlines) or vertical direction (for vlines). It defaults to 45, so that hlines are oriented SW-NE. and vlines are oriented NW-SE.

fillcolor = … defines the background color. You can use color expression from the xcolor package.

  • It's \psset, not \pset. – Svend Tveskæg Mar 2 '14 at 13:08
  • @Svend Tveskæd: Sorry for the typo. Corrected. – Bernard Mar 2 '14 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.