4

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?

Example:

\documentclass{article}
\usepackage{pst-poly}
\usepackage{pst-fill}
\begin{document}
\begin{center}
\begin{pspicture}(0,0)(6,6)
\pspolygon[fillstyle=vlines](1,1)(1,4)(4,4)(4,1)
\end{pspicture}
\end{center}
\end{document}

enter image description here

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

enter image description here

2

2 Answers 2

4

Just 4 fun with PSTricks.

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

enter image description here

0
4

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .