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

Skip to content

Commit c8fae15

Browse files
committed
Added a find_all method to the RcParams dictionary.
1 parent 9e477b3 commit c8fae15

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,22 @@ def values(self):
752752
"""
753753
return [self[k] for k in self.iterkeys()]
754754

755+
def find_all(self, key_contains):
756+
"""
757+
Return the subset of this RcParams dictionary for which the given
758+
``key_contains`` string is found somewhere in the key.
759+
760+
.. note::
761+
762+
Changes to the returned dictionary are *not* propagated to
763+
the parent RcParams dictionary.
764+
765+
"""
766+
return RcParams((key, value)
767+
for key, value in self.items()
768+
if key_contains in key)
769+
770+
755771
def rc_params(fail_on_error=False):
756772
'Return the default params updated from the values in the rc file'
757773

0 commit comments

Comments
 (0)