PySDM_examples.Berry_1967.spectrum_plotter

 1from matplotlib import pyplot
 2from open_atmos_jupyter_utils import show_plot
 3from PySDM_examples.Shima_et_al_2009.spectrum_plotter import (
 4    SpectrumPlotter as SuperSpectrumPlotter,
 5)
 6
 7
 8class SpectrumPlotter(SuperSpectrumPlotter):
 9    def __init__(self, settings, title=None, grid=True, legend=False):
10        size = 2 * 5.236
11        pyplot.figure(num=1, figsize=(size, size * 0.54))
12        pyplot.xlabel("particle radius [µm]")
13        pyplot.ylabel("dm/dlnr [g/m^3/(unit dr/r)]")
14        super().__init__(settings, title=title, grid=grid, legend=legend, log_base=2)
15        self.color = None
16        self.smooth = True
17
18    @staticmethod
19    def ticks():
20        xticks = [4, 6.25, 12.5, 25, 50, 100, 200]
21        pyplot.xticks(xticks, xticks)
22        pyplot.yticks([0.5 * i for i in range(5)], [0, None, 1, None, 2])
23
24    def show(self):
25        self.finish()
26        self.ticks()
27        show_plot()
28
29    def plot(self, spectrum, t):
30        settings = self.settings
31        self.plot_data(settings, t, spectrum)
 9class SpectrumPlotter(SuperSpectrumPlotter):
10    def __init__(self, settings, title=None, grid=True, legend=False):
11        size = 2 * 5.236
12        pyplot.figure(num=1, figsize=(size, size * 0.54))
13        pyplot.xlabel("particle radius [µm]")
14        pyplot.ylabel("dm/dlnr [g/m^3/(unit dr/r)]")
15        super().__init__(settings, title=title, grid=grid, legend=legend, log_base=2)
16        self.color = None
17        self.smooth = True
18
19    @staticmethod
20    def ticks():
21        xticks = [4, 6.25, 12.5, 25, 50, 100, 200]
22        pyplot.xticks(xticks, xticks)
23        pyplot.yticks([0.5 * i for i in range(5)], [0, None, 1, None, 2])
24
25    def show(self):
26        self.finish()
27        self.ticks()
28        show_plot()
29
30    def plot(self, spectrum, t):
31        settings = self.settings
32        self.plot_data(settings, t, spectrum)
SpectrumPlotter(settings, title=None, grid=True, legend=False)
10    def __init__(self, settings, title=None, grid=True, legend=False):
11        size = 2 * 5.236
12        pyplot.figure(num=1, figsize=(size, size * 0.54))
13        pyplot.xlabel("particle radius [µm]")
14        pyplot.ylabel("dm/dlnr [g/m^3/(unit dr/r)]")
15        super().__init__(settings, title=title, grid=grid, legend=legend, log_base=2)
16        self.color = None
17        self.smooth = True
color
smooth
@staticmethod
def ticks():
19    @staticmethod
20    def ticks():
21        xticks = [4, 6.25, 12.5, 25, 50, 100, 200]
22        pyplot.xticks(xticks, xticks)
23        pyplot.yticks([0.5 * i for i in range(5)], [0, None, 1, None, 2])
def show(self):
25    def show(self):
26        self.finish()
27        self.ticks()
28        show_plot()
def plot(self, spectrum, t):
30    def plot(self, spectrum, t):
31        settings = self.settings
32        self.plot_data(settings, t, spectrum)