version 1.181, 2018/10/24 13:37:43
|
version 1.183, 2020/01/30 15:59:15
|
Line 529 my %axis_defaults =
|
Line 529 my %axis_defaults =
|
}, |
}, |
xformat => { |
xformat => { |
default => 'on', |
default => 'on', |
test => sub {$_[0]=~/^(on|off|\d+(f|F|e|E|P(|\s*\Q\0317\0200\E)))$/}, |
test => sub {$_[0]=~/^(on|off|\d+(f|F|e|E|P(|\s*[Pp][Ii])))$/}, |
description => 'X-axis number formatting', |
description => 'X-axis number formatting', |
edit_type => 'choice', |
edit_type => 'choice', |
choices => ['on', 'off', '2e', '2f'], |
choices => ['on', 'off', '2e', '2f'], |
}, |
}, |
yformat => { |
yformat => { |
default => 'on', |
default => 'on', |
test => sub {$_[0]=~/^(on|off|\d+(f|F|e|E|P(|\s*\Q\0317\0200\E)))$/}, |
test => sub {$_[0]=~/^(on|off|\d+(f|F|e|E|P(|\s*[Pp][Ii])))$/}, |
description => 'Y-axis number formatting', |
description => 'Y-axis number formatting', |
edit_type => 'choice', |
edit_type => 'choice', |
choices => ['on', 'off', '2e', '2f'], |
choices => ['on', 'off', '2e', '2f'], |
Line 1827 sub write_gnuplot_file {
|
Line 1827 sub write_gnuplot_file {
|
'/'.$font_properties->{'file'}.'.ttf" '; |
'/'.$font_properties->{'file'}.'.ttf" '; |
$gnuplot_input .= $fontsize; |
$gnuplot_input .= $fontsize; |
$gnuplot_input .= ' size '.$Apache::lonplot::plot{'width'}.','.$Apache::lonplot::plot{'height'}.' '; |
$gnuplot_input .= ' size '.$Apache::lonplot::plot{'width'}.','.$Apache::lonplot::plot{'height'}.' '; |
$gnuplot_input .= "@Colors\n"; |
if ($version > 4.6) { |
|
if ($Apache::lonplot::plot{'bgcolor'}) { |
|
$gnuplot_input .= "background '$Apache::lonplot::plot{'bgcolor'}'\n"; |
|
} |
|
} else { |
|
$gnuplot_input .= "@Colors\n"; |
|
} |
# set output |
# set output |
$gnuplot_input .= "set output\n"; |
$gnuplot_input .= "set output\n"; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
Line 1903 sub write_gnuplot_file {
|
Line 1909 sub write_gnuplot_file {
|
if ($Apache::lonplot::plot{'gridlayer'} eq 'on'); |
if ($Apache::lonplot::plot{'gridlayer'} eq 'on'); |
|
|
# grid |
# grid |
$gnuplot_input .= 'set grid'.$/ if ($Apache::lonplot::plot{'grid'} eq 'on'); |
if (($version > 4.6) && ($Apache::lonplot::plot{'fgcolor'} ne '')) { |
|
$gnuplot_input .= 'set grid linecolor "'.$Apache::lonplot::plot{'fgcolor'}.'"'.$/ |
|
if ($Apache::lonplot::plot{'grid'} eq 'on'); |
|
} else { |
|
$gnuplot_input .= 'set grid'.$/ if ($Apache::lonplot::plot{'grid'} eq 'on'); |
|
} |
# border |
# border |
$gnuplot_input .= ($Apache::lonplot::plot{'border'} eq 'on'? |
if ($Apache::lonplot::plot{'border'} eq 'on') { |
'set border'.$/ : |
if (($version > 4.6) && (($axis{'color'} ne '') || ($Apache::lonplot::plot{'fgcolor'} ne ''))) { |
'set noborder'.$/ ); |
$gnuplot_input .= 'set border linecolor "'. |
|
(($axis{'color'} ne '')?$axis{'color'}: |
|
$Apache::lonplot::plot{'fgcolor'}). |
|
'" '.$/; |
|
} else { |
|
$gnuplot_input .= 'set border '.$/; |
|
} |
|
} else { |
|
$gnuplot_input .= 'set noborder '.$/; |
|
} |
# sampling rate for non-data curves |
# sampling rate for non-data curves |
$gnuplot_input .= "set samples $Apache::lonplot::plot{'samples'}\n"; |
$gnuplot_input .= "set samples $Apache::lonplot::plot{'samples'}\n"; |
# title, xlabel, ylabel |
# title, xlabel, ylabel |
Line 1936 sub write_gnuplot_file {
|
Line 1956 sub write_gnuplot_file {
|
if ($axis{'xformat'} eq 'off') { |
if ($axis{'xformat'} eq 'off') { |
$gnuplot_input .= "\"\"\n"; |
$gnuplot_input .= "\"\"\n"; |
} else { |
} else { |
|
if ($axis{'xformat'} =~ /^(\d+P\s*)[Pp][Ii]/) { |
|
my $xprefix = $1; |
|
if (($target eq 'web') || ($target eq 'tex')) { |
|
$axis{'xformat'} = $xprefix.$lookup{'(pi|#960)'}{$target}; |
|
} else { |
|
$axis{'xformat'} = $xprefix; |
|
} |
|
} |
$gnuplot_input .= "\"\%.".$axis{'xformat'}."\"\n"; |
$gnuplot_input .= "\"\%.".$axis{'xformat'}."\"\n"; |
} |
} |
} |
} |
Line 1944 sub write_gnuplot_file {
|
Line 1972 sub write_gnuplot_file {
|
if ($axis{'yformat'} eq 'off') { |
if ($axis{'yformat'} eq 'off') { |
$gnuplot_input .= "\"\"\n"; |
$gnuplot_input .= "\"\"\n"; |
} else { |
} else { |
|
if ($axis{'yformat'} =~ /^(\d+P\s*)[Pp][Ii]/) { |
|
my $yprefix = $1; |
|
if (($target eq 'web') || ($target eq 'tex')) { |
|
$axis{'yformat'} = $yprefix.$lookup{'(pi|#960)'}{$target}; |
|
} else { |
|
$axis{'yformat'} = $yprefix; |
|
} |
|
} |
$gnuplot_input .= "\"\%.".$axis{'yformat'}."\"\n"; |
$gnuplot_input .= "\"\%.".$axis{'yformat'}."\"\n"; |
} |
} |
} |
} |