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
Fix issue 1172 #2618
Fix issue 1172 #2618
Conversation
# -> points. grab the integer from the `Text` object | ||
# instead of saving the string representation | ||
setattr(self, '_' + k, | ||
getattr(self.label1, 'get_{}'.format(k))()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This empty {}
in format doesn't work on Python 2.6, unfortunately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, the present version is very hard to read. Breaking it up with one or two temporary variables would help, in addition to going back to the good old percent notation. Actually, it looks like string addition would be enough. Maybe something like this:
text_attr_getter = getattr(self.label1, 'get_' + k)
setattr(self, '_' + k, text_attr_getter())
or
text_attr = getattr(self.label1, 'get_' + k)()
setattr(self, '_' + k, text_attr)
Or, have I misinterpreted what is supposed to happen here?
Also, you are not using v at all now, so the iterations should be over ```keys```.
Looks good, once Travis passes. |
@efiring This clearer? |
# -> points. grab the integer from the `Text` object | ||
# instead of saving the string representation | ||
getter_fun = 'get_' + k | ||
v = getattr(self.label1, getter_fun)() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, thank you. Actually, at this point, it is simple enough that you could eliminate the "getter_fun" and substitute the string directly into the getattr argument. I think that would be entirely readable, nice and concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done and commits squashed.
Do this by getting the size value back from the underlying text object.
There is an intermittent Travis failure in test_bbox_inches_tight_suptitle_legend involving a difference of 3 pixels between the size of the plot and the baseline size. It's a nuisance, but not related to this PR. |
when
labelsize
was passed intotick_param
as a string, it is correctly dealt with by theText
object used in the ticklabel, but theTick
saves the string which leads to addition problems later.