[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plotting and PSTricks



On Sat, 17 Jul 2004, Ryszard Tanas wrote:

> Thank you for this explanation. Your example gives what I wanted, but it
> is far from obvious how to get it. As I understand it now, it is not
> possible to mix pstricks using functions with "ordinary" functions. We
> have to separate both, yes?
>
The way I'd say it is: If use_pstricks() is set, then all paths and path-
like objects (ellipse arcs, splines, graphs...) will be filled whether or
not they're closed. Thus, if you're plotting a graph or parametric curve
that you do not want filled, you should do

  use_pstricks(false);

before the plot command. (In the example, I moved the plot command to the
end only to shorten the file.) It is possible to (un)set use_pstricks()
freely, but there are fine points:

1. If use_pstricks() is not set when begin() is called, then the necessary
  length-setting pstricks macro will not be written to the output file.
  (The macro can be added manually, but that's tedious.)

2. Without unsetting use_pstricks, you can do

  psset("fillstyle=none");

  to stop pstricks from filling paths. However, ordinary ePiX color
  declarations do not apply to paths when use_pstricks is set; you instead
  have to do (e.g.)

  psset("linecolor=red");

  Obtaining non-primary colors is possible, but a little inconvenient:

  std::cout << "\n\\newrgbcolor{orange}{1 0.7 0.2}";
  psset("fillcolor=orange,linecolor=red,linewidth=1.5pt");


In more detail, ePiX prints "labels" and "paths". In this sense, a label
is a figure element whose shape is calculated by LaTeX (such as a glyph or
a box of text), while a path is a list of points. Labels are unaffected by
use_pstricks, while paths are affected as follows:

use_pstricks(true):  \psline (pstricks macro)
use_pstricks(false): \path   (eepic macro)

The side effects arise from the different (more intelligent:) way pstricks
handles path attributes like color and filling. ePiX's path class was
designed for eepic, in which the question "to fill, or not to fill" is
determined on a path-by-path basis. In pstricks, filling is handled by a
global attribute (fillstyle). It wouldn't be difficult to modify the
path::draw() function so that a path that shouldn't be filled in pstricks
*isn't* filled, but I'm hesitant to do so. There would still be side
effects with color because pstricks is also more intelligent than
color.sty about maintaining colors for different roles -- fillcolor,
linecolor, etc. Rather than (further) entangle the logic of path drawing
with the differing semantics of eepic and pstricks, I'd rather leave
use_pstricks a semi-ugly hack for getting color in path filling, and plan
for elegance in TNG. :)


Andrew D. Hwang			ahwang@mathcs.holycross.edu
Department of Math and CS	http://math.holycross.edu/~ahwang
College of the Holy Cross	(508) 793-2458 (Office: 320 Swords)
Worcester, MA, 01610-2395	(508) 793-3530 (fax)