12
12
functions in a custom module that set the defaults, e.g.,::
13
13
14
14
def set_pub():
15
- rc('font', weight='bold') # bold fonts are easier to see
16
- rc('tick', labelsize=15) # tick labels bigger
17
- rc('lines', lw=1, color='k') # thicker black lines
18
- rc('grid', c='0.5', ls='-', lw=0.5) # solid gray grid lines
19
- rc('savefig', dpi=300) # higher res outputs
15
+ rcParams.update({
16
+ "font.weight": "bold", # bold fonts
17
+ "tick.labelsize": 15, # large tick labels
18
+ "lines.linewidth": 1, # thick lines
19
+ "lines.color": "k", # black lines
20
+ "grid.color": "0.5", # gray gridlines
21
+ "grid.linestyle": "-", # solid gridlines
22
+ "grid.linewidth": 0.5, # thin gridlines
23
+ "savefig.dpi": 300, # higher resolution output.
24
+ })
20
25
21
26
Then as you are working interactively, you just need to do::
22
27
@@ -33,15 +38,18 @@ def set_pub():
33
38
plt .plot ([1 , 2 , 3 ])
34
39
35
40
# the axes attributes need to be set before the call to subplot
36
- plt .rc ('font' , weight = 'bold' )
37
- plt .rc ('xtick.major' , size = 5 , pad = 7 )
38
- plt .rc ('xtick' , labelsize = 15 )
39
-
40
- # using aliases for color, linestyle and linewidth; gray, solid, thick
41
- plt .rc ('grid' , c = '0.5' , ls = '-' , lw = 5 )
42
- plt .rc ('lines' , lw = 2 , color = 'g' )
41
+ plt .rcParams .update ({
42
+ "font.weight" : "bold" ,
43
+ "xtick.major.size" : 5 ,
44
+ "xtick.major.pad" : 7 ,
45
+ "xtick.labelsize" : 15 ,
46
+ "grid.color" : "0.5" ,
47
+ "grid.linestyle" : "-" ,
48
+ "grid.linewidth" : 5 ,
49
+ "lines.linewidth" : 2 ,
50
+ "lines.color" : "g" ,
51
+ })
43
52
plt .subplot (312 )
44
-
45
53
plt .plot ([1 , 2 , 3 ])
46
54
plt .grid (True )
47
55
0 commit comments