* Bugs 13603 14191 15965 fixed: plot() fixed. logflag implemented 79/20879/8
Samuel GOUGEON [Fri, 22 Feb 2019 23:00:46 +0000 (00:00 +0100)]
  * http://bugzilla.scilab.org/13603 : x vector, y scalar
  * http://bugzilla.scilab.org/14191 : logflags
  * http://bugzilla.scilab.org/15965 : encoded integers y

  Page updated: http://bugzilla.scilab.org/attachment.cgi?id=4903 (PDF)
  Example "Choosing a normal or logarithmic plotting mode"
   inserted as example #1 and illustrated.

  Requires first merging https://codereview.scilab.org/20878

Change-Id: Ie7f12325c09587573617c3c0a3197db08c593b4a

20 files changed:
scilab/CHANGES.md
scilab/modules/graphics/help/en_US/2d_plot/plot.xml
scilab/modules/graphics/help/ja_JP/2d_plot/plot.xml
scilab/modules/graphics/help/pt_BR/2d_plot/plot.xml
scilab/modules/graphics/macros/checkXYPair.sci
scilab/modules/graphics/macros/plot.sci
scilab/modules/graphics/tests/nonreg_tests/bug_13603.tst [new file with mode: 0644]
scilab/modules/graphics/tests/nonreg_tests/bug_15965.tst [new file with mode: 0644]
scilab/modules/helptools/data/pages/homepage-en_US.html
scilab/modules/helptools/etc/images_md5.txt
scilab/modules/helptools/images/plot_1.png
scilab/modules/helptools/images/plot_10.png [new file with mode: 0644]
scilab/modules/helptools/images/plot_2.png
scilab/modules/helptools/images/plot_3.png
scilab/modules/helptools/images/plot_4.png
scilab/modules/helptools/images/plot_5.png
scilab/modules/helptools/images/plot_6.png
scilab/modules/helptools/images/plot_7.png
scilab/modules/helptools/images/plot_8.png
scilab/modules/helptools/images/plot_9.png

index 044d2d9..b9ff50e 100644 (file)
@@ -157,7 +157,7 @@ Feature changes and additions
 * `setdiff` now supports complex numbers.
 * `twinkle` can now blink together several hierarchically independent objects, like a curve and its labels, etc.
 * `repmat` has been rewritten. It is 7 times faster now.
-
+* `plot` can now work in semi or bi-logarithmic mode with some input logflag.
 
 
 Help pages:
@@ -255,9 +255,11 @@ Bug Fixes
 * [#12520](https://bugzilla.scilab.org/12520): Variable browser did not display the size of the variables.
 * [#12534](https://bugzilla.scilab.org/12534): Variable browser did not display the size of the variables.
 * [#12837](https://bugzilla.scilab.org/12837): `strcmpi` was an obsolete duplicate of `strcmp(,'i')`. It is removed.
+* [#13603](https://bugzilla.scilab.org/13603): `plot(1:3, 10)` failed.
 * [#13683](https://bugzilla.scilab.org/13683): unsetmenu for a dockable="off" figure crashed Scilab.
 * [#13766](https://bugzilla.scilab.org/13766): Minimal values for `.figure_size` were not documented.
 * [#14015](https://bugzilla.scilab.org/14015): Nan terms added to a polynomial were ignored.
+* [#14191](https://bugzilla.scilab.org/14191): Unlike `plot2d()`, `plot()` did not accept logflags among input arguments.
 * [#14422](https://bugzilla.scilab.org/14422): `clc(0)` did nothing, now clears last console entry. Remove leading blank after a `clc()`.
 * [#14498](https://bugzilla.scilab.org/14498): `size([],3)` returned 1 instead of 0.
 * [#14501](https://bugzilla.scilab.org/14501): `strsubst` crashed on consecutive occurrences.
@@ -324,6 +326,7 @@ Bug Fixes
 * [#15934](https://bugzilla.scilab.org/15934): The `^ hat` page wrongly indicated that `^` applied to a rectangular matrix not being a vector is done element-wise.
 * [#15948](https://bugzilla.scilab.org/15948): `xlabel`, `ylabel`, `zlabel` and `title` needed to be upgraded.
 * [#15964](https://bugzilla.scilab.org/15954): A complex empty sparse matrix could be obtained after insertion.
+* [#15965](https://bugzilla.scilab.org/15965): `plot(x,y)` did not accept y as encoded integers.
 * [#15967](https://bugzilla.scilab.org/15967): `setdiff(1,[])` was [] instead of `1`. `setdiff(a,[],..)` was not enough tested.
 * [#15969](https://bugzilla.scilab.org/15969): Fix spelling
 * [#15974](https://bugzilla.scilab.org/15974): `msprintf("%d", %nan)` did not return Nan
index 4391257..e6dfb2d 100644 (file)
@@ -2,9 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA - Fabrice Leray
- * Copyright (C) 2018 - Samuel GOUGEON
- *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2018 - 2019 - Samuel GOUGEON
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -34,6 +33,7 @@
             plot(.., LineSpec, GlobalProperty)
             plot(x1, y1, LineSpec1, x2,y2,LineSpec2,...xN, yN, LineSpecN, GlobalProperty1,.. GlobalPropertyM)
             plot(x1,fun1,LineSpec1, x2,y2,LineSpec2,...xN,funN,LineSpecN, GlobalProperty1, ..GlobalPropertyM)
+            plot(logflag,...)
             plot(axes_handle,...)
         </synopsis>
     </refsynopsisdiv>
             <varlistentry>
                 <term>x</term>
                 <listitem>
-                    <para>vector or matrix of real numbers. If omitted, it is assumed to be the
-                        vector <literal>1:n</literal> where <literal>n</literal> is the number of curve
-                        points given by the <literal>y</literal> parameter.
+                    <para>
+                        vector or matrix of real numbers or integers. If omitted, it is assumed
+                        to be the vector <literal>1:n</literal> where <literal>n</literal> is the
+                        number of curve points given by the <literal>y</literal> parameter.
                     </para>
                 </listitem>
             </varlistentry>
@@ -53,7 +54,7 @@
                 <term>y</term>
                 <listitem>
                     <para>
-                        vector or matrix of real numbers.
+                        vector or matrix of real numbers or of integers.
                     </para>
                 </listitem>
             </varlistentry>
                 </listitem>
             </varlistentry>
             <varlistentry>
+                <term>logflag</term>
+                <listitem>
+                    <para>
+                        "ln" | "nl" | "ll" : 2-character word made of "l" standing for
+                        "<emphasis role="bold">L</emphasis>ogarithmic" or/and "n" standing for
+                        "<emphasis role="bold">N</emphasis>ormal". The first character applies to
+                        the X axis, the second to the Y axis. Hence, "ln" means that the X axis
+                        is logarithmic and the Y axis is normal. The default is "nn":
+                        both axes in normal scales.
+                    </para>
+                    <para>
+                        <literal>logflag</literal> must be used after <literal>axes_handle</literal>
+                        (if any) and before the first curve's data <literal>x</literal> or
+                        <literal>y</literal> or <literal>fun</literal>.
+                        It applies to all curves drawn by the <literal>plot(…)</literal> instruction.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
                 <term>axes_handle</term>
                 <listitem>
                     <para>This optional argument forces the plot to appear inside the
         </para>
         <informaltable border="1">
             <tr>
-                <th>
-                    <literal>R</literal>
-                </th>
-                <th>
-                    <literal>G</literal>
-                </th>
-                <th>
-                    <literal>B</literal>
-                </th>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.</td>
-                <td>1.</td>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.5</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>1.</td>
-                <td>0.</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.75</td>
-                <td>0.75</td>
-            </tr>
-            <tr>
-                <td>0.75</td>
-                <td>0.</td>
-                <td>0.75</td>
-            </tr>
-            <tr>
-                <td>0.75</td>
-                <td>0.75</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>0.25</td>
-                <td>0.25</td>
-                <td>0.25</td>
+                <th> <literal>R</literal> </th>
+                <th> <literal>G</literal> </th>
+                <th> <literal>B</literal> </th>
             </tr>
+            <tr> <td>0.</td>   <td>0.</td>   <td>1.</td>   </tr>
+            <tr> <td>0.</td>   <td>0.5</td>  <td>0.</td>   </tr>
+            <tr> <td>1.</td>   <td>0.</td>   <td>0.</td>   </tr>
+            <tr> <td>0.</td>   <td>0.75</td> <td>0.75</td> </tr>
+            <tr> <td>0.75</td> <td>0.</td>   <td>0.75</td> </tr>
+            <tr> <td>0.75</td> <td>0.75</td> <td>0.</td>   </tr>
+            <tr> <td>0.25</td> <td>0.25</td> <td>0.25</td> </tr>
         </informaltable>
         <para/>
         <para>
     <refsection>
         <title>Examples</title>
         <para>
+            <emphasis role="bold">Choosing the normal or logarithmic plotting mode:</emphasis>
+        </para>
+        <programlisting role="example"><![CDATA[
+set(gda(), "grid_style",[7 7], "grid", [1 1]*color("grey70"));
+title(gda(), "fontsize", 3, "color", "lightseagreen", "fontname", "helvetica bold");
+
+x = linspace(1e-1,100,1000);
+xm = 35;
+dx = 17;
+G = exp(-((x-xm)/dx).^2/2)*30;
+
+scf(1); clf
+subplot(2,2,1), plot(x, G),       title("plot(x, y)")
+subplot(2,2,2), plot("ln", x, G), title("semilog-x : plot(""ln"", x, y)")
+gca().sub_ticks(1) = 8;
+subplot(2,2,3), plot("nl", x, G), title("semilog-y : plot(""nl"", x, y)")
+gca().sub_ticks(2) = 8;
+subplot(2,2,4), plot("ll", x, G), title("loglog : plot(""ll"", x, y)")
+gca().sub_ticks = [8 8];
+
+sda();
+ ]]></programlisting>
+        <scilab:image>
+            title(gda(), "", "fontsize", 3, "color", "lightseagreen", "fontname", "helvetica bold");
+            set(gda(), "grid_style",[7 7], "grid", [1 1]*color("grey70"));
+
+            x = linspace(1e-1,100,1000);
+            xm = 35;
+            dx = 17;
+            G = exp(-((x-xm)/dx).^2/2)*30;
+            scf(1); clf
+            subplot(2,2,1), plot(x, G),       title("plot(x, y)")
+            subplot(2,2,2), plot("ln", x, G), title("semilog-x : plot(""ln"", x, y)")
+            gca().sub_ticks(1) = 8;
+            subplot(2,2,3), plot("nl", x, G), title("semilog-y : plot(""nl"", x, y)")
+            gca().sub_ticks(2) = 8;
+            subplot(2,2,4), plot("ll", x, G), title("loglog : plot(""ll"", x, y)")
+            gca().sub_ticks = [8 8];
+
+            gcf().axes_size = [750 520];
+            sda();
+        </scilab:image>
+        <para/>
+        <para>
             <emphasis role="bold">Simple plot of a single curve:</emphasis>
         </para>
         <programlisting role="example"><![CDATA[
@@ -677,6 +707,12 @@ isoview off
                     plot(x, list(fun, params)).
                 </revdescription>
             </revision>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revdescription>
+                    logflag option added.
+                </revdescription>
+            </revision>
         </revhistory>
     </refsection>
 </refentry>
index ce4a14b..c4d890b 100644 (file)
@@ -3,7 +3,7 @@
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA - Fabrice Leray
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
- * Copyright (C) 2018 - Samuel GOUGEON
+ * Copyright (C) 2018 - 2019 - Samuel GOUGEON
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -33,6 +33,7 @@
             plot(.., LineSpec, GlobalProperty)
             plot(x1, y1, LineSpec1, x2,y2,LineSpec2,...xN, yN, LineSpecN, GlobalProperty1,.. GlobalPropertyM)
             plot(x1,fun1,LineSpec1, x2,y2,LineSpec2,...xN,funN,LineSpecN, GlobalProperty1, ..GlobalPropertyM)
+            plot(logflag,...)
             plot(axes_handle,...)
         </synopsis>
     </refsynopsisdiv>
                 </listitem>
             </varlistentry>
             <varlistentry>
+                <term>logflag</term>
+                <listitem>
+                    <para>
+                        "ln" | "nl" | "ll" : 2-character word made of "l" standing for
+                        "<emphasis role="bold">L</emphasis>ogarithmic" or/and "n" standing for
+                        "<emphasis role="bold">N</emphasis>ormal". The first character applies to
+                        the X axis, the second to the Y axis. Hence, "ln" means that the X axis
+                        is logarithmic and the Y axis is normal. The default is "nn":
+                        both axes in normal scales.
+                    </para>
+                    <para>
+                        <literal>logflag</literal> must be used after <literal>axes_handle</literal>
+                        (if any) and before the first curve's data <literal>x</literal> or
+                        <literal>y</literal> or <literal>fun</literal>.
+                        It applies to all curves drawn by the <literal>plot(…)</literal> instruction.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
                 <term>axes_handle</term>
                 <listitem>
                     <para>
         </para>
         <informaltable border="1">
             <tr>
-                <td>
-                    <literal>R</literal>
-                </td>
-                <td>
-                    <literal>G</literal>
-                </td>
-                <td>
-                    <literal>B</literal>
-                </td>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.</td>
-                <td>1.</td>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.5</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>1.</td>
-                <td>0.</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.75</td>
-                <td>0.75</td>
-            </tr>
-            <tr>
-                <td>0.75</td>
-                <td>0.</td>
-                <td>0.75</td>
-            </tr>
-            <tr>
-                <td>0.75</td>
-                <td>0.75</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>0.25</td>
-                <td>0.25</td>
-                <td>0.25</td>
+                <th> <literal>R</literal> </th>
+                <th> <literal>G</literal> </th>
+                <th> <literal>B</literal> </th>
             </tr>
+            <tr> <td>0.</td>   <td>0.</td>   <td>1.</td>   </tr>
+            <tr> <td>0.</td>   <td>0.5</td>  <td>0.</td>   </tr>
+            <tr> <td>1.</td>   <td>0.</td>   <td>0.</td>   </tr>
+            <tr> <td>0.</td>   <td>0.75</td> <td>0.75</td> </tr>
+            <tr> <td>0.75</td> <td>0.</td>   <td>0.75</td> </tr>
+            <tr> <td>0.75</td> <td>0.75</td> <td>0.</td>   </tr>
+            <tr> <td>0.25</td> <td>0.25</td> <td>0.25</td> </tr>
         </informaltable>
         <para/>
         <para>
     <refsection role="examples">
         <title>例</title>
         <para>
+            <emphasis role="bold">Choosing the normal or logarithmic plotting mode:</emphasis>
+        </para>
+        <programlisting role="example"><![CDATA[
+set(gda(), "grid_style",[7 7], "grid", [1 1]*color("grey70"));
+title(gda(), "fontsize", 3, "color", "lightseagreen", "fontname", "helvetica bold");
+
+x = linspace(1e-1,100,1000);
+xm = 35;
+dx = 17;
+G = exp(-((x-xm)/dx).^2/2)*30;
+
+scf(1); clf
+subplot(2,2,1), plot(x, G),       title("plot(x, y)")
+subplot(2,2,2), plot("ln", x, G), title("semilog-x : plot(""ln"", x, y)")
+gca().sub_ticks(1) = 8;
+subplot(2,2,3), plot("nl", x, G), title("semilog-y : plot(""nl"", x, y)")
+gca().sub_ticks(2) = 8;
+subplot(2,2,4), plot("ll", x, G), title("loglog : plot(""ll"", x, y)")
+gca().sub_ticks = [8 8];
+
+sda();
+ ]]></programlisting>
+        <scilab:image>
+            title(gda(), "", "fontsize", 3, "color", "lightseagreen", "fontname", "helvetica bold");
+            set(gda(), "grid_style",[7 7], "grid", [1 1]*color("grey70"));
+
+            x = linspace(1e-1,100,1000);
+            xm = 35;
+            dx = 17;
+            G = exp(-((x-xm)/dx).^2/2)*30;
+            scf(1); clf
+            subplot(2,2,1), plot(x, G),       title("plot(x, y)")
+            subplot(2,2,2), plot("ln", x, G), title("semilog-x : plot(""ln"", x, y)")
+            gca().sub_ticks(1) = 8;
+            subplot(2,2,3), plot("nl", x, G), title("semilog-y : plot(""nl"", x, y)")
+            gca().sub_ticks(2) = 8;
+            subplot(2,2,4), plot("ll", x, G), title("loglog : plot(""ll"", x, y)")
+            gca().sub_ticks = [8 8];
+
+            gcf().axes_size = [750 520];
+            sda();
+        </scilab:image>
+        <para/>
+        <para>
             <emphasis role="bold">Simple plot of a single curve:</emphasis>
         </para>
         <programlisting role="example"><![CDATA[
@@ -702,6 +732,12 @@ isoview off
                     plot(x, list(fun, params)).
                 </revdescription>
             </revision>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revdescription>
+                    logflag option added.
+                </revdescription>
+            </revision>
         </revhistory>
     </refsection>
 </refentry>
index ce527a8..d819464 100644 (file)
@@ -2,9 +2,8 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) INRIA - Fabrice Leray
- * Copyright (C) 2018 - Samuel GOUGEON
- *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2018 - 2019 - Samuel GOUGEON
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -34,6 +33,7 @@
             plot(.., LineSpec, GlobalProperty)
             plot(x1, y1, LineSpec1, x2,y2,LineSpec2,...xN, yN, LineSpecN, GlobalProperty1,.. GlobalPropertyM)
             plot(x1,fun1,LineSpec1, x2,y2,LineSpec2,...xN,funN,LineSpecN, GlobalProperty1, ..GlobalPropertyM)
+            plot(logflag,...)
             plot(axes_handle,...)
         </synopsis>
     </refsynopsisdiv>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>&lt;axes_handle&gt;</term>
+                <term>logflag</term>
+                <listitem>
+                    <para>
+                        "ln" | "nl" | "ll" : 2-character word made of "l" standing for
+                        "<emphasis role="bold">L</emphasis>ogarithmic" or/and "n" standing for
+                        "<emphasis role="bold">N</emphasis>ormal". The first character applies to
+                        the X axis, the second to the Y axis. Hence, "ln" means that the X axis
+                        is logarithmic and the Y axis is normal. The default is "nn":
+                        both axes in normal scales.
+                    </para>
+                    <para>
+                        <literal>logflag</literal> must be used after <literal>axes_handle</literal>
+                        (if any) and before the first curve's data <literal>x</literal> or
+                        <literal>y</literal> or <literal>fun</literal>.
+                        It applies to all curves drawn by the <literal>plot(…)</literal> instruction.
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>axes_handle</term>
                 <listitem>
                     <para>este argumento opcional força o esboço a aparecer dentro dos
                         eixos selecionados fornecidos por <literal>axes_handle</literal> ao
             argumentos opcionais <literal>LineSpec</literal> ou
             <literal>GlobalProperty</literal> já que eles não interferem na entrada de
             dados (exceto pelas propriedades <literal>"Xdata"</literal>,
-            <literal>"Ydata"</literal> e <literal>"Zdata"</literal>, ver <link linkend="GlobalProperty">GlobalProperty</link>). É assumido que todos
+            <literal>"Ydata"</literal> e <literal>"Zdata"</literal>,
+            ver <link linkend="GlobalProperty">GlobalProperty</link>). É assumido que todos
             estes argumentos podem estar presentes também.
         </para>
         <para>
                         <literal>GlobalProperty</literal>, pode-se ajustar várias
                         propriedades : todas as propriedades disponíveis via LineSpec e
                         mais: a cor da marca (plano de fundo e primeiro plano), a
-                        visibilidade, o recorte e a espessura das curvas. (ver <link linkend="GlobalProperty">GlobalProperty</link>)
+                        visibilidade, o recorte e a espessura das curvas.
+                        (ver <link linkend="GlobalProperty">GlobalProperty</link>)
                     </para>
-                    <para>Note que todas as propriedades podem ser (re-)ajustadas
-                        através das propriedades de entidades poligonais (ver <link linkend="polyline_properties">polyline_properties</link>).
+                    <para>
+                        Note que todas as propriedades podem ser (re-)ajustadas
+                        através das propriedades de entidades poligonais
+                        (ver <link linkend="polyline_properties">polyline_properties</link>).
                     </para>
                 </listitem>
             </varlistentry>
         </para>
         <informaltable border="1">
             <tr>
-                <td>
-                    <literal>R</literal>
-                </td>
-                <td>
-                    <literal>G</literal>
-                </td>
-                <td>
-                    <literal>B</literal>
-                </td>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.</td>
-                <td>1.</td>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.5</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>1.</td>
-                <td>0.</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>0.</td>
-                <td>0.75</td>
-                <td>0.75</td>
-            </tr>
-            <tr>
-                <td>0.75</td>
-                <td>0.</td>
-                <td>0.75</td>
-            </tr>
-            <tr>
-                <td>0.75</td>
-                <td>0.75</td>
-                <td>0.</td>
-            </tr>
-            <tr>
-                <td>0.25</td>
-                <td>0.25</td>
-                <td>0.25</td>
+                <th> <literal>R</literal> </th>
+                <th> <literal>G</literal> </th>
+                <th> <literal>B</literal> </th>
             </tr>
+            <tr> <td>0.</td>   <td>0.</td>   <td>1.</td>   </tr>
+            <tr> <td>0.</td>   <td>0.5</td>  <td>0.</td>   </tr>
+            <tr> <td>1.</td>   <td>0.</td>   <td>0.</td>   </tr>
+            <tr> <td>0.</td>   <td>0.75</td> <td>0.75</td> </tr>
+            <tr> <td>0.75</td> <td>0.</td>   <td>0.75</td> </tr>
+            <tr> <td>0.75</td> <td>0.75</td> <td>0.</td>   </tr>
+            <tr> <td>0.25</td> <td>0.25</td> <td>0.25</td> </tr>
         </informaltable>
         <para/>
         <para>
     <refsection role="examples">
         <title>Exemplos</title>
         <para>
+            <emphasis role="bold">Choosing the normal or logarithmic plotting mode:</emphasis>
+        </para>
+        <programlisting role="example"><![CDATA[
+set(gda(), "grid_style",[7 7], "grid", [1 1]*color("grey70"));
+title(gda(), "fontsize", 3, "color", "lightseagreen", "fontname", "helvetica bold");
+
+x = linspace(1e-1,100,1000);
+xm = 35;
+dx = 17;
+G = exp(-((x-xm)/dx).^2/2)*30;
+
+scf(1); clf
+subplot(2,2,1), plot(x, G),       title("plot(x, y)")
+subplot(2,2,2), plot("ln", x, G), title("semilog-x : plot(""ln"", x, y)")
+gca().sub_ticks(1) = 8;
+subplot(2,2,3), plot("nl", x, G), title("semilog-y : plot(""nl"", x, y)")
+gca().sub_ticks(2) = 8;
+subplot(2,2,4), plot("ll", x, G), title("loglog : plot(""ll"", x, y)")
+gca().sub_ticks = [8 8];
+
+sda();
+ ]]></programlisting>
+        <scilab:image>
+            title(gda(), "", "fontsize", 3, "color", "lightseagreen", "fontname", "helvetica bold");
+            set(gda(), "grid_style",[7 7], "grid", [1 1]*color("grey70"));
+
+            x = linspace(1e-1,100,1000);
+            xm = 35;
+            dx = 17;
+            G = exp(-((x-xm)/dx).^2/2)*30;
+            scf(1); clf
+            subplot(2,2,1), plot(x, G),       title("plot(x, y)")
+            subplot(2,2,2), plot("ln", x, G), title("semilog-x : plot(""ln"", x, y)")
+            gca().sub_ticks(1) = 8;
+            subplot(2,2,3), plot("nl", x, G), title("semilog-y : plot(""nl"", x, y)")
+            gca().sub_ticks(2) = 8;
+            subplot(2,2,4), plot("ll", x, G), title("loglog : plot(""ll"", x, y)")
+            gca().sub_ticks = [8 8];
+
+            gcf().axes_size = [750 520];
+            sda();
+        </scilab:image>
+        <para/>
+        <para>
             <emphasis role="bold">Simple plot of a single curve:</emphasis>
         </para>
         <programlisting role="example"><![CDATA[
@@ -676,6 +709,12 @@ isoview off
                     plot(x, list(fun, params)).
                 </revdescription>
             </revision>
+            <revision>
+                <revnumber>6.1.0</revnumber>
+                <revdescription>
+                    logflag option added.
+                </revdescription>
+            </revision>
         </revhistory>
     </refsection>
 </refentry>
index 614efa7..3a47f88 100644 (file)
@@ -56,7 +56,6 @@ function [X,Y]=checkXYPair(typeOfPlot,x,y,current_figure,cur_draw_mode)
         end
 
     else // "classical" case
-
         X=x;
         Y=y;
 
@@ -146,6 +145,9 @@ function [X,Y]=checkXYPair(typeOfPlot,x,y,current_figure,cur_draw_mode)
                 error(msprintf(gettext("%s: Wrong size for input arguments #%d and #%d: Incompatible dimensions.\n"),typeOfPlot,2, 3));
                 return;
             end
+            if YScal
+                y = y*ones(X(:,1));
+            end
 
             // concatenante y in columns
             Y=y(:,ones(1,size(X,2)));
index 941d94a..859de76 100644 (file)
@@ -2,7 +2,7 @@
 // Copyright (C) 2004-2006 - INRIA - Fabrice Leray
 // Copyright (C) 2008 - INRIA - Jean-Baptiste Silvy
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
-// Copyright (C) 2018 - Samuel GOUGEON
+// Copyright (C) 2018 - 2019 - Samuel GOUGEON
 //
 // This file is hereby licensed under the terms of the GNU GPL v2.0,
 // pursuant to article 5.3.4 of the CeCILL v.2.1.
@@ -15,6 +15,13 @@ function varargout = plot(varargin)
     // Try to build a new better parser that could manage things like:
     // plot(x,y,'X',1:10); // where X stands for Xdata (Matlab recognizes
     //it and treats it well...)
+    // HISTORY:
+    // 2018:
+    //   plot(x, fun) : call to fun() vectorized
+    //   plot(x, list(fun, params)) implemented
+    // 2019:
+    //   logflag implemented.
+    //   y: support to integers added
 
     [lhs,rhs]=argn(0);
 
@@ -38,8 +45,10 @@ function varargout = plot(varargin)
 
 
     ListArg = varargin;
+    nextArgin = 1;
 
     //detect and set the current axes now:
+    // -----------------------------------
     if type(ListArg(1)) == 9
         hdle = ListArg(1);
         if (hdle.type == "Axes")
@@ -50,12 +59,33 @@ function varargout = plot(varargin)
             warning(msprintf(msg, "plot", 1, "Axes"))
             return;
         end
+        nextArgin = 2
+    end;
+
+    // Possible log flags
+    // ------------------
+    tmp = ListArg(1);
+    if type(tmp)==10 then
+        if size(tmp,"*")>1
+            msg = _("%s: Argument #%d: log flags: scalar expected.\n")
+            warning(msprintf(msg, "plot", nextArgin))
+            return
+        end
+        tmp = convstr(tmp);
+        tmp2 = strsubst(tmp, "/\s|l|n/", "", "r");
+        if tmp2<>""
+            msg = _("%s: Argument #%d: log flags: wrong value. Ignored.\n")
+            warning(msprintf(msg, "plot", nextArgin))
+            tmp = "nnn"
+        end
+        logflags = part(tmp+"n",1:2);
+        ListArg(1) = null()
+        nextArgin = nextArgin + 1;
+    else
+        logflags = "nn";
     end
-
-
     nv = size(ListArg)
 
-
     argTypes=[];
     couple=[];
 
@@ -72,7 +102,7 @@ function varargout = plot(varargin)
         acceptedTypes=[];
         // double, macro function or primitive,
         //    or list(macro|primitive, params) accepted as second argument
-        acceptedTypes=find(Ttmp(i,1)==1 & or(Ttmp(i+1,1)==[1,13,130,15]))
+        acceptedTypes=find(Ttmp(i,1)==1 & or(Ttmp(i+1,1)==[1,8,13,130,15]))
         if (acceptedTypes<>[]) then
             couple=[couple i];
             Ttmp(i,1)  = 99; // Replace a known type by 99 (no meaning) to count it once only!
@@ -123,8 +153,6 @@ function varargout = plot(varargin)
             end
         end
 
-
-
         if (modulo(nv-(couple($)+1),2)<>0) then
             P1 = couple($)+3 // Position of the first PropertyName field
         else
@@ -350,8 +378,6 @@ function varargout = plot(varargin)
             Property = Property+2;
         end
 
-
-
         //Now we have an array xyIndexLineSpec [numplot x 3] containing indices pointing on T for :
         // - x (<>0 if existing)
         // - y
@@ -364,14 +390,12 @@ function varargout = plot(varargin)
         //plot3  i4|i5 |i6   <=> plot(x,y,LINESPEC)
         //...
 
-
-
         if (xyIndexLineSpec(i,3)<>0) then // if we have a line spec <=> index <> 0
             [Color,Line,LineStyle,Marker,MarkerStyle,MarkerSize,fail] = getLineSpec(ListArg(xyIndexLineSpec(i,3)),current_figure,cur_draw_mode);
         end
 
         // The plot is made now :
-        err = execstr("plot2d(X,Y)","errcatch","m");
+        err = execstr("plot2d(logflags,X,double(Y))","errcatch","m");
 
         if err <> 0
             mprintf("Error %d : in plot2d called by plot",err);
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_13603.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_13603.tst
new file mode 100644 (file)
index 0000000..e068eae
--- /dev/null
@@ -0,0 +1,22 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2019 - Samuel GOUGEON
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+// <-- NO CHECK REF -->
+
+// <-- Non-regression test for bug 13603 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13603
+//
+// <-- Short Description -->
+// plot([0 1 2 3]', 10) failed
+
+x = (0:0.1:4)';
+plot(x, 10);
+curve = gce().children.data;
+assert_checkequal(curve, [x 10*ones(x)]);
diff --git a/scilab/modules/graphics/tests/nonreg_tests/bug_15965.tst b/scilab/modules/graphics/tests/nonreg_tests/bug_15965.tst
new file mode 100644 (file)
index 0000000..900c849
--- /dev/null
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2019 - Samuel GOUGEON
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- TEST WITH GRAPHIC -->
+// <-- NO CHECK REF -->
+
+// <-- Non-regression test for bug 15965 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/15965
+//
+// <-- Short Description -->
+// plot(x,y) did not support y as encoded integers
+
+x = (1:20)/20;
+y = uint16(100*rand(1,20));
+plot(x, y);
+curve = gce().children.data;
+assert_checkequal(curve, [x' double(y')]);
index c18c4cf..21aad47 100644 (file)
             <li><code>setdiff</code> now supports complex numbers.</li>
             <li><code>twinkle</code> can now blink together several hierarchically independent objects, like a curve and its labels, etc.</li>
             <li><code>repmat</code> is improved: more neutral default frame color; improved labels positioning; colors can now be specified by their predefined name or "#RRGGBB" hexa code; a structure of handles is now returned to easily post-process both subframes and the set of labels.</li>
+            <li><code>plot</code> can now work in semi or bi-logarithmic mode with some input logflag.</li>
         </ul>
         <h2 class="title">Help pages</h2>
         <ul>
index 2c95e09..a0df767 100644 (file)
@@ -960,15 +960,16 @@ plot3d_6.png=a491f1e7b84b7fbf50eb39a6d795fb81
 plot3d_7.png=b106077ec3b360ba717fef4579da3f55
 plot3d_8.png=d7ca9d9d5dd993d30bc6423a0528ff8e
 plot3d_9.png=c0f93d84e3ccdc76486bd41209b1f76b
-plot_1.png=ad242947214d2866107c147f5384e0a9
-plot_2.png=6549659743df2155be3061577f86c428
-plot_3.png=05411294e38970b93bd2e96047171bdd
-plot_4.png=f2a02f303bf4578fe0c029abc8f084dd
-plot_5.png=25b0dc1bfdba78e499055bedf79020dc
-plot_6.png=6530b1526ca007d68c095bb76295eade
-plot_7.png=df9a6a6decb537fae8a8adde2304a85a
-plot_8.png=7892b92465386a710d20d0a30cf46304
-plot_9.png=bead04d3923168e8291932e665abffa0
+plot_1.png=de11c85763569466c5738b91c497b387
+plot_10.png=bead04d3923168e8291932e665abffa0
+plot_2.png=ad242947214d2866107c147f5384e0a9
+plot_3.png=6549659743df2155be3061577f86c428
+plot_4.png=05411294e38970b93bd2e96047171bdd
+plot_5.png=f2a02f303bf4578fe0c029abc8f084dd
+plot_6.png=25b0dc1bfdba78e499055bedf79020dc
+plot_7.png=6530b1526ca007d68c095bb76295eade
+plot_8.png=df9a6a6decb537fae8a8adde2304a85a
+plot_9.png=7892b92465386a710d20d0a30cf46304
 plot_multiscaled_1.png=139dc4c6fd62728b6f08e4529fc775fa
 plot_multiscaled_2.png=8ea6f9394968a8d02d09e1a66064c718
 plot_multiscaled_3.png=97b20f253d676c6d66fe322172b960ac
index 6cdc634..63d5a4a 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_1.png and b/scilab/modules/helptools/images/plot_1.png differ
diff --git a/scilab/modules/helptools/images/plot_10.png b/scilab/modules/helptools/images/plot_10.png
new file mode 100644 (file)
index 0000000..f1ca950
Binary files /dev/null and b/scilab/modules/helptools/images/plot_10.png differ
index d05400f..74d8663 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_2.png and b/scilab/modules/helptools/images/plot_2.png differ
index 02f1b05..d05400f 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_3.png and b/scilab/modules/helptools/images/plot_3.png differ
index 873c4a9..a384a36 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_4.png and b/scilab/modules/helptools/images/plot_4.png differ
index a7a2301..873c4a9 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_5.png and b/scilab/modules/helptools/images/plot_5.png differ
index a536017..a7a2301 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_6.png and b/scilab/modules/helptools/images/plot_6.png differ
index 25d6b2b..a536017 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_7.png and b/scilab/modules/helptools/images/plot_7.png differ
index ae1db5c..25d6b2b 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_8.png and b/scilab/modules/helptools/images/plot_8.png differ
index f1ca950..ae1db5c 100644 (file)
Binary files a/scilab/modules/helptools/images/plot_9.png and b/scilab/modules/helptools/images/plot_9.png differ