Skip to content

Add bbox support to quiverkey #30148

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

useidemaisachola
Copy link
Contributor

-This change was necessary to resolve the issue #29704.
-It is now possible to add a bbox (bounding box) around the entire quiverkey label — including both the arrow and the text — using the bbox keyword argument. Previously, bounding boxes could only be added manually or were limited to wrapping just the text, not the full key. This enhancement allows users to apply background color, border, and padding around the complete key for better visibility and styling.

PR checklist

It is now possible to add a bbox (bounding box) around the entire quiverkey label — including both the arrow and the text — using the bbox keyword argument. Previously, bounding boxes could only be added manually or were limited to wrapping just the text, not the full key. This enhancement allows users to apply background color, border, and padding around the complete key for better visibility and styling.

Co-authored-by: Mehak Khosa <mehakpreet.khosa@tecnico.ulisboa.pt>
@github-actions github-actions bot added the Documentation: examples files in galleries/examples label Jun 6, 2025
@useidemaisachola
Copy link
Contributor Author

I will resolve the problems with newlines and blankspaces but, the problems with Tests/ Python 3.12, it's not because of something I did right?

@@ -3,10 +3,14 @@

import numpy as np
import pytest
import cartopy.crs as ccrs
Copy link
Member

@rcomer rcomer Jun 6, 2025

Choose a reason for hiding this comment

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

Tests are failing because we do not have cartopy in the test environment. You need to simplify the test example and not use cartopy. Similarly for the new gallery example.

@useidemaisachola
Copy link
Contributor Author

Oh ok thank you, I will work on that!

@anntzer
Copy link
Contributor

anntzer commented Jun 7, 2025

I'm not really sure it's actually a good idea to add bbox support in each artist class one at a time. Instead, it may be more viable to have something like FancyBboxPatch.around_artists(list-of-artists, **kwargs); or at least have bbox support in the base artist class, relying on the generic get_window_extent method to figure out how big to draw the bbox?

@useidemaisachola
Copy link
Contributor Author

Hm ok, i understand your point, but I did what I understood throught my conversation with the developers on the tab of the issue (I did show the API, etc). Maybe I understood wrong. @story645, @rcomer, what do you think it's the best? Do I have to change my aproach?

@story645
Copy link
Member

story645 commented Jun 8, 2025

I'm not really sure it's actually a good idea to add bbox support in each artist class one at a time.

Which artists would it make sense to have a bbox for?

Do I have to change my aproach?

Depends - if a method is added to fancy box then yes, if the implementation is in base artist than you'll move the solution into the artist class but you still need to propose the arguments and show examples.

attn @timhoffm

@anntzer
Copy link
Contributor

anntzer commented Jun 8, 2025

Hm ok, i understand your point, but I did what I understood throught my conversation with the developers on the tab of the issue (I did show the API, etc).

Please understand that not all developers read all discussions at the same time nor do we all necessarily agree immediately on the best way to implement a feature (or whether we even want it to be added). It is not so rare to have multiple rounds of back and forth between the API-design side and the actual implementation work.

Which artists would it make sense to have a bbox for?

A more general reason why I raised this point is that the current implementation seems to be very tied down to QuiverKey implementation details, but a more generic one (based on get_window_extent) may be possible.

@rcomer
Copy link
Member

rcomer commented Jun 8, 2025

I have not followed all the details here, but currently QuiverKey does not have a get_window_extent method. I think that in order to implement one, you would need most of the logic currently in _draw_bbox. So, regardless of what the final implementation is, it might be a good idea to factor that out. This would have the added bonus of closing #18530.

@rcomer rcomer linked an issue Jun 8, 2025 that may be closed by this pull request
@useidemaisachola
Copy link
Contributor Author

Please understand that not all developers read all discussions at the same time nor do we all necessarily agree immediately on the best way to implement a feature (or whether we even want it to be added). It is not so rare to have multiple rounds of back and forth between the API-design side and the actual implementation work.

Yes, that makes sense, I'm still new at this.

So @story645, @rcomer, in summary, what do you want me to do? I understood your points and views, but I'm unsure what the final decision is.

@anntzer
Copy link
Contributor

anntzer commented Jun 8, 2025

I don't think anyone wants you to do anything. Again, the tricky part is figuring out what to do, not so much how to do it.

@story645
Copy link
Member

story645 commented Jun 9, 2025

@story645, @rcomer, in summary, what do you want me to do?

Like @anntzer said, we've gotta come to consensus for quiverbox. I think for now, you can work on @rcomer 's suggestion of creating a get_window_extent method. That will close an outstanding issue, and if consensus ends up being to generalize the solution than having written the specific solution will help you write the general form.

@useidemaisachola
Copy link
Contributor Author

useidemaisachola commented Jun 9, 2025

Yes, I know, I was talking about the part of being more generic. Ok, thank you, @story645 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: examples files in galleries/examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to add FancyBboxPatch around quiverkey()
4 participants