Belle II Software development
Multiplot Class Reference
Inheritance diagram for Multiplot:
Plotter

Public Member Functions

def __init__ (self, cls, number_of_plots, figure=None)
 
def add (self, i, *args, **kwargs)
 
def finish (self)
 

Public Attributes

 figure
 create figure
 
 sub_plots
 the subplots which are displayed in the grid
 
 axis
 the axis of the first subplot
 

Static Public Attributes

None figure = None
 figure which is used to draw
 
None axis = None
 Main axis.
 

Detailed Description

Plots multiple other plots into a grid 3x?

Definition at line 487 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  cls,
  number_of_plots,
  figure = None 
)
Creates a new figure if None is given, sets the default plot parameters
@param figure default draw figure which is used

Reimplemented from Plotter.

Definition at line 496 of file plotting.py.

496 def __init__(self, cls, number_of_plots, figure=None):
497 """
498 Creates a new figure if None is given, sets the default plot parameters
499 @param figure default draw figure which is used
500 """
501 if figure is None:
502
503 self.figure = matplotlib.figure.Figure(figsize=(12, 8), dpi=120)
504 self.figure.set_tight_layout(True)
505 else:
506 self.figure = figure
507
508 if number_of_plots == 1:
509 gs = matplotlib.gridspec.GridSpec(1, 1)
510 elif number_of_plots == 2:
511 gs = matplotlib.gridspec.GridSpec(1, 2)
512 elif number_of_plots == 3:
513 gs = matplotlib.gridspec.GridSpec(1, 3)
514 else:
515 gs = matplotlib.gridspec.GridSpec(int(numpy.ceil(number_of_plots / 3)), 3)
516
517
518 self.sub_plots = [cls(self.figure, self.figure.add_subplot(gs[i // 3, i % 3])) for i in range(number_of_plots)]
519
520 self.axis = self.sub_plots[0].axis
521 super().__init__(self.figure, self.axis)
522

Member Function Documentation

◆ add()

def add (   self,
  i,
args,
**  kwargs 
)
Call add function of ith subplot
@param i position of the subplot

Reimplemented from Plotter.

Definition at line 523 of file plotting.py.

523 def add(self, i, *args, **kwargs):
524 """
525 Call add function of ith subplot
526 @param i position of the subplot
527 """
528 self.sub_plots[i].add(*args, **kwargs)
529

◆ finish()

def finish (   self)
Sets limits, title, axis-labels and legend of the plot

Reimplemented from Plotter.

Definition at line 530 of file plotting.py.

530 def finish(self):
531 """
532 Sets limits, title, axis-labels and legend of the plot
533 """
534 for plot in self.sub_plots:
535 plot.finish()
536 return self
537
538

Member Data Documentation

◆ axis [1/2]

None axis = None
static

Main axis.

Definition at line 494 of file plotting.py.

◆ axis [2/2]

axis

the axis of the first subplot

Definition at line 520 of file plotting.py.

◆ figure [1/2]

None figure = None
static

figure which is used to draw

Definition at line 492 of file plotting.py.

◆ figure [2/2]

figure

create figure

Definition at line 503 of file plotting.py.

◆ sub_plots

sub_plots

the subplots which are displayed in the grid

Definition at line 518 of file plotting.py.


The documentation for this class was generated from the following file: