In all the documentation for PGPlot, there is nothing
that indicates that it is possible to change the
background color of the graphing window or if you're
making a pic file, be able to change it there as well.
It seems that white and black seems to be flip flopped
when I'm trying to save graphs as a gif file using the
OO type programming for PGPlot and it would be very
usefull if it was possible to have anything else but a
black background for the graph. I'm trying to use this
utility to make graphs for a scientific web site and
white would be a much preferable color. If there's a
way to already do this, I'd love to know and if not,
would it be possible to add this feature?
---Jebelbryan---
Logged In: YES
user_id=20200
Hey, Jeremy,
Sorry to have not noticed your query for a while.
Unfortunately, it appears to me that background color
control was not a priority to the designers of the original
pgplot package. There are a couple of different ways for
you to get What You Want.
(A) Save the graphic as a file, then reload it and invert it
manually (what a pain).
(B) Use pgenv() explicitly, and draw the background manually
using poly() or rect() [rect was not present -- I have just
checked it into CVS!] , then set the axis color and such
with the COLOR option
(C) Use PLPlot instead. PGPLOT is sort of a legacy package,
and PLPlot has more active development and (I believe)
better control over colors. I know that Doug Hunt, who also
runs a scientific website with a PDL backend, uses PLPlot as
his package of choice.
Logged In: NO
I beleive there is another way changing the colour table
with the pgscr command of the low level PGPLOT package.
There you can change the colors associated with the color
indices.
Here is an example to plot the background red. The
background has color index 0 and the pen has color index 1.
#!/usr/bin/perl-x -w
use PDL;
use PDL::Graphics::PGPLOT::Window;
use PGPLOT;
$w=pgwin(Device=>'/xserve');
# Change background to red!!
pgscr(0,1,0,0);
$x=pdl[1,2,3,4];
$y=pdl[7,8,9,10];
$w->points($x,$y);
More details at
http://www.astro.caltech.edu/~tjp/pgplot/subroutines.html#P
GSCR
Xavier Calbet
I've reduced the priority of this request to reflect the probably deprecation of PGPLOT in the overall PDL graphics strategy. The hope is that PLplot functionality will replace PGPLOT functions.