# [pstricks] framing overlapping objects

Matthias Thomae bluez at thomae-privat.de
Wed Aug 18 14:54:54 CEST 2004

```Hello Herbert,

Herbert Voss wrote:
> maybe that I do not really understand here.

Yes, I think so too ;) but its probably that I haven't made myself clear
enough.

> You use (1,6) as upper left point, but your pspicture area is
> only 5 units high ... Here is another idea

I made a python script which, in simplified terms, takes a set of data
files as input, and generates from these a tex file in order to draw the
data on a pstricks plot. Additionally, the script automatically computes
a 'legend', in order to discriminate the different input data sets.

Later, I intend to include the generated tex/pstricks plots in my
thesis, therefor I need a proper 'border' around the picture, to be able
to write text above and below it.

Now, the main problem is that I do NOT know the exact dimensions of the
legend, because it depends on a variety of factors (font sizes, number
of variable parameters of all data sets, psmatrix separations etc.), and
I were too lazy to look for a formula that puts them all together...

Until recently, I managed without knowing the legend size, by putting
the legend and the plot _underneath_, in two rows of a psmatrix environment.
However, in some cases this consumes more space than necessary, because
there is some 'free space' on the plot where the legend may fit.

Now, to compact my pictures, I added a 'feature' to my script which
calculates the free space (in y direction), and puts this distance as a
negative row separation to the psmatrix, so that the plot and the legend
'overlap' and hence consume less space, as in the following schematic:

----------
--| legend |--   -----free
| ---------- |   -----space
|       x    |
| plot x     |
|    xx      |
|   x        |
--------------

_However_, it may occur that the legend is smaller (in y direction) than
the free space, and in this case (see the tex script from my first mail
for an example) the psmatrix borders are 'incorrect'.

I am not sure if there is a solution to this problem that doesn't
involve me calculating the legend dimensions, but maybe you can imagine one?

Hopefully I made myself clearer this time...

Regards and thanks for reading all this ;)
Matthias

```