# How to plot density mapping with pygmt

**URL:** https://forum.generic-mapping-tools.org/t/how-to-plot-density-mapping-with-pygmt/4528
**Category:** PyGMT Q&A
**Created:** [December 20, 2023, 2:37am UTC](https://forum.generic-mapping-tools.org/t/how-to-plot-density-mapping-with-pygmt/4528 "2023-12-20T02:37:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wensentry](https://avatars.discourse-cdn.com/v4/letter/w/fbc32d/32.png) [@wensentry](https://forum.generic-mapping-tools.org/u/wensentry)
#### Post date: [December 20, 2023, 2:37am UTC](https://forum.generic-mapping-tools.org/t/how-to-plot-density-mapping-with-pygmt/4528/1 "2023-12-20T02:37:07Z")

</div>

Hi everyone, I want to use the density map to count the pixel values in the image data, can pygmt plot the density map? As shown in the figure below:

 ![Figure_2](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/2/2906e1d45e1deb6e0bf26364b79a07caf34f6ed1.png)

The image data is as follows:  
[data.tif](https://forum.generic-mapping-tools.org/uploads/short-url/uAOmcJ20INpbEheVME6thFu3V3u.tif) (156.7 KB)

---

<div class="post-metadata">

### Author: ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)
#### Post date: [December 20, 2023, 2:43pm UTC](https://forum.generic-mapping-tools.org/t/how-to-plot-density-mapping-with-pygmt/4528/2 "2023-12-20T14:43:40Z")

</div>

> [@wensentry](#):
>
> density map to count the pixel values in the image data

Although I suspect the answer is no, you really need to clarify what you mean with the above.

---

<div class="post-metadata">

### Author: ![wensentry](https://avatars.discourse-cdn.com/v4/letter/w/fbc32d/32.png) [@wensentry](https://forum.generic-mapping-tools.org/u/wensentry)
#### Post date: [December 20, 2023, 2:58pm UTC](https://forum.generic-mapping-tools.org/t/how-to-plot-density-mapping-with-pygmt/4528/3 "2023-12-20T14:58:39Z")

</div>

Thank you @Joaquim, I’ve solved the problem.
