# [pstricks] 2D color map

Antoine Pairet lists at pairet.be
Wed May 19 23:45:28 CEST 2010

```On Mon, 2010-05-03 at 17:16 +0200, Herbert Voss wrote:
> Am 03.05.2010 17:05, schrieb Antoine Pairet:
>
> > What is the best way to create 2D color maps with PSTricks? I have data
> > files containing (x, y, z) values and I would like to plot a 2D area
> > which is filled by a specific color depending on the z-value. An example
> > of the result I am trying to obtain is attached to this email.
>
> http://tug.org/PSTricks/main.cgi?file=pst-plot/3D/contour

Wonderful!
It is exactly what I have been looking for. I have 2 questions though:

------------------- 1 ----------------------
If I understand correctly, they are three possibilities:
1. \psColorMatrixPlot
2. \pstContour
3. \psContPlotIIID

They all are able to produce the same output.
What is the reason behind having three solutions for the same purpose?
Which implementation has to be preferred?
Are there performance differences? Is \psColorMatrixPlot faster because
it knows the size of the array?

------------------- 2 ----------------------
What about the colour scale?
Would it be possible to determine it?
Currently, \pstContour automatically attributes the same colour code to
all data set: Zmin = purple; Zmax = brown (I could be wrong with respect
to the colours, but the principle is right). Then for every
z-coordinates that it plotted, a relative between 0 and 1 is computed
and associated to a colour.
With this technique, different data set can not be compared
quantitatively.

I successfully generated nice images with \pstContour. The attached file
contains 40 images generated thanks to \pstContour. Within each picture,
colour has a meaning. However, I cannot compare colours between pictures
as they are relative values.

A possible workaround would simply be to put 2 fictitious points
containing max and min values in each of the data set. In this case, the
colour scale would always be the same.
Another, and preferred, solution would be to be able to pass zMin and
zMax as arguments of \pstContour:
\pstContour[colored,zMin=xxx,zMax=yyy]{file}

If defined, these arguments would replace the following line in
contour.tex:
/zMax 0 def /zMin 0 def       % lowest and highest value
Regarding the case in which a value of zMin (zMax) would be given that
is smaller (larger) than the actual min (max), two solutions can be
proposed:
1. replace zMin by actual min, same rule for max
2. attribute color of zMin/zMax for values below/above zMin/zMax

Thank you in advance for your help.

best regards,
Antoine

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Hp22.png
Type: image/png
Size: 261726 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20100519/aeca5ec9/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: contour.tex
Type: text/x-tex
Size: 1665 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20100519/aeca5ec9/attachment-0001.bin>
```

More information about the PSTricks mailing list