override matplotlib rcParams to give more consistent plots#33
override matplotlib rcParams to give more consistent plots#33eteq wants to merge 1 commit intoejeschke:mainfrom
Conversation
|
Hmm..I think that having the user's matplotlibrc silently overridden by importing ginga is destined to confuse and confound users. As an experiment, what happens if you add your code fragment: import matplotlib to the top of the pre_gui_config() function in your .ginga/ginga_config.py. Does it then fix the settings for all matplotlib plots everywhere in the program? This way at least the user has control over it. If this works, then another possibility would be to add this to the ginga startup preamble as the default, with an option to let the user override it. |
|
Yep, your suggestion in An slightly more involved (but less heavy-handed) approach might be to wrap all of This would be a pain of there are a lot of plotting commands, but if there's just a few places this is necessary, it might be a good option. I can replace this PR with one doing that if you can point me to where the key places are. |
|
I come across this outstanding issue. If it still applies... As a user who does not care where my |
|
Hmm. Ginga is already overriding some (but not very many) matplotlib rc params settings. I think I agree with @eteq here that having the user's settings be used by default may cause the plots to look very strange or possibly even unusable under ginga. Maybe we can simply make a Glue must have to deal with this same issue, I would assume. I'll see if I can figure out how they handle that. |
|
We don't have a lot of cases of customized @pllim, I am noticing that the recent change to use |
|
That might be a a good idea, but I'd like to understand the failure first. The tight layout does improve the look of things. I need to be able to consistently reproduce the error under gtk, and right now it only happens sporadically so I have a local branch that disables the tight layout. |
|
Here's the error I'm getting: 2015-12-29 11:38:31,948 | W | tight_layout.py:225 (get_renderer) | /usr/lib/pymodules/python2.7/matplotlib/tight_layout.py:225: UserWarning: tight_layout : falling back to Agg renderer
warnings.warn("tight_layout : falling back to Agg renderer") |
|
Oh, and I don't see this under python 3, FWIW |
|
This is fixed under commit a0b1366. Unfortunately this does revert your #253 PR @pllim. However on the bright side the I found this matplotlib issue very helpful in diagnosing and fixing the problem. |
|
No problem, @ejeschke ! I'll double check if this works on my end when I get the chance. Thank you! |
|
@ejeschke , the plots look good to me! 👍 |
|
This PR is now 5 years old and can apply for kindergarten education. Is this still relevant? If so, please rebase. Else, please close. Thanks! |
I've noticed that when I do something in ginga that uses matplotlib, the axes labels are often strange sizes, and in general my plots are hard to see (@ejesche, I think I showed this to you in person last month). I traced this to the fact that ginga is using my
~/.matplotlib/matplotlibrcwhen making matplotlib plots, which I have set to have bigger labels in general. But that's not good for ginga.So this PR just overrides whatever the user's matplotlibrc file might say, and instead uses the defaults built-in to matplotlib. Now the plots look much more reasonable and fit inside e.g. the plugin window on the standard ginga layout.
There is a possible downside to this (very simple) implementation, though: it means that on-import (at least of the
Plotmodules),gingawill silently override anyone's matplotlibrc. This means that if they just import ginga for some other reason (e.g. just to have a ginga window), they might unexpectedly see their matplotlibrc file ignored. I can think of a variety of possible solutions for this, but I figured I should see what @ejesche thinks about this first.