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 488 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 497 of file plotting.py.

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

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 524 of file plotting.py.

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

◆ finish()

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

Reimplemented from Plotter.

Definition at line 531 of file plotting.py.

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

Member Data Documentation

◆ axis [1/2]

None axis = None
static

Main axis.

Definition at line 495 of file plotting.py.

◆ axis [2/2]

axis

the axis of the first subplot

Definition at line 521 of file plotting.py.

◆ figure [1/2]

None figure = None
static

figure which is used to draw

Definition at line 493 of file plotting.py.

◆ figure [2/2]

figure

create figure

Definition at line 504 of file plotting.py.

◆ sub_plots

sub_plots

the subplots which are displayed in the grid

Definition at line 519 of file plotting.py.


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