Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I've found the Chart::GGPlot library that looks great, but unfortunatey I cannot manage to use it because I get an error.

This is the sample code and the error.

Thank you if you can provide me with some indication.

Roberto

use Chart::GGPlot qw(:all); use PDL; my $df = Data::Frame->new( columns => [ x => pdl(1,2,3,8,7), y => pdl(260,34,64,23,6) ] ); my $p = ggplot( data => $df, mapping => aes(x => 'ws', y => 'wd') )->geom_point( alpha => 0.05 ); $p->show()

This is giving me the error:

Error in eval_tidy('ws', ...) : Bareword "ws" not allowed while "stric +t subs" in use at make_plot_test.pl line 10. at /usr/local/share/perl/5.26.1/Eval/Quosure.pm line 76. at /usr/local/share/perl/5.26.1/Data/Frame/Partial/Eval.pm line 41.

Replies are listed 'Best First'.
Re: Error with Chart::GGPlot
by soonix (Chancellor) on Oct 01, 2020 at 08:17 UTC
    I don't have experience with Chart::GGPlot, but like perlfan, I looked into Metacpan. One possibly relevant difference I see in the "mapping" line between your code and the Synopsis, is: you have ws where the Synopsis has wt.
Re: Error with Chart::GGPlot
by perlfan (Parson) on Sep 30, 2020 at 18:39 UTC
    In the Chart::GGPlot SYNOPSIS, the 'wt' and 'mpg' values are characteristics of the mtcars data set. See Data::Frame::Example for what I mean. I don't know how to designate them via data, but seems subs are autogenerated from that. HTH.
Re: Error with Chart::GGPlot
by Anonymous Monk on Oct 01, 2020 at 16:17 UTC
    Thanks, but as far as I understand, x and y are the keys to be used to define the data columns and then with the aes() method you assign them a title.