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


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

Re: Plot emtpy labels from file entries using 'matrix with image'

From neurino <lelli.luca@googlemail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Plot emtpy labels from file entries using 'matrix with image'
Date 2014-11-22 15:26 +0100
Organization C.U. srl News Server
Message-ID <m4q6eu$dr1$1@virtdiesel.mng.cu.mi.it> (permalink)
References <m4l428$pv1$1@virtdiesel.mng.cu.mi.it> <m4mj5d$o71$1@dont-email.me> <m4nakp$aq2$1@virtdiesel.mng.cu.mi.it>

Show all headers | View raw


On 2014-11-21 12:19:37 +0000, neurino said:

>> By the way, it is very rare to have to use multiplot to create a
>> single plot.  I don't think you really need to do so here either.
>> But leave that for now.
> 
> Likely, slicing the matrix with proper indexing would pick up 
> triangular submatrices, however I couldn't come up myself with such a 
> smart solution. It came natural to think at the layered structure of a 
> postscript file, hence the 'multiplot' approach.

I thnik this can be solved as follows (credit Cristoph-Stackoverflow):

1 - define a single palette, which contains as negative values one 
palette and as positive values the other palette

# here -1.0 corresponds to dark blue and 1.0 to dark green
set palette defined (-1.0 "#31a354", -0.1 "#a1d99b", 0 "white", 0.1 
"#9ecae1", 1.0 "#3182bd")

2 - Based on the x- and  y-value from the single file, you can 
distinguish if the color value should be taken from the negative or 
from the positive palette part.

Column $1 is the running x-value
Column $2 is the running y-value
Column $3 is the z-value (i.e. the actual score value)

So, with the following line
plot ifile matrix using 1:2:( \$1 < \$2 ? -\$3 : \$3) with image,

I'm checking when the x values is less than the y value (lower 
triangular, i.e. below the diagonal), then assign a negative z-value, 
which picks the color in the negative part of the palette and the file 
doesn't need to be split manually anymore.

Cheers.

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


Thread

Plot emtpy labels from file entries using 'matrix with image' neurino <lelli.luca@googlemail.com> - 2014-11-20 17:15 +0100
  Re: Plot emtpy labels from file entries using 'matrix with image' Ethan A Merritt <EAMerritt@gmail.com> - 2014-11-20 21:39 -0800
    Re: Plot emtpy labels from file entries using 'matrix with image' neurino <lelli.luca@googlemail.com> - 2014-11-21 13:19 +0100
      Re: Plot emtpy labels from file entries using 'matrix with image' neurino <lelli.luca@googlemail.com> - 2014-11-22 15:26 +0100

csiph-web