# How to force legend only write specification file in modern style

**URL:** <https://forum.generic-mapping-tools.org/t/how-to-force-legend-only-write-specification-file-in-modern-style/1275>\
**Category:** Q&A\
**Created:** [January 27, 2021, 5:27pm UTC](https://forum.generic-mapping-tools.org/t/how-to-force-legend-only-write-specification-file-in-modern-style/1275 "2021-01-27T17:27:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![volkerk](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@volkerk](https://forum.generic-mapping-tools.org/u/volkerk)\
**Post date:** [January 27, 2021, 5:27pm UTC](https://forum.generic-mapping-tools.org/t/how-to-force-legend-only-write-specification-file-in-modern-style/1275/1 "2021-01-27T17:27:23Z")

</div>

Sorry, a further topic. When working with legend in modern style, I can generate different symbol meanings automatically through the -l flag in `gmt plot`; great feature. But if I want to change the appearance of the legend further I get some trouble.

begin gmt  
gmt basemap -JX10/7 -R0/6/-15/1 -Bxa5f1+l"Distance from load centre"+u"\260" -Bya5f1+l"Vertical displacement (m)" -BWSne  
cat a1.dat | gmt plot -JX -Wthin,grey -l"t2 n512 j170"+H"Model"+f"12p,Helvetica-Bold" # to specify legend’s header and header-font  
cat a2.dat | gmt plot -JX -Wthin,red -l"t2 n512 j340"  
cat a3.dat | gmt plot -JX -Wthick,purple,- -l"t1 tefe j1024"  
gmt legend -DjBR+o0.5c -F+gwhite+pthick -S1.3 --FONT\_ANNOT\_PRIMARY=10p,Helvetica -Tleg.txt  
cat leg.txt \> legend.txt  
echo “D 0.2i 1p” \>\> legend.txt # a dummy example  
gmt legend -DjBR+o0.5c -F+gwhite+pthick -S1.3 --FONT\_ANNOT\_PRIMARY=10p,Helvetica legend.txt  
end gmt

In this case both gmt commands plot a legend one onto the other, which has the disadvantage that the second legend command has to generate a legend larger than the first one, and the background (-F+g) cannot be transparent. So, a simple solution is possible, but let the first legend command write to /dev/null would be more consistent. Is there such a feature or a work around in modern-style gmt ?
