Skip to content

quiverkey.get_window_extent does not work #18530

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
dcherian opened this issue Sep 19, 2020 · 5 comments
Open

quiverkey.get_window_extent does not work #18530

dcherian opened this issue Sep 19, 2020 · 5 comments

Comments

@dcherian
Copy link

Bug report

Bug summary

I'm trying to find the window extent of a quiverkey but cannot do so.

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt

u = np.ones((10, 10))
v = np.ones((10, 10))
x = np.arange(10)

q = plt.quiver(x, x, u, v)
key = plt.quiverkey(q, X=.9, Y=.6, U=0.5, label="quiv", coordinates="figure")

key.get_window_extent(plt.gcf().canvas.get_renderer())

Actual outcome

Bbox([[0.0, 0.0], [0.0, 0.0]])

image

Expected outcome

A BBox with non-zero values. Is there a workaround to find this with current matplotlib versions?

As background, I'm trying to make space for the quiverkey for this xarray PR: pydata/xarray#4407

We have code that makes space for a common legend using get_window_extent (e.g. https://xarray.pydata.org/en/stable/_images/ds_facet_scatter.png) and it would nice to have that "just work" with quiver keys

Matplotlib version

  • Operating system: Ubuntu 16.04

  • Matplotlib version: 3.2.0

  • Matplotlib backend (print(matplotlib.get_backend())): module://ipykernel.pylab.backend_inline

  • Python version: 3.8

  • Jupyter version (if applicable):6.3

  • Other libraries:

@jklymak
Copy link
Member

jklymak commented Sep 19, 2020

quiverkey has a cpouple of attributes quiver and text. You could prob just get their extents, and/or add a feature to the class.

@dstansby
Copy link
Member

Had a quick look into this, and QuiverKey.text.get_window_extent() works fine, but QuiverKey.vector.get_window_extent() currently returns a null bbox, which needs more looking into.

@QuLogic
Copy link
Member

QuLogic commented Jan 4, 2021

I started looking at this, but got a bit distracted by #18794.

@github-actions
Copy link

This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!

@github-actions github-actions bot added the status: inactive Marked by the “Stale” Github Action label Aug 21, 2023
@github-actions github-actions bot added the status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. label Sep 20, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2023
@tacaswell
Copy link
Member

This is still an issue.

@tacaswell tacaswell reopened this Sep 21, 2023
@tacaswell tacaswell added status: confirmed bug and removed New feature status: inactive Marked by the “Stale” Github Action status: closed as inactive Issues closed by the "Stale" Github Action. Please comment on any you think should still be open. labels Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants