File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 6
6
- fix plot3d array-ref handling (#87) - thanks @djerius for report
7
7
- fix gplot array-ref handling (#86) - thanks @djerius for report
8
8
- add multiplot_next to skip one plot (#85)
9
+ - add documentation to UTF-8 encode text labels etc (#74) - thanks @zmughal for report
9
10
10
11
2.024 2023-03-30
11
12
- Add Alien::Gnuplot as a configure-time dependency. Fixes #92 - thanks @zmughal
Original file line number Diff line number Diff line change @@ -288,6 +288,31 @@ Backslash escapes control characters to render them as themselves.
288
288
289
289
=back
290
290
291
+ =head2 Unicode text
292
+
293
+ Separately to "enhanced" text above, if you wish to include text that
294
+ is not ASCII, then you will need to pass data that has been UTF-8
295
+ encoded. Sample code to achieve this:
296
+
297
+ use utf8;
298
+ use Encode;
299
+ use PDL;
300
+ use PDL::Graphics::Gnuplot;
301
+ use PDL::Constants qw(PI);
302
+
303
+ sub plot_sin {
304
+ my ($w, $coeff) = @_;
305
+ my $xrange = [ -2*PI, 2*PI ];
306
+ my $x = zeroes(1e3)->xlinvals(@$xrange); my $y = sin($coeff * 2 * PI * $x);
307
+ my $title = "y = sin( $coeff * 2π * x )";
308
+ # to get around sending text through syswrite()
309
+ my $title_octets = encode('UTF-8', $title);
310
+ $w->plot(with=>'lines', $x, $y, {
311
+ xrange => $xrange,
312
+ title => $title_octets, # can not pass $title as-is
313
+ });
314
+ }
315
+
291
316
=head2 Color specification
292
317
293
318
There are several contexts where you can specify color of plot elements. In those
You can’t perform that action at this time.
0 commit comments