Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arrows are not drawn #106

Open
jjatria opened this issue Dec 2, 2024 · 2 comments
Open

Arrows are not drawn #106

jjatria opened this issue Dec 2, 2024 · 2 comments

Comments

@jjatria
Copy link

jjatria commented Dec 2, 2024

This might be a problem between the keyboard and chair, but if so, I'd say it suggests an issue with the documentation.

After reading https://metacpan.org/pod/PDL::Graphics::Gnuplot#arrow-place-an-arrow-or-callout-line-on-the-plot I attempted to draw an arrow on a plot, but nothing was drawn. I can get the similar label to work as expected, but not arrow. See below for an illustration:

use PDL;
use PDL::Graphics::Gnuplot;

my $win = gpwin;
$win->plot(
    {
        # This works
        label => [
            [
                'start',
                at => [ 25, 'graph(0.5)' ],
                'center',
            ],
            [
                'end',
                at => [ 75, 'graph(0.5)' ],
                'center',
            ],
        ],

        # This doesn't
        arrow => [
            [
                from => [ 25, 'graph(0.5)' ],
                to   => [ 75, 'graph(0.5)' ],
            ],
        ],
    },
    sequence(100) ** 2,
);

$win->pause_until_close;

This is the resulting plot, with the labels but no arrows:

gnuplot

Is this a bug in PDL::Graphics::Gnuplot? Or am I missing something?

@zmughal
Copy link
Member

zmughal commented Dec 20, 2024

The positions there are given as strings. Here are multiple arrows.

$win->plot(
    {
        label => [
            [
                'start',
                at => [ 25, 'graph(0.5)' ],
                'center',
            ],
            [
                'end',
                at => [ 75, 'graph(0.5)' ],
                'center',
            ],
        ],

        arrow1 => [
                 from =>  '25,graph(0.5)',
                 to   =>  '75,graph(0.5)',
        ],

        arrow2 => [
                 from =>  'graph(0),graph(0)',
                 rto   =>  'graph(1),graph(1)',
        ],
    },
    sequence(100) ** 2,
);

image

@mohawk2
Copy link
Member

mohawk2 commented Dec 20, 2024

Does that mean this is just a documentation issue? Does someone feel like PR-ing a doc update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants