Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fb9029e

Browse files
jerithNeil
authored andcommitted
A file extension is not necessarily the only dot in a path. savefig() now understands this.
1 parent 45d81f9 commit fb9029e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/matplotlib/figure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from matplotlib import docstring
3535

3636
from operator import itemgetter
37+
import os.path
3738

3839
docstring.interpd.update(projection_names = get_projection_names())
3940

@@ -1062,7 +1063,7 @@ def savefig(self, *args, **kwargs):
10621063
kwargs.setdefault('dpi', rcParams['savefig.dpi'])
10631064

10641065
extension = rcParams['savefig.extension']
1065-
if args and is_string_like(args[0]) and '.' not in args[0] and extension != 'auto':
1066+
if args and is_string_like(args[0]) and '.' not in os.path.splitext(args[0])[-1] and extension != 'auto':
10661067
fname = args[0] + '.' + extension
10671068
args = (fname,) + args[1:]
10681069

0 commit comments

Comments
 (0)