-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpltOptions.py
38 lines (31 loc) · 1.1 KB
/
pltOptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from matplotlib.ticker import FormatStrFormatter
from matplotlib.ticker import NullFormatter
from matplotlib.ticker import FuncFormatter
from matplotlib.colors import LogNorm
import numpy as np
# ##########################################################
# Format tick labels using their exponent only...
# ##########################################################
def log_formatter(x,pos):
return format(np.log10(x), '.0f')
logfmt = FuncFormatter(log_formatter)
def log1_formatter(x,pos):
return format(np.log10(x), '.1f')
log1fmt = FuncFormatter(log1_formatter)
def log2_formatter(x,pos):
return format(np.log10(x), '.2f')
log2fmt = FuncFormatter(log2_formatter)
def log_GHzFormatter(x,pos):
return format(np.log10(x)-9.0, '.0f')
logGHzfmt = FuncFormatter(log_GHzFormatter)
def GHzFormatter(x,pos):
return format(x/1e9, '.2e')
GHzfmt = FuncFormatter(GHzFormatter)
def div_formatter(x,pos):
return format(x/1000, '.1f')
divfmt = FuncFormatter(div_formatter)
nullfmt = NullFormatter()
labelsize = 24