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


Groups > comp.graphics.apps.gnuplot > #1490 > unrolled thread

Plot with boxes and rgb variable

Started byIngo Thies <ingo.thies@gmx.de>
First post2012-11-14 22:52 +0100
Last post2012-11-15 11:43 +0100
Articles 3 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Plot with boxes and rgb variable Ingo Thies <ingo.thies@gmx.de> - 2012-11-14 22:52 +0100
    Re: Plot with boxes and rgb variable sfeam <sfeam@users.sourceforge.net> - 2012-11-14 20:10 -0800
      Re: Plot with boxes and rgb variable Ingo Thies <ingo.thies@gmx.de> - 2012-11-15 11:43 +0100

#1490 — Plot with boxes and rgb variable

FromIngo Thies <ingo.thies@gmx.de>
Date2012-11-14 22:52 +0100
SubjectPlot with boxes and rgb variable
Message-ID<agii45FterrU1@mid.individual.net>
Hi,

is there a way to plot with style "with boxes" and RGB variable color? I 
have a data file like this:

1      88    #FF0000
2      65    #00FF00
3      92    #0000FF
...

and I tried the following:

plot 'boxes.dat' u 1:2:3 w boxes lc rgbcolor variable

"boxes.gp", line 7: warning: Skipping data file with no valid points

The same happens when I try to give the style an expected third column 
as box width info:

plot 'boxes.dat' u 1:2:(0.8):3 w boxes lc rgbcolor variable

The gnuplot manual 4.6 says that "with boxes" is compatible with 
rgbcolor variable, but there is no example how to do it. Any hints?


Ingo

[toc] | [next] | [standalone]


#1491

Fromsfeam <sfeam@users.sourceforge.net>
Date2012-11-14 20:10 -0800
Message-ID<k81q0b$e1s$1@dont-email.me>
In reply to#1490
Ingo Thies wrote:

> Hi,
> 
> is there a way to plot with style "with boxes" and RGB variable color?
> I have a data file like this:
> 
> 1      88    #FF0000
> 2      65    #00FF00
> 3      92    #0000FF
> ...

Hmm. Tricky.

> I tried the following:
> 
> plot 'boxes.dat' u 1:2:3 w boxes lc rgbcolor variable

That would work if the file contained hexadecimal numbers in standard
C format:   0xFF0000  0x00FF00  0x0000FF.
The '#' character makes it a string rather than a number.

OK, so we have to convert the string to a number:

  # replace the leading '#' with '0x' and convert to integer
  RGB(s) = int( "0x" . s[2:*] )
  plot 'data' using 1:2:(RGB(strcol(3))) w boxes lc rgbcolor variable

         Ethan

[toc] | [prev] | [next] | [standalone]


#1492

FromIngo Thies <ingo.thies@gmx.de>
Date2012-11-15 11:43 +0100
Message-ID<agjv9sF863tU1@mid.individual.net>
In reply to#1491
Sorry, since a while, Thunderbird (16.0.1, Ubuntu) labels "reply to
group" as "followup", and "reply" is e-mail only. Since then, I
repeatedly reply as mail rather than to the group. The TB developers
should really improve the intuitive handling of their GUI.

On 15.11.2012 05:10, sfeam wrote:

> That would work if the file contained hexadecimal numbers in standard
> C format:   0xFF0000  0x00FF00  0x0000FF.
> The '#' character makes it a string rather than a number.

My mistake was to assume that the string format is automatically
recognized by gnuplot as an RGB specifier. Is far as I could find in the
manual, there is no hint that standard C format has to be used here, and
this format has been replaced by the string format in terminal settings
some versions ago.

Meanwhile, I have modified the program that outputs the data so that it
now writes RGB triples rather than hexadecimals, so it works now.

> OK, so we have to convert the string to a number:
> 
>   # replace the leading '#' with '0x' and convert to integer
>   RGB(s) = int( "0x" . s[2:*] )
>   plot 'data' using 1:2:(RGB(strcol(3))) w boxes lc rgbcolor variable

Thanky, this might be useful for later. However, I am happy now with RGB
integer triples :-)

Best wishes,

Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web