[LON-CAPA-cvs] cvs: loncom /xml lonplot.pm

raeburn raeburn at source.lon-capa.org
Wed May 8 08:24:28 EDT 2019


raeburn		Wed May  8 12:24:28 2019 EDT

  Modified files:              
    /loncom/xml	lonplot.pm 
  Log:
  - Bug 6855
    Support background color, foreground color, and axis color with 
    png terminal in gnuplot 5.0.
  
  
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.181 loncom/xml/lonplot.pm:1.182
--- loncom/xml/lonplot.pm:1.181	Wed Oct 24 13:37:43 2018
+++ loncom/xml/lonplot.pm	Wed May  8 12:24:27 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Dynamic plot
 #
-# $Id: lonplot.pm,v 1.181 2018/10/24 13:37:43 raeburn Exp $
+# $Id: lonplot.pm,v 1.182 2019/05/08 12:24:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1827,7 +1827,13 @@
 	    '/'.$font_properties->{'file'}.'.ttf" ';
 	$gnuplot_input .= $fontsize;
 	$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
 	$gnuplot_input .= "set output\n";
     } elsif ($target eq 'tex') {
@@ -1903,11 +1909,25 @@
 	if ($Apache::lonplot::plot{'gridlayer'} eq 'on');
 
     # 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
-    $gnuplot_input .= ($Apache::lonplot::plot{'border'} eq 'on'?
-		       'set border'.$/           :
-		       'set noborder'.$/         );
+    if ($Apache::lonplot::plot{'border'} eq 'on') {
+        if (($version > 4.6) && (($axis{'color'} ne '') || ($Apache::lonplot::plot{'fgcolor'} ne ''))) {
+            $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
     $gnuplot_input .= "set samples $Apache::lonplot::plot{'samples'}\n";
     # title, xlabel, ylabel




More information about the LON-CAPA-cvs mailing list