<p>A reverse image search on google leads to the <a href="https://commons.wikimedia.org/wiki/File:BicubicInterpolationExample.png" rel="nofollow noreferrer">exact code</a> used to produce the second image:</p>

<pre><code>[Xcoarse, Ycoarse] = meshgrid([0 1 2 3], [0 1 2 3]);
[Xfine, Yfine] = meshgrid(linspace(0,3,3000), linspace(0,3,3000));
DataCoarse = [ 1 2 4 1; ...
           6 3 5 2; ...
           4 2 1 5; ...
           5 4 2 3];
DataBicubicFine  = interp2(Xcoarse, Ycoarse, DataCoarse, Xfine, Yfine, 'bicubic');
figure
surf(Xfine, Yfine, DataBicubicFine); shading flat; colormap(jet); view(0, 90)
 hold on; plot3(Xcoarse, Ycoarse, 10*ones(size(Xcoarse)), 'k.', 'MarkerSize', 20)
colorbar
print -dpng -r300 BicubicInterpolationExample.png 
</code></pre>

CC BY-SA 3.0
2017-11-13T12:55:24.213Z
2017-11-13T12:55:24.213Z
heathobrien
<p>I have two columns of data, x and y, how can I make a ‘thermodynamic diagram’ with matlab? The z axis is the density value of dots, like below figure.
<a href="https://i.sstatic.net/LL0Qw.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LL0Qw.jpg" alt="enter image description here"></a>
<a href="https://i.sstatic.net/E0Ov7.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/E0Ov7.jpg" alt="enter image description here"></a></p>

<p>The x-axis is angle, y-axis is distance.<a href="https://i.sstatic.net/tjBpo.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tjBpo.png" alt="enter image description here"></a>
I want to construct a heatmap like this figure:<a href="https://i.sstatic.net/Vh8Iz.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Vh8Iz.jpg" alt="enter image description here"></a></p>

CC BY-SA 3.0
2017-11-12T12:40:23.643Z
Hi, how is this related to bioinformatics? What have you tried? I don't know if you want your data like in the second plot or like in the first one. Could you provide a some data to test solutions?
llrs
<software-recommendation><r>
Matlab scatter diagram
# Matlab scatter diagram

(Asked by: username_0 on 2017-11-12)

I have two columns of data, x and y, how can I make a ‘thermodynamic diagram’ with matlab? The z axis is the density value of dots, like below figure.
[![enter image description here](https://i.sstatic.net/LL0Qw.jpg)](https://i.sstatic.net/LL0Qw.jpg)
[![enter image description here](https://i.sstatic.net/E0Ov7.jpg)](https://i.sstatic.net/E0Ov7.jpg)

The x-axis is angle, y-axis is distance.[![enter image description here](https://i.sstatic.net/tjBpo.png)](https://i.sstatic.net/tjBpo.png)
I want to construct a heatmap like this figure:[![enter image description here](https://i.sstatic.net/Vh8Iz.jpg)](https://i.sstatic.net/Vh8Iz.jpg)

**Tags:** software-recommendation, r
> **Comments:**
> **username_1**: Hi, how is this related to bioinformatics? What have you tried? I don't know if you want your data like in the second plot or like in the first one. Could you provide a some data to test solutions?  

---

## 1 answers

### Answer by username_2 on 2017-11-13. Score: 4

A reverse image search on google leads to the exact code used to produce the second image:
[Xcoarse, Ycoarse] = meshgrid([0 1 2 3], [0 1 2 3]);
[Xfine, Yfine] = meshgrid(linspace(0,3,3000), linspace(0,3,3000));
DataCoarse = [ 1 2 4 1; ...
           6 3 5 2; ...
           4 2 1 5; ...
           5 4 2 3];
DataBicubicFine  = interp2(Xcoarse, Ycoarse, DataCoarse, Xfine, Yfine, 'bicubic');
figure
surf(Xfine, Yfine, DataBicubicFine); shading flat; colormap(jet); view(0, 90)
 hold on; plot3(Xcoarse, Ycoarse, 10*ones(size(Xcoarse)), 'k.', 'MarkerSize', 20)
colorbar
print -dpng -r300 BicubicInterpolationExample.png


---

