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


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

heatmaps: splot matrix with image ?

Started byKalin Kozhuharov <me.kalin@gmail.com>
First post2014-07-29 02:04 -0700
Last post2014-08-19 11:41 -0700
Articles 3 — 2 participants

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


Contents

  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

#2542 — heatmaps: splot matrix with image ?

FromKalin Kozhuharov <me.kalin@gmail.com>
Date2014-07-29 02:04 -0700
Subjectheatmaps: splot matrix with image ?
Message-ID<460d0c80-5784-4ae1-b4a6-efaf7b9811f2@googlegroups.com>
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)?

This is a very simplified example (plotting Bulgarian flag), the real data is about 100x100 matrix.

---------------------------------------------------------------
#!/usr/bin/gnuplot

reset;
set datafile separator "\t";

$FAKE << EOD
3	0	1	2
0	2	2	2
1	1	1	1
2	0	0	0
EOD

$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" ???
---------------------------------------------------------------


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

Also, is there a way to add thin black border around each square?
And finally, a way to avoid 0.5unit shift, so z(0,0) sits on 0,0, not centered there?

Cheers,
Kalin.

[toc] | [next] | [standalone]


#2543

FromEthan A Merritt <EAMerritt@gmail.com>
Date2014-07-30 22:30 -0700
Message-ID<lrckac$vjm$1@dont-email.me>
In reply to#2542
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.

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


#2552

FromKalin Kozhuharov <me.kalin@gmail.com>
Date2014-08-19 11:41 -0700
Message-ID<9ca76ae0-53f6-48d4-bf1b-de69caaa91ef@googlegroups.com>
In reply to#2543
On Thursday, July 31, 2014 2:30:49 PM UTC+9, Ethan A Merritt wrote:
> 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.
> In -rc2 the following script works.  
> 
> - see 4th plot in the on-line heatmaps demo for version 5.0
>   http://gnuplot.sourceforge.net/demo_cvs/heatmaps.html
> 
Great! I guess I was being a bit too eager :-)

Thank you!

Kalin.

[toc] | [prev] | [standalone]


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


csiph-web