--- loncom/xml/lonplot.pm 2003/09/27 04:08:56 1.91 +++ loncom/xml/lonplot.pm 2003/10/24 17:35:32 1.92 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Dynamic plot # -# $Id: lonplot.pm,v 1.91 2003/09/27 04:08:56 albertel Exp $ +# $Id: lonplot.pm,v 1.92 2003/10/24 17:35:32 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -115,7 +115,7 @@ my $words_test = sub {$_[0]=~s/\s+/ ################################################################### my @gnuplot_edit_order = qw/alttag bgcolor fgcolor height width font transparent grid samples - border align texwidth plottype/; + border align texwidth texfont plottype/; my $gnuplot_help_text = <<"ENDPLOTHELP";

@@ -232,6 +232,13 @@ my %gnuplot_defaults = edit_type => 'entry', size => '5' }, + texfont => { + default => '22', + test => $int_test, + description => 'Font size to use in TeX output (pts):', + edit_type => 'choice', + choices => [qw/10 12 14 16 18 20 22 24 26 28 30 32 34 36/], + }, plottype => { default => 'Cartesian', test => sub {$_[0]=~/^(Polar|Cartesian)$/}, @@ -987,7 +994,7 @@ sub set_defaults { sub get_attributes{ my ($values,$defaults,$parstack,$safeeval,$tag) = @_; foreach my $attr (keys(%{$defaults})) { - if ($attr eq 'texwidth') { + if ($attr eq 'texwidth' || $attr eq 'texfont') { $values->{$attr} = &Apache::lonxml::get_param($attr,$parstack,$safeeval,undef,1); } else { @@ -1014,6 +1021,7 @@ sub write_gnuplot_file { my ($tmpdir,$filename,$target)= @_; my $gnuplot_input = ''; my $curve; + my $pt = $plot{'texfont'}; # Collect all the colors my @Colors; push @Colors, $plot{'bgcolor'}; @@ -1034,7 +1042,7 @@ sub write_gnuplot_file { # set output $gnuplot_input .= "set output\n"; } elsif ($target eq 'tex') { - $gnuplot_input .= "set term postscript eps monochrome solid \"Helvetica\" 25 \n"; + $gnuplot_input .= "set term postscript eps monochrome solid \"Helvetica\" $pt \n"; $gnuplot_input .= "set output \"/home/httpd/perl/tmp/". &Apache::lonnet::unescape($filename).".eps\"\n"; } @@ -1055,9 +1063,9 @@ sub write_gnuplot_file { # title, xlabel, ylabel # titles if ($target eq 'tex') { - $gnuplot_input .= "set title \"$title\" font \"Helvetica,25pt\"\n" if (defined($title)) ; - $gnuplot_input .= "set xlabel \"$xlabel\" font \"Helvetica,25pt\" \n" if (defined($xlabel)); - $gnuplot_input .= "set ylabel \"$ylabel\" font \"Helvetica,25pt\"\n" if (defined($ylabel)); + $gnuplot_input .= "set title \"$title\" font \"Helvetica,".$pt."pt\"\n" if (defined($title)) ; + $gnuplot_input .= "set xlabel \"$xlabel\" font \"Helvetica,".$pt."pt\" \n" if (defined($xlabel)); + $gnuplot_input .= "set ylabel \"$ylabel\" font \"Helvetica,".$pt."pt\"\n" if (defined($ylabel)); } else { $gnuplot_input .= "set title \"$title\" \n" if (defined($title)) ; $gnuplot_input .= "set xlabel \"$xlabel\" \n" if (defined($xlabel)); @@ -1103,7 +1111,7 @@ sub write_gnuplot_file { my $label; foreach $label (@labels) { $gnuplot_input .= 'set label "'.$label->{'text'}.'" at '. - $label->{'xpos'}.','.$label->{'ypos'}.' '.$label->{'justify'}.' font "Helvetica,25pt"'.$/ ; + $label->{'xpos'}.','.$label->{'ypos'}.' '.$label->{'justify'}.' font "Helvetica,'.$pt.'pt"'.$/ ; } if ($target eq 'tex') { $gnuplot_input .="set size 1,".$plot{'height'}/$plot{'width'}*1.38;