Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0cf039c

Browse files
committed
Deprecate rcParams["datapath"] in favor of mpl.get_data_path().
The rcParam cannot be meaningfully set by the end user from theirmatplotlibrc or Python code.
1 parentbb7f9b9 commit0cf039c

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
lines changed

‎doc/api/next_api_changes/removals.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ rcParams
179179
- The ``pgf.debug``, ``verbose.fileo`` and ``verbose.verbose.level`` rcParams,
180180
which had no effect, have been removed.
181181
- Support for setting:rc:`mathtext.default` to "circled" has been removed.
182+
- The ``datapath`` rcParam has been removed. Use `.get_data_path` instead.
182183

183184
Environment variables
184185
~~~~~~~~~~~~~~~~~~~~~

‎lib/matplotlib/__init__.py

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -509,29 +509,8 @@ def get_cachedir():
509509

510510

511511
@_logged_cached('matplotlib data path: %s')
512-
defget_data_path(*,_from_rc=None):
512+
defget_data_path():
513513
"""Return the path to Matplotlib data."""
514-
if_from_rcisnotNone:
515-
cbook.warn_deprecated(
516-
"3.2",
517-
message=("Setting the datapath via matplotlibrc is deprecated "
518-
"%(since)s and will be removed in %(removal)s."),
519-
removal='3.3')
520-
path=Path(_from_rc)
521-
ifpath.is_dir():
522-
defaultParams['datapath'][0]=str(path)
523-
returnstr(path)
524-
else:
525-
warnings.warn(f"You passed datapath:{_from_rc!r} in your "
526-
f"matplotribrc file ({matplotlib_fname()}). "
527-
"However this path does not exist, falling back "
528-
"to standard paths.")
529-
530-
return_get_data_path()
531-
532-
533-
@_logged_cached('(private) matplotlib data path: %s')
534-
def_get_data_path():
535514
path=Path(__file__).with_name("mpl-data")
536515
ifpath.is_dir():
537516
defaultParams['datapath'][0]=str(path)
@@ -594,7 +573,7 @@ def gen_candidates():
594573
yieldmatplotlibrc
595574
yieldos.path.join(matplotlibrc,'matplotlibrc')
596575
yieldos.path.join(get_configdir(),'matplotlibrc')
597-
yieldos.path.join(_get_data_path(),'matplotlibrc')
576+
yieldos.path.join(get_data_path(),'matplotlibrc')
598577

599578
forfnameingen_candidates():
600579
ifos.path.exists(fname)andnotos.path.isdir(fname):
@@ -861,10 +840,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
861840
config.update(config_from_file)
862841

863842
withcbook._suppress_matplotlib_deprecation_warning():
864-
ifconfig['datapath']isNone:
865-
config['datapath']=_get_data_path()
866-
else:
867-
config['datapath']=get_data_path(_from_rc=config['datapath'])
843+
config['datapath']=get_data_path()
868844

869845
if"".join(config['text.latex.preamble']):
870846
_log.info("""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp