Skip to content

Explore separate MAP_ANNOT_OBLIQUE settings for oblique and other projections #4890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 3, 2021

Conversation

PaulWessel
Copy link
Member

This PR to be merged into gmt-themes sets the new default for MAP_ANNOT_OBLIQUE to be lon_horizontal,lat_horizontal,tick_extend but we then proceed to reset this to the previous default anywhere if the projection/region is not oblique, unless the user manually changed the setting.

With this scheme I get happy results for things like

gmt basemap -R-200/200/-200/200+uk -JOa8/88/46/15c -T8/87/3c -Bxa5fg -Bya1fg -BNSWE -png a
gmt basemap -R0/20/0/20 -JM6i -B -png b
gmt basemap -R-180/-20/0/90 -JPoly/10c -Bx30g10 -By10g10 -png c
gmt basemap -Rg -JH0/15c -Ba30fg -BWSNE -png d

See what you think, @meghanrjones. Note I also upped the ANNOT_MIN_SPACING default to 28p (~1 cm) since the annotations for plot a are horizontal and it needs more space to not overprint widely. Also note that my caveat about subplot seems to have been premature. To place latitudes for rectilinear projections parallel to the border we require -SR...+p anyway. That seems to work still with this PR:

gmt begin t pdf
  gmt subplot begin 2x2 -Fs3i -M5p -A -SCb -SRl+p -Bwstr -R-11/11/-11/11 -JM3i
    gmt basemap
    gmt basemap -c
    gmt basemap -c
    gmt basemap -c
  gmt subplot end
gmt end show

Apart from setting the new defaults in gmt_init.c, the reset takes place in gmtmap_reset_oblique_settings in gmt_map.c.

…jections

This PR to be merged into gmt-themes sets MAP_ANNOT_OBLIQUE to be lon_horizontal,lat_horizontao,tick_extend but will reset this to the previous default anywhere unless the user manually changed the setting.
@PaulWessel PaulWessel requested a review from maxrjones March 3, 2021 01:31
@PaulWessel PaulWessel self-assigned this Mar 3, 2021
@vercel
Copy link

vercel bot commented Mar 3, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/gmt/gmt/EntyYKj8NWWXadruSbkAEPvknJZJ
✅ Preview: https://gmt-git-resetobliquedef-gmt.vercel.app

Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -C option for begin does not work with this implementation for MAP_ANNOT_OBLIQUE (it still works for other parameters). For example this produces a plot with lon_horizontal,lat_horizontal for MAP_ANNOT_OBLIQUE:

gmt set MAP_ANNOT_OBLIQUE=lon_horizontal,lat_horizontal
gmt begin test ps -C
        gmt coast -R0/360/-80/80 -JT180/-30/6i -Glightgray -A1000 -Ba60g60
gmt end show

@maxrjones
Copy link
Member

Increasing MAP_ANNOT_MIN_SPACING brings back this problem for secondary and primary axes:

gmt coast -W -RDE+R10m -Bpa30m+f -Bsa1d -JL10.5/51/49/53/17c -N1/1p,darkred -Saliceblue -png mapDEmodern --GMT_THEME=modern

@PaulWessel
Copy link
Member Author

Right. So clearly, if users insist on specifying their own very small -B intervals then this can happen anywhere for any nonzero default min spacing. If we shrink it from 1cm to 24p then it is OK, but then we get a bit of overlap in the -Joa plot.

In any case, it seems we should report to the user when we skip an annotation due to crowdedness and remind them they can control this via that setting. I don't think we do any reporting now but being told 5 annotations were suppressed due to a proximity to other annotations set by spacing = xxxp would be helpful I think.

@maxrjones
Copy link
Member

Right. So clearly, if users insist on specifying their own very small -B intervals then this can happen anywhere for any nonzero default min spacing. If we shrink it from 1cm to 24p then it is OK, but then we get a bit of overlap in the -Joa plot.

In any case, it seems we should report to the user when we skip an annotation due to crowdedness and remind them they can control this via that setting. I don't think we do any reporting now but being told 5 annotations were suppressed due to a proximity to other annotations set by spacing = xxxp would be helpful I think.

Yes, I agree that the main problem is when the user does not know why the annotations are not plotted. A warning is a good solution.

@PaulWessel
Copy link
Member Author

I should probably add that in master since I do not now where this particular PR will go in the end.

@PaulWessel
Copy link
Member Author

The -C option for begin does not work with this implementation for MAP_ANNOT_OBLIQUE (it still works for other parameters). For example this produces a plot with lon_horizontal,lat_horizontal for MAP_ANNOT_OBLIQUE:

gmt set MAP_ANNOT_OBLIQUE=lon_horizontal,lat_horizontal
gmt begin test ps -C
        gmt coast -R0/360/-80/80 -JT180/-30/6i -Glightgray -A1000 -Ba60g60
gmt end show

I guess I am confused now. This PR sets the new default for MAP_ANNOT_OBLIQUE=lon_horizontal,lat_horizontal,tick_extend. If you then set MAP_ANNOT_OBLIQUE=lon_horizontal,lat_horizontal then the only difference would be the ticks? I am looking at the plot and do not now what the problem is...

@maxrjones
Copy link
Member

The -C option for begin does not work with this implementation for MAP_ANNOT_OBLIQUE (it still works for other parameters). For example this produces a plot with lon_horizontal,lat_horizontal for MAP_ANNOT_OBLIQUE:

gmt set MAP_ANNOT_OBLIQUE=lon_horizontal,lat_horizontal
gmt begin test ps -C
        gmt coast -R0/360/-80/80 -JT180/-30/6i -Glightgray -A1000 -Ba60g60
gmt end show

I guess I am confused now. This PR sets the new default for MAP_ANNOT_OBLIQUE=lon_horizontal,lat_horizontal,tick_extend. If you then set MAP_ANNOT_OBLIQUE=lon_horizontal,lat_horizontal then the only difference would be the ticks? I am looking at the plot and do not now what the problem is...

You are right, sorry, I mixed up the new settings.

src/gmt_init.c Outdated
@@ -6099,7 +6099,8 @@ GMT_LOCAL void gmtinit_conf_classic (struct GMT_CTRL *GMT) {
GMT->current.setting.given_unit[GMTCASE_MAP_ANNOT_OFFSET_PRIMARY] = 'p';
GMT->current.setting.given_unit[GMTCASE_MAP_ANNOT_OFFSET_SECONDARY] = 'p';
/* MAP_ANNOT_OBLIQUE */
GMT->current.setting.map_annot_oblique = GMT_OBL_ANNOT_ANYWHERE;
//GMT->current.setting.map_annot_oblique = GMT_OBL_ANNOT_ANYWHERE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment rather than remove?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot, will fix.

@PaulWessel PaulWessel merged commit 3da13b3 into gmt-themes Mar 3, 2021
@PaulWessel PaulWessel deleted the reset_oblique_def branch March 3, 2021 21:09
PaulWessel added a commit that referenced this pull request Mar 12, 2021
* Add new GMT_THEME default setting

This will take the name of a separate .conf file that will override the current settings.

* Update names

* Create darkmode.conf

* Wrap up theme machinery

* Update gmt.conf.rst

* Update darkmode.conf

* Play with modern.conf

* Trial modern.conf

* Address comments

* use AvantGarde font

* Bold titles

* Update modern.conf

* Update modern.conf

* Implement auto scaling

* Update modern.conf

* Update gmt_plot.c

* Update gmt_map.c

* smaller offsets

* Let modern have modern defaults

* Update modern.conf

* Updates

* Leave gridlines black and lines with butt cap

* Update inverse and darkmode to be modern

* Move the auto-font-size function to gmt_init.c

* Allow --PAR-value overrides for auto scaling

* Update gmt_init.c

* Improve scripts in general

* Update scripts and fix internals

* Eliminate unneeded gmt set calls

* Update gmt_init.c

* Update gmt_init.c

* Use auto <--> NaN in gmt.conf parsing

* Update gmt_init.c

* Use NaN for undefined font size as well

* Eliminate unneeded MAP_AUTO_SCALE

* Update docs

* Update subplot.c

* Update psscale.c

* update undefined defaults at end of GMT_Parse_Common

That is when we are done parsing any --PAR=value options

* Fix subplot with WrStZ defaults under modern

HEre, if we have W and a panel should not be annotated and w is not selected, then it should be l if either W or l is in the defaults.  Some with b of S or b is in the default.

* Let MAP_ANNOT_MIN_SPACING join the auto-scaled items

Nominally 36p, it now is auto and will scale with the primary fontsize.

* Do not let gmtset expand auto to anything

* Fix vector shape init

* protect sides in psscale.

The resetting interfered with auto-annotation of colorbars.

* Update gmt_init.c

* Fix pstext to initialize default font

* Forgot to update the theme in gmtinit_conf_modern_override (#3508)

This function is called when modern theme is selected in classic or always in modern.  But it failed to actually set the GMT_THEME variable so in classic mode it reverted to classic before writing out the theme.

* Lengthen ticks and slightly increase font size

* Fix multiple addition of frame width

* Update gmt_init.c

* Update gmt_init.c

* Update inverse.conf

* Update gmt_init.c

* Fix auto setting for MAP_FRAME_WIDTH

* Update modern theme and add minimal theme (#4596)

* Change modern default MAP_FRAME_TYPE to fancy

* Make Helvetica default font for modern theme

* Remove return from gmtinit_conf_modern_override

* Fix typo

* Add minimal theme

* Make modern font heading and title bold

* Remove unfinished themes darkmode, inverse, movie

* Update doc/rst/source/gmt.conf.rst

Co-authored-by: Meghan Jones <[email protected]>

* Update src/gmt_init.c

Co-authored-by: Meghan Jones <[email protected]>

* Update doc/rst/source/cookbook/features.rst

Co-authored-by: Dongdong Tian <[email protected]>

* Update doc/examples/ex41/ex41.sh

Co-authored-by: Dongdong Tian <[email protected]>

* Remove MAP_ANNOT_MIN_SPACING auto-scaling (#4704)

* Update doc/scripts/GMT_TM.sh

* Add auto-scaling for new subtitle font as well

* Testing a GMT_THEME off solution (#4710)

* Testing a GMT_THEME off solution

Goal is to allow suers to override specifics in the theme settings without having the THEME be parsed again and overwrite the changes

* Update gmt_init.c

* Themes autoaxes (#4715)

* Aadd auto mode for GMT_MAP_AXES

The default choice may need to depend on view-angle, if azimuthal or cylindrical, etc.

* Handle polar and rotated schemes

* Update gmt_init.c

* Subplot axes (#4720)

* Better interplay between -S and MAP_FRAME_AXES

WHen -S is used for rows or cols then we should let it do its thing, not parse MAP_FRAME_AXES.  If not set then we do.

* Deal with subplot-specific gmt.conf settings

Must create a gmt.conf for a subplot if modern theme so that all fonts etc will be the same across all panels.

* Progress on auto axes and subplots

* COmments

* Fix delayed get_scale calls

* Update pslegend.c

* Update pslegend.c

* Update psscale.c

* Update pslegend.c

* Update GMT_legend.sh

* Use geometric mean of plot dimensions for reference, and delete temp files

* Allow testing of classic only via -DNO_THEMES

* Update gmt_map.c

* Update documentation for gmt themes (#4717)

* List all parameters alphabetically

* Start descriptions for themes and auto settings

* Complete auto scaling documentation

* Add FONT_SUBTITLE to tables

* Fix classic default

* Update auto scaling description

* Fix font settings

* Update FONT_SUBTITLE default

* Update MAP_TICK_PEN_PRIMARY default docs

* Update theme dependent defaults

* Fix a typo

* Format defaults documentation

* Move theme-settings to separate docs page

* Update auto scaling links

* Update auto scaling documentation

* Link themes table to gmt.conf keywords

* Add more links between auto, gmt.conf, and themes

* Fix formatting

* Update MAP_ANNOT_MIN_SPACING default

* Format doc/rst/source/cookbook/features.rst

* Update auto-scaling docs for unknown dimensions

* Update doc/scripts/GMT_dir_rose.sh

* Remove trailing whitespace

* Handle gmt set GMT_THEME classic in a modern session (#4726)

* Handle gmt set GMT_THEME classic in a modern session

Since modern defaults have been set, this PR will flag all the defaults that differ between classic and modern themes so they are updated.

* Update src/gmt_init.c

Co-authored-by: Meghan Jones <[email protected]>

* Update GMT_legend.sh test

* Add NO_THEMES definition to template

* Update GMT_Defaults_1b.sh test

* Update position for anim02.sh

* Update TMcontours.sh test

* Init frame_width before using it to init tick length

Fixes the problem with sphareacentroid.sh and possibly others

* Add auto scaling for MAP_ANNOT_MIN_SPACING

* Auto for MAP_POLAR_CAP (#4854)

* Let POLAR_CAP be auto under modern mode

* Update and add docs

* Update themes.conf files

* Add comments

* Update docs for MAP_POLAR_CAP=auto

Co-authored-by: Meghan Jones <[email protected]>

* Setup map before histogram autolegend

* Explore separate MAP_ANNOT_OBLIQUE settings for oblique and other projections (#4890)

* Explore separate MAP_ANNOT_OBLIQUE settings for oblique and other projections

This PR to be merged into gmt-themes sets MAP_ANNOT_OBLIQUE to be lon_horizontal,lat_horizontao,tick_extend but will reset this to the previous default anywhere unless the user manually changed the setting.

* UPdate

* Reset map_annot_oblique_set when we reset settings

* Update gmt_init.c

* Update gmt_init.c

* Update subplot tests

* Change warnings to debug messages

* Improve spacing for anim05.sh

* Use consistent font size for ex49.sh

* Update share/themes based on gmt_init.c

* Update gmt.conf.rst

* Update gmt-themes docs

* Update PS files for -B scripts

* Add cookbook theme

* Set GMT_THEME=cookbook for doc/scripts

* Update PostScript tests

* Update failing test

* Update failing test

* Update postscript files

* Update failing tests

* Update GMT_cycle_1.sh

* Update symbol_orientation PS files

Both differ from origs but are good. Origs updated.

* Update ps for ex23 and ex49

Co-authored-by: Meghan Jones <[email protected]>
Co-authored-by: Meghan Jones <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants