@@ -507,11 +507,13 @@ def get_cachedir():
507507 return _get_config_or_cache_dir (_get_xdg_cache_dir ())
508508
509509
510- def _get_data_path ():
511- """Return the path to matplotlib data."""
510+ @_logged_cached ('matplotlib data path: %s' )
511+ def get_data_path ():
512+ """Return the path to Matplotlib data."""
512513
513514 path = Path (__file__ ).with_name ("mpl-data" )
514515 if path .is_dir ():
516+ defaultParams ['datapath' ][0 ] = str (path )
515517 return str (path )
516518
517519 cbook .warn_deprecated (
@@ -534,18 +536,12 @@ def get_candidate_paths():
534536
535537 for path in get_candidate_paths ():
536538 if path .is_dir ():
539+ defaultParams ['datapath' ][0 ] = str (path )
537540 return str (path )
538541
539542 raise RuntimeError ('Could not find the matplotlib data files' )
540543
541544
542- @_logged_cached ('matplotlib data path: %s' )
543- def get_data_path ():
544- if defaultParams ['datapath' ][0 ] is None :
545- defaultParams ['datapath' ][0 ] = _get_data_path ()
546- return defaultParams ['datapath' ][0 ]
547-
548-
549545def matplotlib_fname ():
550546 """
551547 Get the location of the config file.
@@ -604,6 +600,7 @@ def gen_candidates():
604600 'animation.avconv_args' : ('3.3' ,),
605601 'mathtext.fallback_to_cm' : ('3.3' ,),
606602 'keymap.all_axes' : ('3.3' ,),
603+ 'datapath' : ('3.3' ,),
607604}
608605
609606
@@ -841,8 +838,9 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
841838 if key not in _all_deprecated ])
842839 config .update (config_from_file )
843840
844- if config ['datapath' ] is None :
845- config ['datapath' ] = get_data_path ()
841+ with cbook ._suppress_matplotlib_deprecation_warning ():
842+ if config ['datapath' ] is None :
843+ config ['datapath' ] = get_data_path ()
846844
847845 if "" .join (config ['text.latex.preamble' ]):
848846 _log .info ("""
0 commit comments