Hi Paul, If you're trying to plot an image, I would use the plimage() subroutine instead of plshades.
Or, you can use this slightly higher-level routine (with an example of usage preceeding it), which might make it into the real PDL::Graphics::PLplot some day. No FITS coordinate transforms yet, so it just gives you everything in pixel coordinates. This has not been extensively tested, but should suffice for simple stuff. cheers, Derek $fits = rfits("foo.fits"); $w = PDL::Graphics::PLplot->new(DEV=>'xwin',FILE=>':0',JUST=>1); $w->imag($fits,PALETTE=>'GREYSCALE'); sub PDL::Graphics::PLplot::imag { my $self = shift; my $img = shift; my %opts = @_; #set PLplot to right output stream plsstrm($self->{STREAMNUMBER}); #advance the (sub)page unless we're being held or the window is brand new pladv(0) unless $self->held or !exists($self->{BOX}); #only process COLORMAP entries once my $z = $opts{COLORMAP}; delete ($opts{COLORMAP}); #set ticks to be external $self->{XBOX} = $self->{XBOX} . 'i' unless exists($opts{XBOX});# =~ /i/i; $self->{YBOX} = $self->{YBOX} . 'i' unless exists($opts{YBOX});# =~ /i/i; $self->setparm(%opts); my @borders = (-0.5,$img->dim(0)-0.5,-0.5,$img->dim(1)-0.5); unless ($self->held){ $self->{BOX} = \...@borders; } $self->_setwindow; $self->_drawlabels; # draw the image plimage($img,@borders,0,0,@borders); # plot box plcol0 (1); # set to frame color plbox ($self->{XTICK}, $self->{NXSUB}, $self->{YTICK}, $self->{NYSUB}, $self->{XBOX}, $self->{YBOX}); # !!! note out of order call plflush(); } #end sub imag Paul Boley wrote: > Dear all, > > I've just subscribed to this list and am rather new to PLplot, so > please excuse me if I'm asking something which I should know from the > documentation or mailing list archives! I've taken a look, but haven't > found anything dealing with this issue. > > I'm using plshades to draw 2d data. In my case, it's a FITS > image with dimensions 1044x1046 (about 2 megabytes). When drawing to > the xwin device (or when reading a pdf created using the pdf device), I > find that the image is rendered very slowly. It takes about a minute > to draw the entire image. Using the PDL bindings (I've also tried this > in C, with no substantial difference), I have (for example), the > following: > > $fits = rfits("foo.fits"); > $shades = min($fits) + sequence(50)/50 * (max($fits) - min($fits)); > plinit(); > plenv(0, $fits->getdim(0), 0, $fits->getdim(1), 0, 0); > plshades($fits, 0, $fits->getdim(0), 0, $fits->getdim(1), $shades, 1, > 1, 0, 0, 0, \&pltr0, 0); > > It seems very straightforward, but the result is drawn very slowly. > It draws several layers from left to right (presumably corresponding > to the shades), and each successive later draws faster and faster > (presumably as fewer elements correspond to higher color levels). Am I > doing something wrong? Is there any way to speed up the rendering? > > Regards, > Paul Boley > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Plplot-general mailing list > Plplot-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/plplot-general > ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Plplot-general mailing list Plplot-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-general