# Trouble plotting labels on lines

**URL:** <https://forum.generic-mapping-tools.org/t/trouble-plotting-labels-on-lines/249>\
**Category:** Q&A\
**Created:** [February 17, 2020, 1:46am UTC](https://forum.generic-mapping-tools.org/t/trouble-plotting-labels-on-lines/249 "2020-02-17T01:46:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasondec](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@jasondec](https://forum.generic-mapping-tools.org/u/jasondec)\
**Post date:** [February 17, 2020, 1:46am UTC](https://forum.generic-mapping-tools.org/t/trouble-plotting-labels-on-lines/249/1 "2020-02-17T01:46:58Z")

</div>

Hello GMTers.  
I’m having trouble plotting “quoted” lines in GMT6 modern-mode with the ‘plot’ command and the -Sq flag. I wonder what I’m getting wrong - or if I’ve encountered a bug. Any thoughts? Using GMT v6.0.0 via anaconda on OSX.

What I’m expecting:  
The lines will plot with labels “A” and “B”, respectively. One label per line.

What I’m getting:  
The lines are plotting with the label "N/A’ printed on both lines. One label per line.

Here’s my code, simplified:

```bash
#!/bin/bash
gmt begin test_line_labels png
    gmt basemap -R0/100/0/100 -B
    gmt plot -Sqn1+Lh <<EOF
> "A"
40 50
89 89
> -LB
10 10
80 30
EOF
gmt end

```

 ![test_line_labels](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/54d68ec92a9a89b57d032129c563e25244e60160.png)

I’m basing my expectation on the doc page below. Trying both the “scan for an embedded -Llabel option” and the “use the first word following the segment” option.  
[http://gmt.soest.hawaii.edu/doc/latest/plot.html?highlight=plot#l](http://gmt.soest.hawaii.edu/doc/latest/plot.html?highlight=plot#l)  
(viewed 2020-02-15)

```auto
+Lflag

    Sets the label text according to the specified flag:

```

```auto
    +Lh Take the label from the current segment header (first scan for an embedded -Llabel option, if not use the first word following the segment flag). 
For multiple-word labels, enclose entire label in double quotes. 

```

---

<div class="post-metadata">

**Author:** ![jasondec](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@jasondec](https://forum.generic-mapping-tools.org/u/jasondec)\
**Post date:** [February 17, 2020, 1:57am UTC](https://forum.generic-mapping-tools.org/t/trouble-plotting-labels-on-lines/249/2 "2020-02-17T01:57:47Z")

</div>

Aaaannnnd I figured it out immediately after posting this question.  
For anyone else encountering this issue, there needs to be a “colon” [:] to separate the label information (the +Lh) from the placement statement (n1). So,

```auto
gmt plot -Sqn1:+Lh

```

Although it’s subtle, this is stated in the docs

```auto
-Sq.  
quoted line, i.e., lines with annotations such as contours. Append [d|D|f|l|L|n|N|s|S|x|X]info[:labelinfo]. The required argument controls the placement of labels along the quoted lines. Choose among six controlling algorithms:

```

Perhaps the need for this colon could be more explcitly stated in the docs to avoid confusion. Thanks.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [February 17, 2020, 2:24am UTC](https://forum.generic-mapping-tools.org/t/trouble-plotting-labels-on-lines/249/3 "2020-02-17T02:24:12Z")

</div>

Thanks, I have added a line to alert users to the need for the colon.
