Skip to content

Legend overlaps when visualizing a DataArray in xarray #5963

Answered by seeM
mehmetgoktug asked this question in Q&A
Discussion options

You must be logged in to vote

I think this is expected behavior but it would be helpful to see the same in VSCode. Was that in a notebook or interactive window? And was it executed line-by-line?

Positron's plotting is intended to be interactive line-by-line. The various plot() methods here might be using a matplotlib function that adds a new legend without checking if a previous exists. You could consider opening an issue in the xarray repo to allow repeated executions.

Or you can work around this by creating a new figure before each plot() call with plt.figure(). That's what would happen behind the scenes in a Jupyter notebook.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@seeM
Comment options

seeM Jan 15, 2025
Collaborator

Answer selected by mehmetgoktug
@mehmetgoktug
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants