Skip to content

Commit

Permalink
fix typo, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed May 6, 2024
1 parent 713198c commit 3c4fe06
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
67 changes: 66 additions & 1 deletion README.pod
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,31 @@ Backslash escapes control characters to render them as themselves.

=back

=head2 Unicode text

Separately to "enhanced" text above, if you wish to include text that
is not ASCII, then you will need to pass data that has been UTF-8
encoded. Sample code to achieve this:

use utf8;
use Encode;
use PDL;
use PDL::Graphics::Gnuplot;
use PDL::Constants qw(PI);

sub plot_sin {
my ($w, $coeff) = @_;
my $xrange = [ -2*PI, 2*PI ];
my $x = zeroes(1e3)->xlinvals(@$xrange); my $y = sin($coeff * 2 * PI * $x);
my $title = "y = sin( $coeff * 2π * x )";
# to get around sending text through syswrite()
my $title_octets = encode('UTF-8', $title);
$w->plot(with=>'lines', $x, $y, {
xrange => $xrange,
title => $title_octets, # can not pass $title as-is
});
}

=head2 Color specification

There are several contexts where you can specify color of plot elements. In those
Expand Down Expand Up @@ -1455,7 +1480,7 @@ B<C<pointsize>> accepts a single number and scales the size of points used in pl

B<C<style>> provides a great deal of customization for individual plot styles.
It is not (yet) fully parsed by PDL::Graphics::Gnuplot; please refer to the Gnuplot
manual for details (it is pp. 145ff in the Gnuplot 4.6.1 maual). C<style> accepts
manual for details (it is pp. 145ff in the Gnuplot 4.6.1 manual). C<style> accepts
a hash ref whose keys are plot styles (such as you would feed to the C<with> curve option),
and whose values are array refs containing keywords and other parameters to modify how each
plot style should be displayed.
Expand Down Expand Up @@ -2179,6 +2204,15 @@ global gnuplot object.
=cut
=pod

=head2 plot_generate

=for ref

Called with the same arguments as L</plot>, it returns the text that
would be sent to Gnuplot. Exportable.
Added in 2.025.

=cut
=head2 gplot

=for ref
Expand Down Expand Up @@ -2328,6 +2362,14 @@ Displays a FITS image. Synonym for C<plot(globalwith =E<gt> 'fits', ...)>.
=cut
=pod

=head2 multiplot_generate

=for ref

Called with the same arguments as L</multiplot>, it returns the text that
would be sent to Gnuplot.
Added in 2.025.

=head2 multiplot

=for example
Expand All @@ -2338,6 +2380,7 @@ Displays a FITS image. Synonym for C<plot(globalwith =E<gt> 'fits', ...)>.
$w->multiplot(layout=>[2,2,"columnsfirst"]);
$w->plot({title=>"points"},with=>"points",$a,$b);
$w->plot({title=>"lines"}, with=>"lines", $a,$b);
$w->multiplot_next; # with Gnuplot 4.7+
$w->plot({title=>"image"}, with=>"image", $a->(*1) * $b );
$w->end_multi();

Expand Down Expand Up @@ -2386,6 +2429,28 @@ of each plot within the grid.

=back

=head2 multiplot_next_generate

=for ref

Called with the same arguments as L</multiplot_next>, it returns the text that
would be sent to Gnuplot. Exportable.
Added in 2.025.

=head2 multiplot_next

=for ref

Skip one plot. Added in 2.025. Requires Gnuplot 4.7+.

=head2 end_multi_generate

=for ref

Called with the same arguments as L</end_multi>, it returns the text that
would be sent to Gnuplot. Exportable.
Added in 2.025.

=head2 end_multi

=for usage
Expand Down
2 changes: 1 addition & 1 deletion lib/PDL/Graphics/Gnuplot.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ B<C<pointsize>> accepts a single number and scales the size of points used in pl
B<C<style>> provides a great deal of customization for individual plot styles.
It is not (yet) fully parsed by PDL::Graphics::Gnuplot; please refer to the Gnuplot
manual for details (it is pp. 145ff in the Gnuplot 4.6.1 maual). C<style> accepts
manual for details (it is pp. 145ff in the Gnuplot 4.6.1 manual). C<style> accepts
a hash ref whose keys are plot styles (such as you would feed to the C<with> curve option),
and whose values are array refs containing keywords and other parameters to modify how each
plot style should be displayed.
Expand Down

0 comments on commit 3c4fe06

Please sign in to comment.