Skip to content

Set facecolor of FilledArrow axisline style and fix tight layout#24085

Merged
ksunden merged 4 commits into
matplotlib:mainfrom
oscargus:testaxislinestyle
Jan 7, 2023
Merged

Set facecolor of FilledArrow axisline style and fix tight layout#24085
ksunden merged 4 commits into
matplotlib:mainfrom
oscargus:testaxislinestyle

Conversation

@oscargus
Copy link
Copy Markdown
Member

@oscargus oscargus commented Oct 3, 2022

PR Summary

Original purpose was to test axisline style, but as part of that:

Add support for providing facecolor to a FilledArrow, defaulting to the same color as the axes edgecolor.

Make tight (and other) layouts work for axislines by fixing get_window_extents, thanks to @leejjoon

Closes #7617 (fixed elsewhere, but adding test here).

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@oscargus oscargus added this to the v3.7.0 milestone Oct 3, 2022
@oscargus oscargus force-pushed the testaxislinestyle branch 3 times, most recently from bdcafbc to 0d5f40a Compare October 4, 2022 06:33
Comment thread lib/mpl_toolkits/tests/test_axisartist_axislines.py
@oscargus oscargus force-pushed the testaxislinestyle branch 2 times, most recently from 9140a3d to e06bfc6 Compare October 4, 2022 08:08
@oscargus oscargus marked this pull request as draft October 4, 2022 08:42
@oscargus oscargus marked this pull request as ready for review November 24, 2022 18:45
@oscargus oscargus changed the title Add test for axisline_style Set facecolor of FilledArrow axisline style and fix tight layout Nov 24, 2022
Comment thread lib/mpl_toolkits/axisartist/axisline_style.py Outdated
@tacaswell
Copy link
Copy Markdown
Member

Something seems very wrong with the subplotzero test image as the Axiss appear doubled?

@oscargus
Copy link
Copy Markdown
Member Author

oscargus commented Dec 5, 2022

That is the exact code (and result) of #7617. Although strange, I wasn't sure how to modify it to make sure that the issue was tested exactly as it should be.

@tacaswell
Copy link
Copy Markdown
Member

Oh, 🐑 I'm apparently deeply confused about what it "should" do.

@leejjoon
Copy link
Copy Markdown
Contributor

leejjoon commented Dec 8, 2022

If you want to test for #7617 (that y axis label is incorrectly set), below is the minimum I can think of and that also looks okay.

import matplotlib.pyplot as plt
from mpl_toolkits.axisartist.axislines import SubplotZero

fig = plt.figure()
ax = fig.add_subplot(111, axes_class=SubplotZero)

ax.set(xlim=(-3, 7), ylim=(-3, 7), xlabel="x", ylabel="y")

zero_axis = ax.axis["xzero", "yzero"]
zero_axis.set_visible(True)  # they are hidden by default

which should give you below.

image

I would add

ax.axis["left", "right", "bottom", "top"].set_visible(False)

zero_axis.set_axisline_style("->")
zero_axis.major_ticks.set_tickdir("inout")

which will give

image

@oscargus
Copy link
Copy Markdown
Member Author

oscargus commented Dec 8, 2022

Thank you very much! I've updated the test (dropped set_tickdir as that gave an error AttributeError: 'Ticks' object has no attribute 'set_tickdir'?).

@oscargus oscargus added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. topic: mpl_toolkit topic: testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set_ylabel does not work as expected with SubplotZero

5 participants