-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Offset and scaling factors in axis format #4376 #6086
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
Changes from 1 commit
137c7aa
ab1b3a2
4079e1a
bfc7389
09f800c
02f0a11
5368336
fee8ab9
681820f
66061ad
53ed618
4c86635
9ce9d3c
8d9d121
2737c5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -436,6 +436,7 @@ def __init__(self, useOffset=None, useMathText=None, useLocale=None): | |
self.orderOfMagnitude = 0 | ||
self.format = '' | ||
self._scientific = True | ||
self._offsetString = '' | ||
self._powerlimits = rcParams['axes.formatter.limits'] | ||
if useLocale is None: | ||
useLocale = rcParams['axes.formatter.use_locale'] | ||
|
@@ -592,11 +593,29 @@ def format_data(self, value): | |
return self.fix_minus(s) | ||
|
||
|
||
def set_offset_string(self,s): | ||
""" | ||
Set the string which typically contains the offset | ||
or the scaling factor which is to be displayed on the axis. | ||
Set this to and empty string "" allows the string set by offset or scaling | ||
algorithm. | ||
|
||
Parameters | ||
---------- | ||
s: String describing the offset | ||
|
||
Returns | ||
------- | ||
None | ||
""" | ||
self._offsetString=s | ||
|
||
def get_offset(self): | ||
""" | ||
Returns a string with the offset(or scientific notation)/scaling | ||
factor which is properly formatted. This is used as additional text | ||
next to the ticks. | ||
next to the ticks, either determined by offset/scaling or set by the | ||
user | ||
|
||
Parameters | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not include unneeded sections. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if you mean (1) leave it as it was or (2) no documentation needed for this method as a user will probably not use this method. Which one do you prefer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rest of the docstring is good, just do not include the |
||
---------- | ||
|
@@ -606,6 +625,9 @@ def get_offset(self): | |
------- | ||
:string | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no |
||
""" | ||
#String has been set manually, so just return that | ||
if self._offsetString != '' : | ||
return self._offsetString | ||
|
||
if len(self.locs) == 0: | ||
return '' | ||
|
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.
There needs to be a space before the
: