|
From: sfeam (E. Merritt) <eam...@gm...> - 2010-03-15 03:28:07
|
On Sunday 14 March 2010, hon fui lee wrote:
> Tried your suggestion. The "lc palette Z" introduces error like " line
> XX: ';' expected".
> "lc Z" is OK but not as palette, discrete color instead. Same as "lc
> variable" Eg. of my Z value ranges from 0.105 to 0.331.
I was not clear enough. Please see "help colorspec"
The idea is that the 'Z' in "lc palette Z" stands for either
"frac <value>" where <value> runs from 0 to 1 and represents
a sample on the current palette, or "cb <value>" where
<value> is drawn from the range of the current colorbox.
> Let me give you a better example. A study on a group of university
> student on their age and performance.
> Student A: Age 21
> Hour attending class subject 1= 10 hours : Score=70
> Hour attending class subject 2= 12 hours : Score=80
> .
> .
> .
> .
> Student B: Age 25
> Hour attending class subject 1= 10 hours : Score 55
> Hour attending class subject 2= 20 hours : Score 60
> .
> .
> .
> .
>
> Let plot hour attending class subject (x) vs score (y). Each curve is
> colored according to the age to see any trend.
Fine. So let's assume your student's ages run from 20 to 30.
Then we have
set cbrange [20:30]
plot 'student1' using ... with lines lc cb 21,
'student2' using ... with lines lc cb 25,
'student3' ...
and so on.
> In my earliest post, notice linespoints give correct color and symbol
> according to the plot/key, just like the curve itself. Only the line
> color is wrong.
> If the plot can do color palette/gradient on the curve correctly(or
> may be incorrectly) why not the key?
You have asked it to color the lines by z value.
Each point or line segment has a z value.
But what is the z value of the key? It has none.
Ethan
> Thanks.
>
> On Thursday 11 March 2010 23:30:28 hon fui lee wrote:
> > I'm trying to do a 2D lines/linespoint plot with linecolor from 3rd
> > column as color palette.
> > All are OK except the key does not proper linecolor. See sample
> > command file and sample output (pdf).
> > I'm using gnuplot version 4.5 (development) on Windows.
> >
> > Is that a bug or feature? Thanks.
>
> I think it is a mis-expectation.
>
> Your lines happen to each have a constant Z value, which you can think of
> as a color value, so for your particular plot each entire line is a
> single color and it would make sense for the sample line segment in the
> key to be that same color.
>
> But how is gnuplot supposed to know this? In general each point could
> have a different Z value and each line would have many segments with
> various colors. Which of these colors would you put in the key?
>
> If you know in advance that each line has a constant Z value, maybe
> you can revise the plot command so that instead of
> plot 'foo' using 1:2:3 lc palette
> you use
> Z = constant_z_for_this_line
> plot 'foo' using 1:2 lc palette Z
>
> For this you would have to read in the Z values before issuing the
> plot command. That may or may not be possible in your particular
> plotting scenario.
>
> Ethan
|