-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[ENH]: Add default kwargs values if figure.suptitle(t, **kwargs) to rcParams and inherit from there. #24090
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
Comments
Do you think the same should be available for |
Anyone who wants to do this will want to make sure there is still a way for constrained_layout to work. |
I think this is a good first issue because there is limited API choices to be made and there are good examples of merged PRs adding rcparams to follow, but medium because there are a bunch of moving parts that will need to be done:
@jklymak could you comment on why this would conflict with constrained layout? If we can already control these things through kwargs I would not expect making them controllable via rcparam to cause any (new) problems. |
Note that docstrings are autogenerated via a common template for Naming: I propose to use |
If the scope is as explained by @tacaswell 's comment, I would like to take this up. Might need a little help to make sure what'll be the correct starting point though. Not sure about the constrained_layout issue though? |
Tim's comment also needs to be fully addressed. |
Yep, that too. I know a little less about it but should be able to pick it up! :) |
I was taking a look at this PR. Is there any other example I can refer to? |
As @oscargus mentioned, doing it for |
Sorry there is no issue with constrained layout. The issue is with aligning the x/ylabels and the title. We need a sentinel for "default location" which has historically been the default location. Then we allow ourselves to move the label to avoid any ticks or other inner decorations. For xlabel and title this only affects the y and for glabelle this only affects the x. If the user sets the y value for the title to something other than the default, we respect that value and don't try to adjust. If we make these things have rcparams do we respect the values passed or do we assume the user still wants the automatic shifting of the title if the y value is equal to their rcparam default? |
|
My comment has nothing to do with constrained_layout, but rather to do with the automatic placement of the labels. |
Ohh my bad. Sorry. In that case, I think the set rcparam value comes with the understanding that automatic placement still happens to make the figure clear. I don't think that would be something undesirable by the user. |
#22566 added another set of rcparams for suptitle/supxlabel/supylabel so it may be worth checking, especially how to get the docs to generate correctly. Which is also why I claimed that it may be easier to add something similar to supxlabel and supylabel as well, although not sure that one would like to have the same alignment for both ( |
Uh oh!
There was an error while loading. Please reload this page.
Problem
Problem summary
I cannot change the default location of a
figure.suptitle()
through thercParams
as I can with the title location of the axis title.Origin/background
I am tweaking the default settings of Matplotlib to create plots that in appearance match the corporate styling. Most changes have been made by re-setting the default values of certain
rcParams
.One of the requirements is the left-alignment of titles of graphs. For the axis title I can set
rcParams['axes.titlelocation']
to'left'
, as itdefaults tocenter
. I would like to do something similar to the figure's suptitle.Currently, setting the figure's suptitle only takes defaults
rcParams['figure.titlesize']
andrcParams['figure.titleweight']
. The other parameters for location and alignment of the suptitle are defaulted in the method's argument definition. My desire is to add these torcParams
as well, and refer hereto as default.Proposed solution
E.g. expand the
rcParams
with:And then use these defaults in
figure.suptitle()
, very similar to howrcParams['figure.titlesize']
andrcParams['figure.titleweight']
are already used as default values.The text was updated successfully, but these errors were encountered: