Hi,

On Mon, Aug 22, 2022 at 01:33:45PM +0000, Ed . wrote:
> Hi Luis,
>
> Glad to hear it! Could you share the code you’ve used? It might make a great 
> demo to add to P:G:Gnuplot.

The following code plots two opaque vertical bars, a black one on the
left and a red one on the right. On top of that it plots two
semitransparent horizontal bars, a black one at the bottom and a green
one on top. I enclose the result: As expected, I get black on
the bottom left corner, red on the bottom right, and green on the top
left. I get some kind of yellow on the top right corresponding to the
red bar seen trough the semitransparent green bar.

    use PDL;
    use PDL::Graphics::Gnuplot;
    my $a=zeroes(2,2);
    gplot({terminal=>"pngcairo", output=>"rem.png"},
            with=>"rgbalpha",$a->xvals, $a->yvals,
                255*$a->xvals, $a->zeroes, $a->zeroes, 255*$a->ones,
            with=>"rgbalpha",$a->xvals, $a->yvals,
                $a->zeroes, 255*$a->yvals, $a->zeroes, 127*$a->ones);


I tried the "png" terminal, instead of "pngcairo" but it failed.
The interactive terminal 'qt' does work and it exports correctly to
png.

I guess I don't fully understand gnuplot. I tried the plot above but
directly from gnuplot,

    gnuplot> plot 'rem.txt' u 1:2:3:5:5:7 w rgbalpha
    gnuplot> replot 'rem.txt' u 1:2:5:4:5:6 w rgbalpha

where rem.txt contains the data
    0 0 0    0   0 127 255
    0 1 0    255 0 127 255

    1 0 255  0   0 127 255
    1 1 255  255 0 127 255

and the code worked with the interactive 'qt' terminal, yielding the
same image as the one enclosed, but

    gnuplot> set term 'pngcairo'
    gnuplot> set out 'rem1.png
    gnuplot> plot 'rem.txt' u 1:2:3:5:5:7 w rgbalpha
    gnuplot> replot 'rem.txt' u 1:2:5:4:5:6 w rgbalpha
    gnuplot> set out

failed! (only the red image was plotted).

Regards,
Luis

--

                                                                  o
W. Luis Mochán,                      | tel:(52)(777)329-1734     /<(*)
Instituto de Ciencias Físicas, UNAM  | fax:(52)(777)317-5388     `>/   /\
Av. Universidad s/n CP 62210         |                           (*)/\/  \
Cuernavaca, Morelos, México          | moc...@fis.unam.mx   /\_/\__/
GPG: 791EB9EB, C949 3F81 6D9B 1191 9A16  C2DF 5F0A C52B 791E B9EB
_______________________________________________
pdl-general mailing list
pdl-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to