Skip to content
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

Add extend option to add_text #36

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

Conversation

simonrp84
Copy link
Member

Currently, adding a colorbar to an image has the extend option, which expands the colorbar to fill the entire width/height.

This PR adds a similar extend kwarg to _add_text, enabling a textbox to take up the width of the image.

Comment on lines +281 to +289
if self.style["extend"]:
if self.style["propagation"][0] == 1:
x1 = x + px * (x_size - x)
elif self.style["propagation"][0] == -1:
x1 = x + px * x
else:
x1 = x + px * (tw + 2 * mx)
else:
x1 = x + px * (tw + 2 * mx)
Copy link
Member

Choose a reason for hiding this comment

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

Could we put this in another helper function or method? And how similar is this code to the scale/colorbar code? Could it be reused?

What do you think about a test that just makes sure that the result is different based on extend False and extend True? It doesn't have to check actual pixel-by-pixel comparison.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 4547122869

  • 0 of 7 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.8%) to 65.251%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pydecorate/decorator_base.py 0 7 0.0%
Totals Coverage Status
Change from base Build 4531939736: -0.8%
Covered Lines: 338
Relevant Lines: 518

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants