Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #4223

Re: linecolor and fillcolor as stringvariable

Path csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From Ethan Merritt <eamerritt@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: linecolor and fillcolor as stringvariable
Date Fri, 13 Sep 2019 19:36:07 -0000 (UTC)
Organization A noiseless patient Spider
Lines 43
Message-ID <qlgr37$jpe$1@dont-email.me> (permalink)
References <qklkqu$r5p$1@dont-email.me> <qklmt3$7ic$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Fri, 13 Sep 2019 19:36:07 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="4f5e84765e902ced634ebf566be7848d"; logging-data="20270"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18hAKw+PQ7V0oImSHFs4N1D"
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Cancel-Lock sha1:A72KPqfxEPa3CQy8uQX2vG3/O8M=
Xref csiph.com comp.graphics.apps.gnuplot:4223

Show key headers only | View raw


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

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Find similar


Thread

linecolor and fillcolor as stringvariable Jörg Buchholz <bookwood4new@freenet.de> - 2019-09-03 14:03 +0200
  Re: linecolor and fillcolor as stringvariable Jörg Buchholz <bookwood4new@freenet.de> - 2019-09-03 14:38 +0200
    Re: linecolor and fillcolor as stringvariable Ethan Merritt <eamerritt@gmail.com> - 2019-09-13 19:36 +0000

csiph-web