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

raeburn raeburn at source.lon-capa.org
Thu Jan 30 10:59:16 EST 2020


raeburn		Thu Jan 30 15:59:16 2020 EDT

  Modified files:              
    /loncom/xml	lonplot.pm 
  Log:
  - Modification to changes in 1.179 and 1.180 to support display of pi symbol
    to right of number in a gnuplot tic label with format: nP (n=integer) for
    both web and tex targets.  
  
  
Index: loncom/xml/lonplot.pm
diff -u loncom/xml/lonplot.pm:1.182 loncom/xml/lonplot.pm:1.183
--- loncom/xml/lonplot.pm:1.182	Wed May  8 12:24:27 2019
+++ loncom/xml/lonplot.pm	Thu Jan 30 15:59:15 2020
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Dynamic plot
 #
-# $Id: lonplot.pm,v 1.182 2019/05/08 12:24:27 raeburn Exp $
+# $Id: lonplot.pm,v 1.183 2020/01/30 15:59:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -529,14 +529,14 @@
         },
      xformat      => {
          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',
          edit_type   => 'choice',
          choices     => ['on', 'off', '2e', '2f'],
          },
      yformat      => {
          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',
          edit_type   => 'choice',
          choices     => ['on', 'off', '2e', '2f'],
@@ -1956,6 +1956,14 @@
             if ($axis{'xformat'} eq 'off') {
                 $gnuplot_input .= "\"\"\n";
             } 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";
             }
         }
@@ -1964,6 +1972,14 @@
             if ($axis{'yformat'} eq 'off') {
                 $gnuplot_input .= "\"\"\n";
             } 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";
             }
         }




More information about the LON-CAPA-cvs mailing list