|
From: Valerio S. <val...@gm...> - 2016-04-22 07:47:28
|
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 ? Thanks ! -- Valerio |
|
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 |
|
From: Daniel J S. <dan...@ie...> - 2016-04-22 16:02:49
|
On 04/22/2016 02:46 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 ? > > Thanks ! > -- > Valerio You are trying to do something like the blue-tinted images Valerio? What I see from your example is a greyscale which is sort of the right idea, and I think you should be able to achieve most of the other properties in those blue-tinted images. You can 1) Change the color map (palette) from greyscale to one that has the blue tint. (And perhaps there is already a predefined color map that is close.) http://gnuplot.sourceforge.net/demo_5.0/heatmaps.html 2) Apply a non-90 degree rotation to the x-axis annotation. http://gnuplot.sourceforge.net/demo_5.0/tics.html 3) Draw individual white lines across the axes to create the borders between individual elements. http://gnuplot.sourceforge.net/demo_5.0/rgb_variable.html Look through some of the demos here for ideas: http://gnuplot.sourceforge.net/demo_5.0/ http://gnuplot.sourceforge.net/demo_5.1/ Dan |
|
From: Valerio S. <val...@gm...> - 2016-04-22 16:43:48
|
Help everyone, following Ethan advice, i've tried to simply the .gp file. Now it looks like this: set term pdfcairo set output "macrobench_latency_heat.pdf" load "../styles.inc" set size 0.9,1.0 set lmargin 20 set rmargin 20 set palette defined (0.0 "white", 1.0 "blue") set tic scale 0 set cblabel "Latency (ms)" set datafile separator comma plot\ "heatmap_latencies_handmade.txt" matrix rowheaders columnheaders u 1:2:3 with image notable Now, how do I show you the result ? I've uploaded it here http://postimg.org/image/sssos6q9j/full/ but here, it shows it something that is completely different from the PDF that I see, in which the cells are smoothed/interpolated...for some reason.. Ideas? -- Valerio On Fri, Apr 22, 2016 at 5:50 PM, sfeam <sf...@us...> wrote: > 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 > |
|
From: Ethan A M. <sf...@us...> - 2016-04-22 17:09:27
|
On Friday, 22 April, 2016 18:43:10 Valerio Schiavoni wrote: > Help everyone, > following Ethan advice, i've tried to simply the .gp file. Now it looks > like this: > > set term pdfcairo > set output "macrobench_latency_heat.pdf" > load "../styles.inc" > set size 0.9,1.0 > set lmargin 20 > set rmargin 20 > set palette defined (0.0 "white", 1.0 "blue") > set tic scale 0 > set cblabel "Latency (ms)" > set datafile separator comma > plot\ > "heatmap_latencies_handmade.txt" matrix rowheaders columnheaders u 1:2:3 > with image notable > > Now, how do I show you the result ? I've uploaded it here > http://postimg.org/image/sssos6q9j/full/ > but here, it shows it something that is completely different from the PDF > that I see, in which the cells are smoothed/interpolated...for some reason.. > > Ideas? The smoothing is probably happening in the program that you use to view the pdf file. Try adding the keyword "pixels": plot ... with image pixels That will change the gnuplot output such that the viewer program will probably not recognize it as something that can be smoothed. See for example the 5th plot in this set of examples http://gnuplot.sourceforge.net/demo_svg_5.1/heatmaps.html Ethan > > -- > Valerio > > > On Fri, Apr 22, 2016 at 5:50 PM, sfeam <sf...@us...> wrote: > > > 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 > > |
|
From: Valerio S. <val...@gm...> - 2016-04-22 17:25:10
|
The "pixels" keyword did it ! Awesome :-) -- Valerio On Fri, Apr 22, 2016 at 7:11 PM, Ethan A Merritt < sf...@us...> wrote: > On Friday, 22 April, 2016 18:43:10 Valerio Schiavoni wrote: > > Help everyone, > > following Ethan advice, i've tried to simply the .gp file. Now it looks > > like this: > > > > set term pdfcairo > > set output "macrobench_latency_heat.pdf" > > load "../styles.inc" > > set size 0.9,1.0 > > set lmargin 20 > > set rmargin 20 > > set palette defined (0.0 "white", 1.0 "blue") > > set tic scale 0 > > set cblabel "Latency (ms)" > > set datafile separator comma > > plot\ > > "heatmap_latencies_handmade.txt" matrix rowheaders columnheaders u 1:2:3 > > with image notable > > > > Now, how do I show you the result ? I've uploaded it here > > http://postimg.org/image/sssos6q9j/full/ > > but here, it shows it something that is completely different from the PDF > > that I see, in which the cells are smoothed/interpolated...for some > reason.. > > > > Ideas? > > The smoothing is probably happening in the program that you use to > view the pdf file. > > Try adding the keyword "pixels": > > plot ... with image pixels > > That will change the gnuplot output such that the viewer program > will probably not recognize it as something that can be smoothed. > See for example the 5th plot in this set of examples > > http://gnuplot.sourceforge.net/demo_svg_5.1/heatmaps.html > > Ethan > > > > > -- > > Valerio > > > > > > On Fri, Apr 22, 2016 at 5:50 PM, sfeam <sf...@us...> > wrote: > > > > > 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 > > > > > |
|
From: Valerio S. <val...@gm...> - 2016-04-24 16:02:29
|
And...is it possible to overlap over each cell the actual value ?
There is an example on the doc, but when I modify my gp to follow it, I get
this error:
"macrobench_latency_heat.gp", line 15: warning: matrix contains missing or
undefined values
plot "heatmap_latencies_handmade.txt" matrix rowheaders columnheaders u
1:2:3 with image pixels notitle, "heatmap_latencies_handmade.txt" matrix u
1:2:3 with label
^
"macrobench_latency_heat.gp", line 15: unrecognized plot type
I've modified the gp as:
set term pdfcairo
set output "macrobench_latency_heat.pdf"
load "../styles.inc"
set size 0.9,0.65
set lmargin 19
set rmargin 1
load 'greys.pal'
set tic scale 0
set font "Arial,9pt"
set cblabel "Latency (ms)"
set datafile separator comma
plot\
"heatmap_latencies_handmade.txt" matrix rowheaders columnheaders u 1:2:3
with image pixels notitle,\
"heatmap_latencies_handmade.txt" matrix u 1:2:3 with label
quit
Gnuplot version is Version 5.0 patchlevel 1 last modified 2015-06-07
--
Valerio
On Fri, Apr 22, 2016 at 7:24 PM, Valerio Schiavoni <
val...@gm...> wrote:
> The "pixels" keyword did it ! Awesome :-)
>
> --
> Valerio
>
>
> On Fri, Apr 22, 2016 at 7:11 PM, Ethan A Merritt <
> sf...@us...> wrote:
>
>> On Friday, 22 April, 2016 18:43:10 Valerio Schiavoni wrote:
>> > Help everyone,
>> > following Ethan advice, i've tried to simply the .gp file. Now it looks
>> > like this:
>> >
>> > set term pdfcairo
>> > set output "macrobench_latency_heat.pdf"
>> > load "../styles.inc"
>> > set size 0.9,1.0
>> > set lmargin 20
>> > set rmargin 20
>> > set palette defined (0.0 "white", 1.0 "blue")
>> > set tic scale 0
>> > set cblabel "Latency (ms)"
>> > set datafile separator comma
>> > plot\
>> > "heatmap_latencies_handmade.txt" matrix rowheaders columnheaders u
>> 1:2:3
>> > with image notable
>> >
>> > Now, how do I show you the result ? I've uploaded it here
>> > http://postimg.org/image/sssos6q9j/full/
>> > but here, it shows it something that is completely different from the
>> PDF
>> > that I see, in which the cells are smoothed/interpolated...for some
>> reason..
>> >
>> > Ideas?
>>
>> The smoothing is probably happening in the program that you use to
>> view the pdf file.
>>
>> Try adding the keyword "pixels":
>>
>> plot ... with image pixels
>>
>> That will change the gnuplot output such that the viewer program
>> will probably not recognize it as something that can be smoothed.
>> See for example the 5th plot in this set of examples
>>
>> http://gnuplot.sourceforge.net/demo_svg_5.1/heatmaps.html
>>
>> Ethan
>>
>> >
>> > --
>> > Valerio
>> >
>> >
>> > On Fri, Apr 22, 2016 at 5:50 PM, sfeam <sf...@us...>
>> wrote:
>> >
>> > > 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
>> > >
>>
>>
>
|