# Cross section doubts

**URL:** <https://forum.generic-mapping-tools.org/t/cross-section-doubts/3601>\
**Category:** PyGMT Q&A\
**Created:** [January 11, 2023, 2:34am UTC](https://forum.generic-mapping-tools.org/t/cross-section-doubts/3601 "2023-01-11T02:34:36Z")\
**Posts on this page:** 2\
**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:** [January 11, 2023, 2:34am UTC](https://forum.generic-mapping-tools.org/t/cross-section-doubts/3601/1 "2023-01-11T02:34:36Z")

</div>

Dear Experts,

I’ve been working with the example from:  
`1. https://flint.soest.hawaii.edu/t/help-me-with-cross-section-plot/2391/4`

So my example it is like this:

```
# /// Hypocenters /// # 

df_hyps = pd.read_csv('/home/asus/Documents/Pdoc_res/Catas/example.dat', 
                      delimiter=',')
pygmt.makecpt(cmap='haxby', series=[df_hyps.Depth.min(), 
                                    df_hyps.Depth.max()], reverse = True)

fig.plot(x=df_hyps.Lon, y=df_hyps.Lat, 
         size=0.15*(1.45**df_hyps.Mag), style='cc', 
         color=df_hyps.Depth, cmap= True, pen='0.5p,black')

# /// The line projection ///

fig.plot(x=[-66.74, -65.52], y=[-17.57, -17.10], projection="M", pen=2)
fig.text(x=-66.78, y=-17.53, text="A", font="15,Helvetica")
fig.text(x=-65.38, y=-16.92, text="B", font="15,Helvetica")

# /// Stations /// #

df_pobbb = pd.read_csv(r'/home/asus/Documents/PyTools/places/POB_BB.dat')
fig.plot(x=df_pobbb.Lon, y=df_pobbb.Lat, style="t0.33c", pen="1.0p,yellow", 
         color='black')

df_pobsp = pd.read_csv(r'/home/asus/Documents/PyTools/places/POB_SP.dat')
fig.plot(x=df_pobsp.Lon, y=df_pobsp.Lat, style="t0.33c", pen="1.0p,yellow", 
         color='black')

fig.colorbar(frame=["x+lDepth", "y+lkm"], position="JMR+o0.5c/0c+w8c")
#%%

# --- The projection --- #

pygmt.project(
    data="/home/asus/Documents/Pdoc_res/Catas/example.dat",
    unit=True,
    center=[-66.74, -17.57], 
    endpoint=[-65.52, -17.10],
    convention="pz",
    width=[-100, 100],
    outfile="/home/asus/Documents/Pdoc_res/Catas/cross.dat",
)
fig.basemap(
    projection="X10/-6",
    region=[0, 250, -5, 70],
    frame=['xafg50+l"Distance"', 'yafg25+l"Depth"', "WSen"],
    yshift=-7,
)

fig.plot(data="/home/asus/Documents/Pdoc_res/Catas/cross.dat", 
         projection="X", style="c0.2", pen=1, color="red")

```

However, I have an empty cross section profile. What did I do wrong? (I attach the example.dat file and the result).  
[example.dat](https://forum.generic-mapping-tools.org/uploads/short-url/ekc8C0DpyqltwBQDDusgm575vVE.dat) (2.4 KB)  
Stay safe and b est regards

 ![230110_CrossSection_v1a_MayToSept_2022](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/4/4c134adc8c300d4ce8848561f79adc2047f18e71.png)

---

<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:** [January 12, 2023, 2:44am UTC](https://forum.generic-mapping-tools.org/t/cross-section-doubts/3601/2 "2023-01-12T02:44:00Z")

</div>

Dear All,  
I noted that the data\_input for `pygmt.project` must be in the format `LON, LAT, DEPTH`, so the Cross.out file will not be empty.  
Stay safe and best regards,  
Tonino
