Construct a `RcParams` from file *fname*. Parameters ---------- fname : str or path-like A file with Matplotlib rc settings. fail_on_error : bool If True, raise an error when the parser fails to convert a parameter. use_default_template : bool If Tru
(fname, fail_on_error=False, use_default_template=True)
| 951 | |
| 952 | |
| 953 | def rc_params_from_file(fname, fail_on_error=False, use_default_template=True): |
| 954 | """ |
| 955 | Construct a `RcParams` from file *fname*. |
| 956 | |
| 957 | Parameters |
| 958 | ---------- |
| 959 | fname : str or path-like |
| 960 | A file with Matplotlib rc settings. |
| 961 | fail_on_error : bool |
| 962 | If True, raise an error when the parser fails to convert a parameter. |
| 963 | use_default_template : bool |
| 964 | If True, initialize with default parameters before updating with those |
| 965 | in the given file. If False, the configuration class only contains the |
| 966 | parameters specified in the file. (Useful for updating dicts.) |
| 967 | """ |
| 968 | config_from_file = _rc_params_in_file(fname, fail_on_error=fail_on_error) |
| 969 | |
| 970 | if not use_default_template: |
| 971 | return config_from_file |
| 972 | |
| 973 | with _api.suppress_matplotlib_deprecation_warning(): |
| 974 | config = RcParams({**rcParamsDefault, **config_from_file}) |
| 975 | |
| 976 | if "".join(config['text.latex.preamble']): |
| 977 | _log.info(""" |
| 978 | ***************************************************************** |
| 979 | You have the following UNSUPPORTED LaTeX preamble customizations: |
| 980 | %s |
| 981 | Please do not ask for support with these customizations active. |
| 982 | ***************************************************************** |
| 983 | """, '\n'.join(config['text.latex.preamble'])) |
| 984 | _log.debug('loaded rc file %s', fname) |
| 985 | |
| 986 | return config |
| 987 | |
| 988 | |
| 989 | rcParamsDefault = _rc_params_in_file( |
no test coverage detected
searching dependent graphs…