Point limitation for PDL Gnuplot and QT terminal using replot
Asked Answered
E

1

9

While using PDL::Graphics::Gnuplot to plot data, I came across a strange effect. It seems, only a limited number of points is plotted at a time using replot.

Consider the following example (15 lines with 101 points):

use strict;
use warnings;

use PDL;
use PDL::Graphics::Gnuplot qw/gpwin/;

my $win = gpwin('qt', persist => 1);

foreach my $a (1..15) {
    my $x = sequence(101)/100;

    my $y = $a*$x;

    if ($a == 1) {
        $win->plot({ linecolor => 'black' }, $x, $y);
    }
    else {
        $win->replot({ linecolor => 'black' }, $x, $y);
    }
}

Using this example, only 11 lines are plotted instead of 15.using 101 points

Reducing the number of points (from 101 to 51), 14 lines are plotted. using 51 points

And finally using only 21 points, all 15 lines are displayed.

using 21 points

First, I thought only a limited number of lines is plotted, but this is not true since the number of plotted lines depend on the size of the piddles.

Is this a limit of the perl module or of Gnuplot? Is there a way to increase the number of maximum points? It seems to be a problem of Gnuplots qt version. Using 'x11' as terminal does not show this limitation (I tested 100 lines with 101 points without any problems).

Further, I test the same example without using replot but in a single plot.

use strict;
use warnings;

use PDL;
use PDL::Graphics::Gnuplot qw/gpwin/;

my $win = gpwin('qt', persist => 1);

my $x = sequence(101)/100;
my $a = sequence(1,15)+1;
my $y = $x*$a;

$win->plot({ linecolor => 'black' }, $x, $y);

Using this code, everything works fine (even when increasing the number of lines to significantly larger values).

101 points in a single plot

So finally, it seems to be an issue of the replot functionality of the 'qt' terminal.

(G N U P L O T Version 4.6 patchlevel 6)

Estivate answered 3/3, 2016 at 20:24 Comment(1)
This sounds like a bug. You should report it to the PDL::Graphics::Gnuplot maintainers here.Irvin
L
2

I've opened an issue on PDL::Graphics::Gnuplot - hopefully given Gnuplot is now on 5.4 this will not be a problem!

EDIT a couple of years later: With Gnuplot 5.4.2 here and qt, it showed 15 lines. It looks like this is solved, and it looks like it was indeed a Gnuplot problem.

Lewallen answered 10/3, 2022 at 21:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.