-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
replace cairo.format with savefig.format in rcParams #907
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
Changes from 1 commit
e58fa07
42002e2
6d6da54
b822c26
8cdc0da
bec0a4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ackends replace some stray tabs with spaces
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -144,8 +144,7 @@ def byte2str(b): return b | |
|
|
||
| from matplotlib.rcsetup import (defaultParams, | ||
| validate_backend, | ||
| validate_toolbar, | ||
| validate_cairo_format) | ||
| validate_toolbar) | ||
|
|
||
| major, minor1, minor2, s, tmp = sys.version_info | ||
| _python24 = (major == 2 and minor1 >= 4) or major >= 3 | ||
|
|
@@ -943,10 +942,7 @@ def use(arg, warn=True): | |
| be_parts = arg.split('.') | ||
| name = validate_backend(be_parts[0]) | ||
| if len(be_parts) > 1: | ||
| if name == 'cairo': | ||
| rcParams['cairo.format'] = validate_cairo_format(be_parts[1]) | ||
| else: | ||
| raise ValueError('Only cairo backend has a format option') | ||
| raise ValueError('FIXME: Not sure what to do here') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've only just learnt of the One of the important things that this is doing is limiting the default format in a Cairo backend to In which case, other than a few fewer keystrokes, I see no benefit to: over Therefore I propose that the Cairo backend be brought back into line with the other backends by removing the |
||
| rcParams['backend'] = name | ||
|
|
||
| def get_backend(): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2078,7 +2078,7 @@ def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w', | |
|
|
||
|
|
||
| def get_default_filetype(self): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on my earlier comment, this method could really do with a docstring (whilst your there, |
||
| raise NotImplementedError | ||
| return rcParams['savefig.format'] | ||
|
|
||
| def set_window_title(self, title): | ||
| """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -251,9 +251,9 @@ def validate_font_properties(s): | |
| 'silent', 'helpful', 'debug', 'debug-annoying', | ||
| ]) | ||
|
|
||
| validate_cairo_format = ValidateInStrings('cairo_format', | ||
| ['png', 'ps', 'pdf', 'svg'], | ||
| ignorecase=True) | ||
| validate_savefig_format = ValidateInStrings('savefig_format', | ||
| ['png', 'ps', 'pdf', 'svg'], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem with this, as far as I can see, is that you cannot guarantee what filetypes are valid until you know what backend is being used, and you cannot know what backend is being used until runtime. Therefore, for many of the backends, it would make sense for |
||
| ignorecase=True) | ||
|
|
||
| validate_ps_papersize = ValidateInStrings('ps_papersize',[ | ||
| 'auto', 'letter', 'legal', 'ledger', | ||
|
|
@@ -547,8 +547,8 @@ def __call__(self, s): | |
| 'savefig.edgecolor' : ['w', validate_color], # edgecolor; white | ||
| 'savefig.orientation' : ['portrait', validate_orientation], # edgecolor; white | ||
| 'savefig.extension' : ['auto', str], # what to add to extensionless filenames | ||
| 'savefig.format' : ['png', validate_savefig_format], | ||
|
|
||
| 'cairo.format' : ['png', validate_cairo_format], | ||
| 'tk.window_focus' : [False, validate_bool], # Maintain shell focus for TkAgg | ||
| 'tk.pythoninspect' : [False, validate_tkpythoninspect], # obsolete | ||
| 'ps.papersize' : ['letter', validate_ps_papersize], # Set the papersize/type | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure
savefig.formatfalls in the same class of things asdpi,facecolor,edgecolorwhich applies to theplt.savefigfunction (I think) whereasformatwould only apply to GUI save dialogues.Obviously, this is also breaking backwards compatibility, which at the best should be noted in the
doc/api/api_changes.rst.Would any devs care to suggest appropriate actions (if any) for these issues.