How to plot graphs with two different pairs of axis on the same plot - PDLPorters/pdl GitHub Wiki
You want to make a plot superposing two graphs, but each graph has a different set of axes. You want to use PGPLOT.
You would need to run a program like this
#!/usr/bin/env perl
use PDL;
use PDL::Graphics::PGPLOT::Window;
use PGPLOT;
# Generate dataset
$x=zeroes(100)->xlinvals(-10,10);
$y=$x**2;
$z=100*cos($x);
# Open device
$w=PDL::Graphics::PGPLOT::Window->new(Device=>'twoaxis.ps/cps');
# Plot first graph with axis
$w->env(min($x),max($x),min($y),max($y),{PlotPosition=>[0.15,0.85,0.15,0.85], Axis=>['BNST','BNST'], XTitle=>'x', YTitle=>'y', Color=>'blue'});
$w->line($x,$y,{Color=>'blue'});
#Plot second graph with axis
$w->env(min($x),max($x),min($z),max($z),{PlotPosition=>[0.15,0.85,0.15,0.85], Axis=>['CMST','CMST'], Color=>'red'});
pgsci(2);
pgmtext('T',2.5,0.5,0.5,'x');
pgmtext('R',2.5,0.5,0.5,'z');
$w->line($x,$z,{Color=>'red'});
To get a figure like this