Repository navigation
Description
In GMT, -B+n means not plotting any sides of the frame. It's very useful when we want to set the projection and region only without any frames. The GMT source code for parsing the -B option is too complicated to understand, but from what I see, -B+n only works without any other -B settings (e.g., +n setting is ignored if -BWSen+n is used). This can be verified by the following script (colorbar and rose are also used here because the no_frame setting is explicitly used in their source codes):
gmt begin map
gmt basemap -R0/10/0/10 -JX5c -Bafg
gmt colorbar -DJBC+w5c/0.5c+o0c/1c+h -Cjet
gmt basemap -R0/10/0/10 -JX5c -Bafg -B+n -Xw+1
gmt colorbar -DJBC+w5c/0.5c+o0c/1c+h -Cjet -Baf
gmt basemap -R0/10/0/10 -JX5c -Bafg -BWSEN+n -Xw+1
gmt colorbar -DJBC+w5c/0.5c+o0c/1c+h -Cjet -Baf -B+n
gmt basemap -R0/10/0/10 -JX5c -B+n -Xw+1
gmt colorbar -DJBC+w5c/0.5c+o0c/1c+h -Cjet -B+n
gmt rose @azimuth_lengths.txt -: -A5 -JX5c -F -L -Glightblue -R0/1/0/180 -Bxaf+l"Fault length" -Byg30 -S -X-17c -Y7c
gmt rose @azimuth_lengths.txt -: -A5 -JX5c -F -L -Glightblue -R0/1/0/180 -Bxaf+l"Fault length" -Byg30 -B+n -S -Xw+1
gmt rose @azimuth_lengths.txt -: -A5 -JX5c -F -L -Glightblue -R0/1/0/180 -B+n -S -Xw+1
gmt end showThen, what's the Pythonic implementation for -B+n? In PR #4016, we're working on the Frame/Axis class, which wraps the complicated -B option. Of course, we can implement something like Frame(noframe=True), but it looks tedious and is not intuitive.
I think there are a few different implementations for -B+n:
- Add a standalone parameter like
noframe=True(orno_frame=True). If I understand it correctly, GMT.jl also implements it similarly (see https://www.generic-mapping-tools.org/GMTjl_doc/documentation/common_opts/common_opts.html). Its usage isframe=(noframe=True,). - Map
frame="none"to-B+n. It seems GMT.jl also supports it (frame=:none). - Let
frame=Falsemean no frame. Previously,frame=Falsemeant-Bis not set, so it breaks backward compatibility.
I feel option 2 is the simplest to implement and is also intuitive. What do you think? @GenericMappingTools/pygmt-maintainers
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone

Activity
yvonnefroehlich commentedon Feb 9, 2026
Oh yes, I agree this +n option is great and very useful and often better than doing something like
+gwhite@100, as the figure is also cut. I believe this is something that is relatively new in GMT; I was missing this at the beginning of my PhD time.frame=(noframe=True)has a bit of using double negatives.frame="none"is clearer asframe=False, as frame is not a binary parameter (in contrast to, e.g.,no_clip)seisman commentedon Feb 10, 2026
In PR #4404, I've implemented
frame="none"to mean no frame. However, it should be noted that the current behavior offrame=True,frame=False, andframe=Nonevaries inconsistently across GMT modules.The behavior after PR #4404
basemapcolorbar/rosecoast)frame=False/frame=None(no-B)frame=True(-B)frame="none"(-B+n)*
-Bis required except in subplot mode, especially after-D/-L/-Tare deprecatedProposal 1
If we map
frame=Falseto-B+n(no frame) and makeframe=Nonethe default:**basemapcolorbarframe=None(no-B)frame=True(-B)frame=False(-B+n)The new behavior seems more consistent and easier to document:
frame=Noneframe=Trueframe=FalseIs it a breaking change? Technically yes, but with limited impact:
frame=Falseframe=Falsebasemap-B)colorbar/rosecoast,plot, etc.It's rare that normal users would pass
frame=Falseto any plotting methods, so the impact should be limited, but I can see that passingframe=Falsemay happen when users write high-level functions that wrap multiple PyGMT methods. So, the impact is still high, especially that, in subplot mode,frame=Falsemeans lettingsubplotdecide the frame settting, but nowframe=Falsemeans no frame, which is quite a breaking change.Proposal 2
What about making
frame=Nonethe default and implementframe="auto"andframe="none"?basemapcolorbarframe=None(no-B)frame="auto"(-B)frame="none"(-B+n)frame=True/frame=Falseare still supported (so no breaking change), but only documentframe="auto"andframe="none"(maybe also mentionframe=Truesince it's heavily used).In other words, PR #4404 is ready for review, and if we decide to accept proposal 2, then we need a separate PR implementing
frame="auto".