@@ -59,6 +59,7 @@ def __init__(self,
59
59
y_boundaries = None ,
60
60
y_ticks = None ,
61
61
saving_path = None ,
62
+ saving_format = "png" ,
62
63
filename = None ,
63
64
* args ,
64
65
** kwargs
@@ -109,6 +110,7 @@ def __init__(self,
109
110
self .y_ticks = y_ticks
110
111
self .saving_path = saving_path
111
112
self .filename = filename
113
+ self .saving_format = saving_format
112
114
113
115
if self .fontsize == 'default' :
114
116
self .fontsize = 34
@@ -462,10 +464,19 @@ def save_figure(self, **args):
462
464
"text.latex.preamble" : r"\usepackage{cmbright}"
463
465
})
464
466
if self .dark_mode :
467
+ if self .saving_format == 'pdf' :
468
+ print ("dark mode and pdf not supported. saving to png" )
465
469
plt .savefig (saving_path + self .filename + "-dm.png" ,
466
470
bbox_inches = 'tight' , pad_inches = 0.062 ,
467
471
transparent = self .transparency , dpi = 200 )
468
472
else :
469
- plt .savefig (saving_path + self .filename + ".png" ,
470
- bbox_inches = 'tight' , pad_inches = 0.062 ,
471
- transparent = self .transparency , dpi = 200 )
473
+ if self .saving_format == 'pdf' :
474
+ if self .transparency :
475
+ print ("pdf and transparency were chosen" )
476
+ plt .savefig (saving_path + self .filename + ".pdf" ,
477
+ bbox_inches = 'tight' , pad_inches = 0.062 ,
478
+ transparent = self .transparency , dpi = 200 )
479
+ elif self .saving_format == 'png' :
480
+ plt .savefig (saving_path + self .filename + ".png" ,
481
+ bbox_inches = 'tight' , pad_inches = 0.062 ,
482
+ transparent = self .transparency , dpi = 200 )
0 commit comments