• linecolor and fillcolor as stringvariable

    From =?UTF-8?Q?J=c3=b6rg_Buchholz?=@21:1/5 to All on Tue Sep 3 14:03:41 2019
    Hello,

    for me string variables being hard. I can't found a way to set "lc" and
    "fc" as string variables.

    example:

    color1 = "red"
    color2 = "green"
    set obj 1 rect from 0,0 to 5,5 fc color1
    set obj 2 rect from 0,0 to 5,-5 fc color2
    plot sin(x) w l lc color1, cos(x) w l lc color2

    How must I define the variables?



    set obj 1 rect from 0,0 to 5,5 fc 'red'
    set obj 2 rect from 0,0 to 5,-5 fc 'green'
    plot sin(x) w l lc 'red', cos(x) w l lc 'green'

    This works, but there are much lines and much rectangles. So it will be
    easier to change the color if I can define them as variables.



    Thanks for any help,

    Jörg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?J=c3=b6rg_Buchholz?=@21:1/5 to All on Tue Sep 3 14:38:58 2019
    On 03.09.2019 14:03, Jörg Buchholz wrote:
    Hello,

    for me string variables being hard. I can't found a way to set "lc" and
    "fc" as string variables.

    example:

    color1 = "red"
    color2 = "green"
    set obj 1 rect from 0,0 to 5,5 fc color1
    set obj 2 rect from 0,0 to 5,-5 fc color2
    plot sin(x) w l lc color1, cos(x) w l lc color2

    How must I define the variables?


    OK. I found a way.

    color1 = "'red'"
    color2 = "'green'"
    set obj 1 rect from 0,0 to 5,5 fc @color1
    set obj 2 rect from 0,0 to 5,-5 fc @color2
    plot sin(x) w l lc @color1, cos(x) w l lc @color2


    Jörg

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ethan Merritt@21:1/5 to All on Fri Sep 13 19:36:07 2019
    On Tue, 03 Sep 2019 14:38:58 +0200, Jörg Buchholz wrote:

    On 03.09.2019 14:03, Jörg Buchholz wrote:
    Hello,

    for me string variables being hard. I can't found a way to set "lc" and
    "fc" as string variables.

    example:

    color1 = "red"
    color2 = "green"
    set obj 1 rect from 0,0 to 5,5 fc color1
    set obj 2 rect from 0,0 to 5,-5 fc color2
    plot sin(x) w l lc color1, cos(x) w l lc color2

    How must I define the variables?


    OK. I found a way.

    color1 = "'red'"
    color2 = "'green'"
    set obj 1 rect from 0,0 to 5,5 fc @color1
    set obj 2 rect from 0,0 to 5,-5 fc @color2
    plot sin(x) w l lc @color1, cos(x) w l lc @color2


    Jörg

    Gnuplot is confused because it is expecting a linetype number
    in the commands you show. Adding the keyword "rgb" will cause
    it to expect a string containing a color name, a hexadecimal
    representation of the color in the form "#RRGGBB", or various
    other forms explained by 'help colorspec'.

    Example:

    color1 = "red"
    color2 = "green"
    plot sin(x) w l lc rgb color1, cos(x) w l lc rgb color2

    Ethan

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)