Skip to content

Permit setting 'style' to default, and add 'bbox' as 'border' alternative for inner a-b-c labels and titles#240

Merged
lukelbd merged 5 commits intoproplot-dev:masterfrom
pratiman-91:master
Jun 30, 2021
Merged

Permit setting 'style' to default, and add 'bbox' as 'border' alternative for inner a-b-c labels and titles#240
lukelbd merged 5 commits intoproplot-dev:masterfrom
pratiman-91:master

Conversation

@pratiman-91
Copy link
Copy Markdown
Contributor

This is my first contribution. Let me know if there is any problem with the issue or failing any tests.

@lukelbd
Copy link
Copy Markdown
Collaborator

lukelbd commented Jun 30, 2021

Hi @pratiman-91, thanks for the PR! That bugfix is easy and I like the idea of "bounding boxes" for titles and a-b-c labels. When you get the chance can you fix the PEP8 errors? Also you might consider installing pre-commit, which will show you the PEP8 issues and prevent you from commiting until they are fixed, as mentioned in the contribution guide.

@lukelbd
Copy link
Copy Markdown
Collaborator

lukelbd commented Jun 30, 2021

(Fixes #234)

@lukelbd lukelbd changed the title Fixed Issue: #234 can't set style to default Permit setting 'style' to default, and add 'bbox' as 'border' alternative for inner a-b-c labels and titles Jun 30, 2021
@lukelbd
Copy link
Copy Markdown
Collaborator

lukelbd commented Jun 30, 2021

Apparently I'm allowed to edit your PR myself (never did that before!). This was close to being ready anyway so I decided to fix the issues. Thanks again, merging now

@lukelbd lukelbd merged commit 29f8c02 into proplot-dev:master Jun 30, 2021
@lukelbd
Copy link
Copy Markdown
Collaborator

lukelbd commented Jul 1, 2021

I made some improvements to this feature on master (4288a73):

  1. "Borders" are still used by default (because IMO borders are less obtrusive and I see big no reason to change the default).
  2. By default a square bounding box is drawn perfectly flush against the subplot edge.
  3. There are new title.bboxpad and abc.bboxpad options to control padding.
  4. Turning on title.bbox turns off title.border, and vice versa. You cannot have both of them on at the same time... which I imagine is what users will want 99% of the time.

Here's a nice example with these new features:

import proplot as plot
fig, ax = plot.subplots(ncols=2)
print(plot.rc.abcborder)  # prints True
ax.contourf(np.random.rand(10, 10))
ax.format(abc=True, abcloc='ul', abcstyle='A.', abcbbox=True)  # temporarily sets border to False

tmp

@pratiman-91
Copy link
Copy Markdown
Contributor Author

Looks good.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants