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


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

Re: heatmaps: splot matrix with image ?

From Ethan A Merritt <EAMerritt@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: heatmaps: splot matrix with image ?
Date 2014-07-30 22:30 -0700
Organization made entirely of Lego
Message-ID <lrckac$vjm$1@dont-email.me> (permalink)
References <460d0c80-5784-4ae1-b4a6-efaf7b9811f2@googlegroups.com>

Show all headers | View raw


Kalin Kozhuharov wrote:

> Hello,
> 
> I have been playing with 5.0_rc1 and also trying to plot heatmaps.
> Not sure if I got it right, please advise if there are better ways to
> do.
> 
> Here is a script that works fine (needs 5.0 for the <<EOD it seems),
> but how can I have non-numeric data labels for the matrix?
> 
> How can I plot $REAL (instead of $FAKE) or similar to that (the data
> to plot is dump from a DB in similar format)?

I don't think that is possible in the current version.

5.0_rc2 will offer a new pair of keywords to handle exactly this case.


> 
> This is a very simplified example (plotting Bulgarian flag), the real
> data is about 100x100 matrix.
> 
> $REAL << EOD
> 3	a	b	c
> A	2	2	2
> B	1	1	1
> C	0	0	0
> EOD
> 
> unset key; unset colorbox; unset xtics; unset ytics;
> set xrange [-0.5:2.5]; set yrange [-0.5:2.5];
> set palette defined (0 "#FFFFFF", 1 "#00966E", 2 "#D62612");
> set view map;
> 
> set xtics nomirror out ("A" 0, "B" 1, "C" 2);
> set ytics nomirror out ("a" 0, "b" 1, "c" 2);
> splot "$FAKE" nonuniform matrix using 1:2:3 with image;
> 
> #splot "$REAL" ???

In -rc2 the following script works.  
>> DOES NOT IN -rc1 <<

set xrange [] noextend
set yrange [] noextend
set palette defined (0 "#FFFFFF", 1 "#00966E", 2 "#D62612")

plot $REAL matrix columnheaders rowheaders \
           using (0.5+$1):(0.5+$2):3 with image

Notes:
- no quotes around $REAL
- autoscaling and axis offset works better with "plot" than with "splot"
- the rowheaders and columnheaders matrix keywords work essentially like
  the xticlabels and yticlabels option in regular plots.
- see 4th plot in the on-line heatmaps demo for version 5.0
  http://gnuplot.sourceforge.net/demo_cvs/heatmaps.html

> I hope something doesn't eat the tabs in the file...

Better to use commas for the purpose of an example :-)

> Also, is there a way to add thin black border around each square?

I can't think of an easy way to do that.

> And finally, a way to avoid 0.5unit shift, so z(0,0) sits on 0,0, not
> centered there?

See plot command above.

	Ethan


> Cheers,
> Kalin.

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


Thread

heatmaps: splot matrix with image ? Kalin Kozhuharov <me.kalin@gmail.com> - 2014-07-29 02:04 -0700
  Re: heatmaps: splot matrix with image ? Ethan A Merritt <EAMerritt@gmail.com> - 2014-07-30 22:30 -0700
    Re: heatmaps: splot matrix with image ? Kalin Kozhuharov <me.kalin@gmail.com> - 2014-08-19 11:41 -0700

csiph-web