# Problem in plot

**URL:** <https://forum.generic-mapping-tools.org/t/problem-in-plot/5027>\
**Category:** PyGMT Q&A\
**Tags:** gmt\
**Created:** [June 27, 2024, 4:20pm UTC](https://forum.generic-mapping-tools.org/t/problem-in-plot/5027 "2024-06-27T16:20:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prof-Mostafa-Thabet](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/prof-mostafa-thabet/32/4105_2.png) [@Prof-Mostafa-Thabet](https://forum.generic-mapping-tools.org/u/Prof-Mostafa-Thabet)\
**Post date:** [June 27, 2024, 4:20pm UTC](https://forum.generic-mapping-tools.org/t/problem-in-plot/5027/1 "2024-06-27T16:20:02Z")

</div>

Hello everyone, my problem is that countering is not smooth, I want to eliminate point shapes as indicated by A2, A3, A5, A6, and A7 in the SECTION.png.  
Using grdimage, I tried many options of interpolation, but no way.  
I am deeply hoping to get a solution.

I appreciate any help you can provide.  
my code and data are attached below.

 ![SECTION](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/2/2a321e7b434f5c5db33278dce8b0a613a3ddf96f.png)  
[x-y-z.TXT](https://forum.generic-mapping-tools.org/uploads/short-url/uTajy1aN3ggcuKCRGaCDuUeYaYI.TXT) (632.0 KB)

```python
import pygmt
with open("x-y-z.TXT", "r") as file2:
    xyz_coords = [list(map(float, line.split())) for line in file2]
x_coords2 = [point[0] for point in xyz_coords]
y_coords2 = [point[1] for point in xyz_coords]
z_coords2 = [point[2] for point in xyz_coords]

regions = [0.0, 20000, 0, 4000]
frames = "af"
dpis = '50'
bitcolors = '255'
projections = "X10i/-3i"

fig = pygmt.Figure()

data = pygmt.blockmean(x=x_coords2, y=y_coords2, z=z_coords2, spacing=(10, 10), region=regions)
grid = pygmt.surface(data=data, spacing=(10, 10), lower='30', upper='3900', region=regions)

with pygmt.config(FONT_LABEL='9', FONT_ANNOT_PRIMARY='6', MAP_LABEL_OFFSET='0.1', MAP_ANNOT_OFFSET_PRIMARY='0.001',
                  MAP_FRAME_PEN='0.7',FONT_ANNOT_SECONDARY='9'):
    fig.grdimage(grid=grid, projection=projections, interpolation="b", cmap="no_green", dpi=dpis, bitcolor=bitcolors)
    fig.colorbar(frame=["a1000", "y+lz"], truncate=[30, 3900], position = "x0.0/-0.6+w7c/0.3c+h")
    fig.basemap(region=regions, projection=projections, frame=["WsNe","xaf+lx","ya1000f500+ly"])

fig.savefig("SECTION.png")
fig.show()

```

---

<div class="post-metadata">

**Author:** ![mkononets](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mkononets/32/4029_2.png) [@mkononets](https://forum.generic-mapping-tools.org/u/mkononets)\
**Post date:** [June 27, 2024, 9:00pm UTC](https://forum.generic-mapping-tools.org/t/problem-in-plot/5027/2 "2024-06-27T21:00:07Z")

</div>

your profile data look not good for what you are doing, many identical values with abrupt stepwise changes. plot and check the individual profiles or just scroll through your text file.

in other words, you should do something with your data and/or adjust interpolation method (`surface`) and probably test interpolation methods other than `surface`. This is nothing `grdimage` can help you with.

see [example 16](https://docs.generic-mapping-tools.org/latest/gallery/ex16.html) maybe also example 12 and 14 in the gmt illustration gallery. The example data is nothing like yours (example data are arbitrarily spaced while your are not) but you can get some idea of how you can choose and adjust interpolation method.
