Repository navigation
Missing alias for option -F in basemap #1893
Description
Description of the problem
I am trying to add a filled background behind my mapscale, similar to the examples in the GMT documentation here: https://docs.generic-mapping-tools.org/dev/cookbook/features.html#placing-map-scales. From what I understand, when adding the map_scale, I should be able to simultaneously add a frame option specifying the fill parameters, like in my example code below, using the options from the GMT documentation. The code below runs when 'frame' isn't specified, but of course no background is generated behind the map_scale. I would be very appreciative if someone could point me in the right direction or let me know if this is in fact a bug. Thanks!
Full code that generated the error
import pygmt
fig = pygmt.Figure()
fig.coast(
# Set the x-range from 10E to 20E and the y-range to 35N to 45N
region=[10, 20, 35, 45],
projection="M12c",
land="lightgray",
water="white",
borders="1/0.5p",
shorelines="1/0.5p",
frame="ag",
)
fig.basemap(map_scale='jBR+c36N+w100k+l+f', frame='+p1p+i+gwhite+c0.1i')
fig.show()Full error message
pygmt.exceptions.GMTCLibError: Module 'basemap' failed with status code 72:
basemap [ERROR]: Option -B: Found frame setting modifiers (+b|g|i|n|o|t|w|x|y|z) mixed with axes settings!
basemap [ERROR]: Option -B parsing failure. Correct syntax:
basemap [ERROR]: Offending option -B+p1p+i+gwhite+c0.1i
System information
Please paste the output of python -c "import pygmt; pygmt.show_versions()":
PyGMT information:
version: v0.6.1
System information:
python: 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:24:38) [Clang 12.0.1 ]
executable: /opt/homebrew/Caskroom/miniforge/base/bin/python
machine: macOS-12.3.1-arm64-arm-64bit
Dependency information:
numpy: 1.22.3
pandas: 1.4.2
xarray: 2022.3.0
netCDF4: 1.5.7
packaging: 21.3
geopandas: 0.10.2
ghostscript: 9.56.1
gmt: 6.3.0
GMT library information:
binary dir: /opt/homebrew/Caskroom/miniforge/base/bin
cores: 10
grid layout: rows
library path: /opt/homebrew/Cellar/gmt/6.3.0_2/lib/libgmt.dylib
padding: 2
plugin dir: /opt/homebrew/Cellar/gmt/6.3.0_2/lib/gmt/plugins
share dir: /opt/homebrew/Cellar/gmt/6.3.0_2/share/gmt
version: 6.3.0
Activity
welcome commentedon Apr 22, 2022
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.
michaelgrund commentedon Apr 22, 2022
The background color of the scale can be defined via the
-Fflag for which no alias is available so far in PyGMT. So, the following will do the job:jackbeagley commentedon Apr 22, 2022
Far out that was easy... thanks @michaelgrund! @seisman what would this look like as a feature request? Could we have a method specifically for making map_scales? something like
fig.map_scale(...)?seisman commentedon Apr 22, 2022
We just need to add an alias
F="box"to the@use_aliasdecorator in thebasemapfunction:pygmt/pygmt/src/basemap.py
Lines 17 to 34 in 555cd31
then you can use:
jackbeagley commentedon Apr 22, 2022
This seems very straightforward... are you happy if I have a crack at it?
[-]Can't generate a filled in frame behind map_scale[/-][+]Missing alias for option -F in basemap[/+]