Square aspect ratio now works in 3d plots. 3D plots also have --square_xy option to square the

aspect ratio ONLY for the xy axes, allowing z to scale as needed
This commit is contained in:
Dima Kogan 2011-04-03 17:16:00 -07:00
parent ba4267c667
commit 009d4bea5f

View File

@ -155,7 +155,10 @@ As an example, if line 3 of the input is "0 9 1 20"
--size xxx Gnuplot size option
--square Plot data with aspect ratio 1
--square Plot data with aspect ratio 1. For 3D plots, this controls the
aspect ratio for all 3 axes
--square_xy For 3D plots, set square aspect ratio for ONLY the x,y axes
--hardcopy xxx If not streaming, output to a file specified here. Format
inferred from filename
@ -206,7 +209,7 @@ OEF
'circles', 'legend=s@', 'autolegend!', 'xlabel=s', 'ylabel=s', 'y2label=s', 'zlabel=s',
'title=s', 'xlen=f', 'ymin=f', 'ymax=f', 'xmin=f', 'xmax=f', 'y2min=f', 'y2max=f',
'zmin=f', 'zmax=f', 'y2=s@', 'curvestyle=s@', 'curvestyleall=s', 'extracmds=s@',
'size=s', 'square!', 'hardcopy=s', 'maxcurves=i', 'monotonic!',
'size=s', 'square!', 'square_xy!', 'hardcopy=s', 'maxcurves=i', 'monotonic!',
'extraValuesPerPoint=i', 'help', 'dump') or die($usage);
# handle various cmdline-option errors
@ -251,7 +254,9 @@ OEF
exit -1;
}
}
elsif (!$options->{colormap})
else
{
if(!$options->{colormap})
{
if ( defined $options->{zmin} || defined $options->{zmax} || defined $options->{zlabel} )
{
@ -260,6 +265,13 @@ OEF
}
}
if ( defined $options->{square_xy} )
{
print STDERR "--square_xy only makes sense with --3d\n";
exit -1;
}
}
if(defined $options{xlen} && !defined $options{stream} )
{
print STDERR "--xlen does not make sense without --stream\n";
@ -386,12 +398,25 @@ sub mainThread
print(PIPE "set title \"" . $options{title } . "\"\n") if defined $options{title};
if($options{square})
{
# set a square aspect ratio. Gnuplot does this differently for 2D and 3D plots
if(! $options{'3d'})
{
$options{size} = '' unless defined $options{size};
$options{size} .= ' ratio -1';
}
else
{
print(PIPE "set view equal xyz\n");
}
}
print(PIPE "set size $options{size}\n") if defined $options{size};
if($options{square_xy})
{
print(PIPE "set view equal xy\n");
}
if($options{colormap})
{
print PIPE "set cbrange [". $options{zmin} . ":" . $options{zmax} ."]\n" if length( $options{zmin} . $options{zmax} );