version 1.85.2.1, 2003/09/27 04:15:26
|
version 1.88, 2003/09/10 13:50:29
|
Line 113 my $words_test = sub {$_[0]=~s/\s+/
|
Line 113 my $words_test = sub {$_[0]=~s/\s+/
|
################################################################### |
################################################################### |
my @gnuplot_edit_order = |
my @gnuplot_edit_order = |
qw/alttag bgcolor fgcolor height width font transparent grid samples |
qw/alttag bgcolor fgcolor height width font transparent grid samples |
border align texwidth/; |
border align texwidth plottype/; |
|
|
my $gnuplot_help_text = <<"ENDPLOTHELP"; |
my $gnuplot_help_text = <<"ENDPLOTHELP"; |
<p> |
<p> |
Line 230 my %gnuplot_defaults =
|
Line 230 my %gnuplot_defaults =
|
edit_type => 'entry', |
edit_type => 'entry', |
size => '5' |
size => '5' |
}, |
}, |
|
plottype => { |
|
default => 'Cartesian', |
|
test => sub {$_[0]=~/^(Polar|Cartesian)$/}, |
|
description => 'Plot type:', |
|
edit_type => 'choice', |
|
choices => ['Polar','Cartesian'] |
|
}, |
); |
); |
|
|
my %key_defaults = |
my %key_defaults = |
Line 513 sub end_gnuplot {
|
Line 520 sub end_gnuplot {
|
alt = "$plot{'alttag'}" /> |
alt = "$plot{'alttag'}" /> |
ENDIMAGE |
ENDIMAGE |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
#might be inside the safe space, register the URL for later |
&Apache::lonnet::ssi("/cgi-bin/plot.gif?file=$filename.data&output=eps"); |
&Apache::lonxml::register_ssi("/cgi-bin/plot.gif?file=$filename.data&output=eps"); |
|
$result = '\graphicspath{{/home/httpd/perl/tmp/}}\includegraphics[width='.$plot{'texwidth'}.' mm]{'.&Apache::lonnet::unescape($filename).'.eps}'; |
$result = '\graphicspath{{/home/httpd/perl/tmp/}}\includegraphics[width='.$plot{'texwidth'}.' mm]{'.&Apache::lonnet::unescape($filename).'.eps}'; |
} |
} |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
Line 970 sub set_defaults {
|
Line 977 sub set_defaults {
|
sub get_attributes{ |
sub get_attributes{ |
my ($values,$defaults,$parstack,$safeeval,$tag) = @_; |
my ($values,$defaults,$parstack,$safeeval,$tag) = @_; |
foreach my $attr (keys(%{$defaults})) { |
foreach my $attr (keys(%{$defaults})) { |
$values->{$attr} = |
if ($attr eq 'texwidth') { |
&Apache::lonxml::get_param($attr,$parstack,$safeeval); |
$values->{$attr} = |
|
&Apache::lonxml::get_param($attr,$parstack,$safeeval,undef,1); |
|
} else { |
|
$values->{$attr} = |
|
&Apache::lonxml::get_param($attr,$parstack,$safeeval); |
|
} |
if ($values->{$attr} eq '' | !defined($values->{$attr})) { |
if ($values->{$attr} eq '' | !defined($values->{$attr})) { |
$values->{$attr} = $defaults->{$attr}->{'default'}; |
$values->{$attr} = $defaults->{$attr}->{'default'}; |
next; |
next; |
Line 1012 sub write_gnuplot_file {
|
Line 1024 sub write_gnuplot_file {
|
# set output |
# set output |
$gnuplot_input .= "set output\n"; |
$gnuplot_input .= "set output\n"; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
$gnuplot_input .= "set term postscript eps monochrome solid\n"; |
$gnuplot_input .= "set term postscript eps monochrome solid \"Helvetica\" 25 \n"; |
$gnuplot_input .= "set output \"/home/httpd/perl/tmp/". |
$gnuplot_input .= "set output \"/home/httpd/perl/tmp/". |
&Apache::lonnet::unescape($filename).".eps\"\n"; |
&Apache::lonnet::unescape($filename).".eps\"\n"; |
} |
} |
|
# cartesian or polar? |
|
if (lc($plot{'plottype'}) eq 'polar') { |
|
$gnuplot_input .= 'set polar'.$/; |
|
} else { |
|
# Assume Cartesian |
|
} |
# grid |
# grid |
$gnuplot_input .= 'set grid'.$/ if ($plot{'grid'} eq 'on'); |
$gnuplot_input .= 'set grid'.$/ if ($plot{'grid'} eq 'on'); |
# border |
# border |
Line 1026 sub write_gnuplot_file {
|
Line 1044 sub write_gnuplot_file {
|
$gnuplot_input .= "set samples $plot{'samples'}\n"; |
$gnuplot_input .= "set samples $plot{'samples'}\n"; |
# title, xlabel, ylabel |
# title, xlabel, ylabel |
# titles |
# titles |
$gnuplot_input .= "set title \"$title\"\n" if (defined($title)) ; |
$gnuplot_input .= "set title \"$title\" font \"Helvetica,25pt\"\n" if (defined($title)) ; |
$gnuplot_input .= "set xlabel \"$xlabel\"\n" if (defined($xlabel)); |
$gnuplot_input .= "set xlabel \"$xlabel\" font \"Helvetica,25pt\" \n" if (defined($xlabel)); |
$gnuplot_input .= "set ylabel \"$ylabel\"\n" if (defined($ylabel)); |
$gnuplot_input .= "set ylabel \"$ylabel\" font \"Helvetica,25pt\"\n" if (defined($ylabel)); |
# tics |
# tics |
if (%xtics) { |
if (%xtics) { |
$gnuplot_input .= "set xtics $xtics{'location'} "; |
$gnuplot_input .= "set xtics $xtics{'location'} "; |
Line 1063 sub write_gnuplot_file {
|
Line 1081 sub write_gnuplot_file {
|
my $label; |
my $label; |
foreach $label (@labels) { |
foreach $label (@labels) { |
$gnuplot_input .= 'set label "'.$label->{'text'}.'" at '. |
$gnuplot_input .= 'set label "'.$label->{'text'}.'" at '. |
$label->{'xpos'}.','.$label->{'ypos'}.' '.$label->{'justify'}.$/ ; |
$label->{'xpos'}.','.$label->{'ypos'}.' '.$label->{'justify'}.' font "Helvetica,25pt"'.$/ ; |
} |
} |
if ($target eq 'tex') { |
if ($target eq 'tex') { |
$gnuplot_input .="set size 1,".$plot{'height'}/$plot{'width'}*1.38; |
$gnuplot_input .="set size 1,".$plot{'height'}/$plot{'width'}*1.38; |