From 87f01602eca19ccd4a12e60b13a8ddd24b35d30d Mon Sep 17 00:00:00 2001 From: Paul Wessel Date: Sat, 16 Oct 2021 17:14:44 -1000 Subject: [PATCH 1/3] Add -B modifier to skip annotation(s) at end of axis When composing multible frames or plots, expecially with y-annotations parallel to the axis, it is convenient to be able to skip plotting the annotations that land exactly at the end of an axis (or just one end). This is difficult todo in GMT without changing -R (say -R0/0.9999 instead of -R0/1) but that is not a satisfactory solution. The new axis modifier +e[l|h] will turn off both or just the lower or upper annotation if it lands at the end of the axis. I have added a simple test script to illustrate the effect and ensure it works. --- doc/rst/source/explain_-B.rst_ | 4 +++- src/gmt_constants.h | 5 +++++ src/gmt_init.c | 33 +++++++++++++++++++++++---------- src/gmt_parse.c | 2 +- src/gmt_plot.c | 16 +++++++++++++--- src/gmt_project.h | 1 + test/psbasemap/skipannots.ps | Bin 0 -> 46224 bytes test/psbasemap/skipannots.sh | 19 +++++++++++++++++++ 8 files changed, 65 insertions(+), 15 deletions(-) create mode 100644 test/psbasemap/skipannots.ps create mode 100755 test/psbasemap/skipannots.sh diff --git a/doc/rst/source/explain_-B.rst_ b/doc/rst/source/explain_-B.rst_ index 136194d1bc7..95e32b6374e 100644 --- a/doc/rst/source/explain_-B.rst_ +++ b/doc/rst/source/explain_-B.rst_ @@ -95,7 +95,7 @@ The Axes settings are specified by but you may also split this into two separate invocations for clarity, i.e., - | **-B**\ [**p**\|\ **s**][**x**\|\ **y**\|\ **z**][**+a**\ *angle*\|\ **n**\|\ **p**][**+f**]\ + | **-B**\ [**p**\|\ **s**][**x**\|\ **y**\|\ **z**][**+a**\ *angle*\|\ **n**\|\ **p**][**+e**\ [**l**\|\ **u**]][**+f**]\ [**+l**\|\ **L**\ *label*][**+p**\ *prefix*][**+s**\|\ **S**\ *seclabel*][**+u**\ *unit*] | **-B**\ [**p**\|\ **s**][**x**\|\ **y**\|\ **z**]\ *intervals* @@ -110,6 +110,8 @@ The following modifiers can be appended to **-B** to control the Axes settings: - **x**\|\ **y**\|\ **z** to set which axes the modifiers apply to [default is **xy**]. If you wish to give different annotation intervals or labels for the various axes then you must repeat the **B** option for each axis. For a 3-D plot with the **-p** and **-Jz** options used, **-Bz** can be used to provide settings for the verical axis. +- **+e** to give skip annotations that fall exactly at the ends of the axis. Append **l** or **u** to only + skip the lower or upper annotation, respectively. - **+f** (for geographic axes only) to give fancy annotations with W\|\ E\|\ S\|\ N suffices encoding the sign. - **+l**\|\ **+L**\ *label* (for Cartesian plots only) to add a label to an axis. **+l** uses the default label orientation; **+L** forces a horizontal label for *y*-axes, which is useful for very short labels. diff --git a/src/gmt_constants.h b/src/gmt_constants.h index 570ce6ccba1..18fa3e401c7 100644 --- a/src/gmt_constants.h +++ b/src/gmt_constants.h @@ -340,6 +340,11 @@ enum GMT_time_period { /* Valid options to psconvert from figure and begin */ #define GMT_PSCONVERT_LIST "ACDEHIMNQS" +/* Valid frame setting modifiers */ +#define GMT_FRAME_LIST "bginotwxyz" +/* Valid axis setting modifiers */ +#define GMT_AXIS_LIST "aefLlpsSu" + /* Settings for usage message indents and break/continue characters */ #define GMT_LINE_BREAK "\xe2\x8f\x8e" /* Glyph for return symbol in UTF-8 */ diff --git a/src/gmt_init.c b/src/gmt_init.c index 871708501fa..c6353672174 100644 --- a/src/gmt_init.c +++ b/src/gmt_init.c @@ -4367,9 +4367,10 @@ GMT_LOCAL int gmtinit_parse5_B_option (struct GMT_CTRL *GMT, char *in) { * Axis settings: * -B[p|s][x|y|z] * where is of the format - * [+a|n|p][+L|l