Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3308d45

Browse files
committed
Some rewording and style fixes
1 parent 7fae906 commit 3308d45

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
Added set_params function to all Locator types
22
````````````````````````````````````````````````
33

4-
This was a bug fix targeted at making the api for Locators more consistent.
4+
This was a bug fix targeted at making the api for Locators more consistent.
55

6-
In the old behavior, only locators of type MaxNLocator have set_params()
7-
available, causing its use on any other Locator to throw an AttributeError *(
8-
aside: set_params(args) is a function that sets the parameters of a Locator
9-
instance to be as specified within args)*. Since MaxNLocator itself is a
10-
subtype of Locator, the fix will involve the moving of set_params()to the
11-
Locator class.
6+
In the old behavior, only locators of type MaxNLocator have set_params()
7+
defined, causing its use on any other Locator to throw an AttributeError *(
8+
aside: set_params(args) is a function that sets the parameters of a Locator
9+
instance to be as specified within args)*. The fix involves moving set_params()
10+
to the Locator class such that all subtypes will have this function defined.
1211

13-
Since each of the Locator subtype have their own modifiable parameters, a
14-
universal set_params() in Locator isn't ideal. Instead, a default no-operation
15-
function that raises a warning is implemented in Locator. Subtypes extending
16-
Locator will then override with their own implementations. Subtypes that do
17-
not have a need for set_params() will fall back onto their parent's
18-
implementation, which raises a warning as intended.
12+
Since each of the Locator subtype have their own modifiable parameters, a
13+
universal set_params() in Locator isn't ideal. Instead, a default no-operation
14+
function that raises a warning is implemented in Locator. Subtypes extending
15+
Locator will then override with their own implementations. Subtypes that do
16+
not have a need for set_params() will fall back onto their parent's
17+
implementation, which raises a warning as intended.
1918

20-
In the new behavior, all Locator instances will not throw an AttributeError
21-
when set_param() is called. For Locators that do not implement set_params(),
22-
the default implementation in Locator is used.
19+
In the new behavior, all Locator instances will not throw an AttributeError
20+
when set_param() is called. For Locators that do not implement set_params(),
21+
the default implementation in Locator is used.
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
API Consistency fix within Locators set_params() function
22
---------------------------------------------------------
33

4-
set_params() function, which sets parameters within a Locator type instance, is now available to all Locator types. The implementation also prevents unsafe usage by strictly defining the parameters that a user can set.
4+
set_params() function, which sets parameters within a Locator type instance,
5+
is now available to all Locator types. The implementation also prevents unsafe
6+
usage by strictly defining the parameters that a user can set.
7+
8+
To use, simply call set_params() on a Locator instance with desired arguments:
9+
::
510

6-
To use, simply initialize a Locator type, and call set_params() with desired arguments: ::
7-
811
loc = matplotlib.ticker.LogLocator()
912
# Set given attributes for loc.
1013
loc.set_params(numticks=8, numdecs=8, subs=[2.0], base=8)
11-
# The below will error, as there is no such parameter for LogLocator
14+
# The below will error, as there is no such parameter for LogLocator
1215
# named foo
13-
# loc.set_params(foo='bar')
16+
# loc.set_params(foo='bar')

0 commit comments

Comments
 (0)