Skip to content

LOG: added printout of rcParams at debug level #10039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

jklymak
Copy link
Member

@jklymak jklymak commented Dec 18, 2017

PR Summary

In helping to debug #10016 I noted that there is no good way to see what the rcParams are in the debug interface. This seemed easy to add

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly concerned about the verbosity.

@jklymak
Copy link
Member Author

jklymak commented Dec 18, 2017

Yeah if you set level to DEBUG you get a lot of output and it basically needs to go in a file. OTOH I don’t think there is any reason to be shy about verbose output when using debug.

The motivation here is to just ask the user for one file rather than the debug output and the matpltolibrc. But I don’t feel strongly if this is seen as cluttering up the debug info.

FWIW I usually put the logging info after the matpltolib import to keep the log shorter without all the startup info

Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, it might be good to include the output of matplotlib.get_fname(), which shows the source of the matplotlibrc file that might have modified the rcParams. This is probably more valuable for debugging than the full rcParams.

@@ -1181,6 +1182,9 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
if rcParams['axes.formatter.use_locale']:
locale.setlocale(locale.LC_ALL, '')

_log.debug('rcParams: ')
_log.debug(rcParams)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested consolidation:

_log.debug('rcParams:\n%s', rcParams)

I think this will result in a more nicely-formatted output because it will not have the extra header info from the logging formatter at the start of the rcParams list.

@jklymak
Copy link
Member Author

jklymak commented Dec 27, 2017

I think @anntzer has a PR to log the names of the various files, so I think that takes care of @efiring meta comment.

@anntzer
Copy link
Contributor

anntzer commented Dec 27, 2017

it's #9761.

@jklymak
Copy link
Member Author

jklymak commented Dec 28, 2017

OK, I think I agree that this is very very verbose, and indeed a more reliable way of asking a user for their rcParams is:

from matplotlib import rcParams

print(rcParams)

So I think I'll close this.

@jklymak jklymak closed this Dec 28, 2017
@jklymak jklymak deleted the log-rcparams branch March 5, 2019 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants