# Pygmt.plot possible bug

**URL:** <https://forum.generic-mapping-tools.org/t/pygmt-plot-possible-bug/6267>\
**Category:** PyGMT Q&A\
**Created:** [October 17, 2025, 2:13am UTC](https://forum.generic-mapping-tools.org/t/pygmt-plot-possible-bug/6267 "2025-10-17T02:13:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tonino13](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/tonino13/32/1440_2.png) [@tonino13](https://forum.generic-mapping-tools.org/u/tonino13)\
**Post date:** [October 17, 2025, 2:13am UTC](https://forum.generic-mapping-tools.org/t/pygmt-plot-possible-bug/6267/1 "2025-10-17T02:13:24Z")

</div>

Dear Forum.

I have the pygmt v0.10 installed within anaconda environment. I have a csv file (CANP\_v2.dat) which contains data from a seismic fault.

I tried to plot and the results looks like my points from the csv close a polygon (output.png).

This is the code:

```auto
import os
import pygmt
import pandas as pd
import numpy as np

region_central = [-66.704, -63.44, -18.72, -16.51]  

grid = pygmt.datasets.load_earth_relief(resolution="03s", 
                                        region=region_central)
                                        
dgrid = pygmt.grdgradient(grid=grid, azimuth=270, normalize="e")

fig = pygmt.Figure()

pygmt.makecpt(cmap="geo", series=[float(grid.min()), float(grid.max())], 
                                                           continuous=True)
fig.grdimage(
    grid=grid, 
    projection="M6i",
    region=region_central, 
    frame=["a1f1", "WSne+t'Orocline Faults'",
           "xaf1f0.5+lLongitude", # x-axis: major every 1°, minor 0.5°
           "yaf1f0.5+lLatitude"], # y-axis: major every 1°, minor 0.5°
    shading=dgrid,
    cmap=True
)

# Add political boundaries, coastlines, and water color
fig.coast(
    region=region_central,
    projection="M6i",
    borders="1/1.5p,black", # Country borders
    shorelines="1/0.8p,black", # Coastline
    water="lightblue",
    map_scale="jTR+w50k+o0.4c/0.6c+f",
)

# # --- The CANP --- #
df_canp = pd.read_csv("/home/asus/Documents/PyTools/Points/PrincipalFaults/CANP_v2.csv", delimiter=",")  

fig.plot(
     x=df_canp["Lon"],
     y=df_canp["Lat"],
     pen="2p,black",
     )

faultnames = {"CANP" : (-66.603, -16.558),
              "CBE" :(-65.794, -16.738),
              "CFP" : (-66.364, -16.642),
              "MAF" : (-65.010, -17.247)
              }

# # Plot names of faults in squares 

fig.plot(
     x=[lon for lon, lat in faultnames.values()], 
     y=[lat for lon, lat in faultnames.values()], 
     style="s0.2c", 
     color="black", 
     pen="1p,white" 
 )

fig.text(
     text=list(faultnames.keys()),
     x=[lon for lon, lat in faultnames.values()], 
     y=[lat for lon, lat in faultnames.values()], 
     font="8p,Helvetica-Bold,black",
     justify="LM",  
     fill="white@60", 
     offset="0.2c/0c" 
 ) 
 
fig.show()

```

This is the output using pygmt.plot (see the solid black line):

 ![NotGood-min](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/0/096e4e0d4e37ecb5991b0f46c792113d8ed7270f.jpeg)

However, If I use Matplotlib I have the fault as it is (good\_plot.png)

 ![good_plot](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/d/d89753407a8b2372d4aec00f8f7189652ec779c9.png)

Any idea is appreciated  
[CANP\_v2.dat](https://forum.generic-mapping-tools.org/uploads/short-url/sTfgsuQI1OBHJRATi0Ao80C6TT1.dat) (4.4 KB)

---

<div class="post-metadata">

**Author:** ![yvonnefroehlich](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/yvonnefroehlich/32/5064_2.png) [@yvonnefroehlich](https://forum.generic-mapping-tools.org/u/yvonnefroehlich)\
**Post date:** [October 17, 2025, 12:25pm UTC](https://forum.generic-mapping-tools.org/t/pygmt-plot-possible-bug/6267/2 "2025-10-17T12:25:42Z")

</div>

Hi @tonino13,

```python
fig.plot(
     x=df_canp["Lon"],
     y=df_canp["Lat"],
     pen="2p,black",
     )

```

In case you like to plot your data points as symbols you have to use the `style` parameter, e.g., `style="c0.2c"` for circles with a size of 0.2 centimeters. If you _only_ use `pen` the data points are connected by lines. In combination with `style`, `pen` sets the outline of the symbol. The `fill` parameter allows to fill the symbol with a color, e.g., `fill= "blue"`.

BTW we just released v0.17.0 🙂 .

---

<div class="post-metadata">

**Author:** ![tmerry1](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/tmerry1/32/4989_2.png) [@tmerry1](https://forum.generic-mapping-tools.org/u/tmerry1)\
**Post date:** [October 20, 2025, 9:40am UTC](https://forum.generic-mapping-tools.org/t/pygmt-plot-possible-bug/6267/3 "2025-10-20T09:40:56Z")

</div>

The problem is in your csv — lines 2–59 should be sequentially after lines 60–288 (note that line 288 is practically the same as line 2). I think the line joining the points defined by line 59 and line 60 is probably the problem.

---

<div class="post-metadata">

**Author:** ![tonino13](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/tonino13/32/1440_2.png) [@tonino13](https://forum.generic-mapping-tools.org/u/tonino13)\
**Post date:** [October 22, 2025, 12:50am UTC](https://forum.generic-mapping-tools.org/t/pygmt-plot-possible-bug/6267/4 "2025-10-22T00:50:01Z")

</div>

@tmerry1 true, thank you for your time reviewing the csv file
