|
From: sfeam <sf...@us...> - 2016-04-22 15:52:10
|
On Friday, 22 April 2016 09:46:50 AM Valerio Schiavoni wrote: > Hello, > i've been trying to make an heat map that looks like the one in this blog > entry > https://learnr.wordpress.com/2010/01/26/ggplot2-quick-heatmap-plotting/ > Unfortunately they don't use gnuplot. > > My attempt so far produces a poor result, i think because I'm not using the > right approach. > > Here's my current version: > > set term pdfcairo > set output "latency_heat.pdf" > load "../styles.inc" > set size 0.9,1.0 > set lmargin 15 > set rmargin 20 > set pm3d #interpolate 0,100 > set view map scale 1 > set style func pm3d > set style data pm3d; > set dgrid3d > set pal defined ( 0 0 0 0, 1 1 1 1 ) > set tic scale 0 > set cblabel "Latency (ms)" > set datafile separator comma > splot "heatmap_latencies.txt" matrix rowheaders columnheaders using 1:2:3 > with image title "" > > Where the input file is: > > ,One,Two,Three > a,675.0, 1177.0, 1975.0 > b,744.0, 13908.0, 20191.0 > c,1767.0, 4374.0 ,5165.0 > d,678.0, 1101.0 ,1888.0 > e, 771.0, 13842.0 ,18648.0 > f, 1372.0, 4264.0 ,5187.0 > g,753.0 , 1541.0 ,1729.0 > h,791.0 , 5832.0 ,20528.0 > i,1310.0, 1225.0 ,5436.0 > l,747.0, 1516.0 ,2118.0 > m,825.0 , 16719.0 ,0 > n,1341.0, 4427.0 ,9040.0 > > > Any idea on how to improve this ? Most of those commands are irrelevant to what you want. This is not a 3D surface, so you don't need "splot". The colors are categorical, not smoothed, so you don't want pm3d. Disregarding labels, it is sufficient to say set datafile separator comma set palette defined (0.0 "white", 1.0 "blue") plot "heatmap_latencies.txt" matrix rowheaders columnheaders with image Ethan |