I have run across a problem using the extcairo driver and multiple,
differently dimensioned plots. The attached C program
ext-cairo-test-problem.c is a modified version of
examples/c/ext-cairo-test.c from the PLplot source tree and
illustrates the problem I am having.
To compile the attached code, you can use:
gcc ext-cairo-test-problem.c -o ext-cairo-test-problem `pkg-config
--cflags --libs plplotd cairo`
gcc ext-cairo-test-workaround.c -o ext-cairo-test-workaround
`pkg-config --cflags --libs plplotd cairo`
They require that the extcairo driver is enabled. After the generated
executable is run, a test.ps file is generated. For the
ext-cairo-test-problem case, there are labels painted in the lower
left corner of the page. For the ext-cairo-test-workaround case, new
labels are superimposed over the original "x" "y" "title" labels, as
The basic steps to reproduce the problem:
1. Start an extcairo plot
2. Create a new plot stream with plmkstrm
3. Set the new plot stream to use extcairo and have different
dimensions than the original plot started in (1) using
4. End the new plot stream created in (2) with plend1
5. Plot something, now that PLplot is using plot (1) again as the
plotting target, and see how the coordinates are calculated
I found a workaround, illustrated in ext-cairo-test-workaround.c,
which is done by adding the following steps:
4.1. Create another new stream, using the extcairo driver.
4.2. Set the new stream to have the same dimensions as the original
plot started in (1).
4.3. End the new plot stream created in (4.1) with plend1.
In this case, OR if the new stream created in (2) is initialized using
some other plot device (ex. psc), the problem does not come up.
This problem does not occur, as far as I can tell, for any other
driver combinations. png + psc, psc + pscairo, extcairo + psc and
other all work fine. extcairo + extcairo is where I run in to the
I have been digging through the PLplot code in an attempt to track
down the source of this problem for a better fix than the above
workaround but I have not had any luck so far. Any suggestions on how
to proceed? I am using the latest PLplot SVN.
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science