Python matplotlib.gridspec.SubplotSpec() Examples
The following are 29
code examples of matplotlib.gridspec.SubplotSpec().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
matplotlib.gridspec
, or try the search function
.
Example #1
Source File: _subplots.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_subplotspec(self): """get the SubplotSpec instance associated with the subplot""" return self._subplotspec
Example #2
Source File: _subplots.py From twitter-stock-recommendation with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec
Example #3
Source File: _subplots.py From twitter-stock-recommendation with MIT License | 5 votes |
def get_subplotspec(self): """get the SubplotSpec instance associated with the subplot""" return self._subplotspec
Example #4
Source File: axes_divider.py From CogAlg with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): 'set the SubplotSpec instance' self._subplotspec = subplotspec
Example #5
Source File: axes_divider.py From CogAlg with MIT License | 5 votes |
def get_subplotspec(self): 'get the SubplotSpec instance' return self._subplotspec
Example #6
Source File: _subplots.py From CogAlg with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec
Example #7
Source File: _subplots.py From CogAlg with MIT License | 5 votes |
def get_subplotspec(self): """get the SubplotSpec instance associated with the subplot""" return self._subplotspec
Example #8
Source File: _subplots.py From coffeegrindsize with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec
Example #9
Source File: _subplots.py From coffeegrindsize with MIT License | 5 votes |
def get_subplotspec(self): """get the SubplotSpec instance associated with the subplot""" return self._subplotspec
Example #10
Source File: _subplots.py From ImageFusion with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec
Example #11
Source File: _subplots.py From ImageFusion with MIT License | 5 votes |
def get_subplotspec(self): """get the SubplotSpec instance associated with the subplot""" return self._subplotspec
Example #12
Source File: utils.py From scvelo with BSD 3-Clause "New" or "Revised" License | 5 votes |
def get_ax(ax, show=None, figsize=None, dpi=None, projection=None): figsize, _ = get_figure_params(figsize) if ax is None: projection = "3d" if projection == "3d" else None ax = pl.figure(None, figsize, dpi=dpi).gca(projection=projection) elif isinstance(ax, SubplotSpec): geo = ax.get_geometry() if show is None: show = geo[-1] + 1 == geo[0] * geo[1] ax = pl.subplot(ax) return ax, show
Example #13
Source File: _subplots.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def set_subplotspec(self, subplotspec): """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec
Example #14
Source File: axes_divider.py From Computable with MIT License | 5 votes |
def get_subplotspec(self): 'get the SubplotSpec instance' return self._subplotspec
Example #15
Source File: axes_divider.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): 'set the SubplotSpec instance' self._subplotspec = subplotspec
Example #16
Source File: axes_divider.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def get_subplotspec(self): 'get the SubplotSpec instance' return self._subplotspec
Example #17
Source File: _subplots.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec
Example #18
Source File: _subplots.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def get_subplotspec(self): """get the SubplotSpec instance associated with the subplot""" return self._subplotspec
Example #19
Source File: _subplots.py From neural-network-animation with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec
Example #20
Source File: _subplots.py From neural-network-animation with MIT License | 5 votes |
def get_subplotspec(self): """get the SubplotSpec instance associated with the subplot""" return self._subplotspec
Example #21
Source File: axes_divider.py From matplotlib-4-abaqus with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): 'set the SubplotSpec instance' self._subplotspec = subplotspec
Example #22
Source File: axes_divider.py From matplotlib-4-abaqus with MIT License | 5 votes |
def get_subplotspec(self): 'get the SubplotSpec instance' return self._subplotspec
Example #23
Source File: _subplots.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): """set the SubplotSpec instance associated with the subplot""" self._subplotspec = subplotspec
Example #24
Source File: _subplots.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def get_subplotspec(self): """get the SubplotSpec instance associated with the subplot""" return self._subplotspec
Example #25
Source File: axes_divider.py From Computable with MIT License | 5 votes |
def set_subplotspec(self, subplotspec): 'set the SubplotSpec instance' self._subplotspec = subplotspec
Example #26
Source File: axes_divider.py From GraphicDesignPatternByPython with MIT License | 4 votes |
def __init__(self, fig, *args, horizontal=None, vertical=None, aspect=None, anchor='C'): """ Parameters ---------- fig : :class:`matplotlib.figure.Figure` args : tuple (*numRows*, *numCols*, *plotNum*) The array of subplots in the figure has dimensions *numRows*, *numCols*, and *plotNum* is the number of the subplot being created. *plotNum* starts at 1 in the upper left corner and increases to the right. If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*. """ self.figure = fig if len(args) == 1: if isinstance(args[0], SubplotSpec): self._subplotspec = args[0] else: try: s = str(int(args[0])) rows, cols, num = map(int, s) except ValueError: raise ValueError( 'Single argument to subplot must be a 3-digit integer') self._subplotspec = GridSpec(rows, cols)[num-1] # num - 1 for converting from MATLAB to python indexing elif len(args) == 3: rows, cols, num = args rows = int(rows) cols = int(cols) if isinstance(num, tuple) and len(num) == 2: num = [int(n) for n in num] self._subplotspec = GridSpec(rows, cols)[num[0]-1:num[1]] else: self._subplotspec = GridSpec(rows, cols)[int(num)-1] # num - 1 for converting from MATLAB to python indexing else: raise ValueError('Illegal argument(s) to subplot: %s' % (args,)) # total = rows*cols # num -= 1 # convert from matlab to python indexing # # i.e., num in range(0,total) # if num >= total: # raise ValueError( 'Subplot number exceeds total subplots') # self._rows = rows # self._cols = cols # self._num = num # self.update_params() # sets self.fixbox self.update_params() pos = self.figbox.bounds Divider.__init__(self, fig, pos, horizontal or [], vertical or [], aspect=aspect, anchor=anchor)
Example #27
Source File: _subplots.py From ImageFusion with MIT License | 4 votes |
def __init__(self, fig, *args, **kwargs): """ *fig* is a :class:`matplotlib.figure.Figure` instance. *args* is the tuple (*numRows*, *numCols*, *plotNum*), where the array of subplots in the figure has dimensions *numRows*, *numCols*, and where *plotNum* is the number of the subplot being created. *plotNum* starts at 1 in the upper left corner and increases to the right. If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*. """ self.figure = fig if len(args) == 1: if isinstance(args[0], SubplotSpec): self._subplotspec = args[0] else: try: s = str(int(args[0])) rows, cols, num = list(map(int, s)) except ValueError: raise ValueError( 'Single argument to subplot must be a 3-digit ' 'integer') self._subplotspec = GridSpec(rows, cols)[num - 1] # num - 1 for converting from MATLAB to python indexing elif len(args) == 3: rows, cols, num = args rows = int(rows) cols = int(cols) if isinstance(num, tuple) and len(num) == 2: num = [int(n) for n in num] self._subplotspec = GridSpec(rows, cols)[num[0] - 1:num[1]] else: if num < 0 or num > rows*cols: raise ValueError( "num must be 0 <= num <= {maxn}, not {num}".format( maxn=rows*cols, num=num)) if num == 0: warnings.warn("The use of 0 (which ends up being the " "_last_ sub-plot) is deprecated in 1.4 " "and will raise an error in 1.5", mplDeprecation) self._subplotspec = GridSpec(rows, cols)[int(num) - 1] # num - 1 for converting from MATLAB to python indexing else: raise ValueError('Illegal argument(s) to subplot: %s' % (args,)) self.update_params() # _axes_class is set in the subplot_class_factory self._axes_class.__init__(self, fig, self.figbox, **kwargs)
Example #28
Source File: _subplots.py From neural-network-animation with MIT License | 4 votes |
def __init__(self, fig, *args, **kwargs): """ *fig* is a :class:`matplotlib.figure.Figure` instance. *args* is the tuple (*numRows*, *numCols*, *plotNum*), where the array of subplots in the figure has dimensions *numRows*, *numCols*, and where *plotNum* is the number of the subplot being created. *plotNum* starts at 1 in the upper left corner and increases to the right. If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*. """ self.figure = fig if len(args) == 1: if isinstance(args[0], SubplotSpec): self._subplotspec = args[0] else: try: s = str(int(args[0])) rows, cols, num = list(map(int, s)) except ValueError: raise ValueError( 'Single argument to subplot must be a 3-digit ' 'integer') self._subplotspec = GridSpec(rows, cols)[num - 1] # num - 1 for converting from MATLAB to python indexing elif len(args) == 3: rows, cols, num = args rows = int(rows) cols = int(cols) if isinstance(num, tuple) and len(num) == 2: num = [int(n) for n in num] self._subplotspec = GridSpec(rows, cols)[num[0] - 1:num[1]] else: if num < 0 or num > rows*cols: raise ValueError( "num must be 0 <= num <= {maxn}, not {num}".format( maxn=rows*cols, num=num)) if num == 0: warnings.warn("The use of 0 (which ends up being the " "_last_ sub-plot) is deprecated in 1.4 " "and will raise an error in 1.5", mplDeprecation) self._subplotspec = GridSpec(rows, cols)[int(num) - 1] # num - 1 for converting from MATLAB to python indexing else: raise ValueError('Illegal argument(s) to subplot: %s' % (args,)) self.update_params() # _axes_class is set in the subplot_class_factory self._axes_class.__init__(self, fig, self.figbox, **kwargs)
Example #29
Source File: axes_divider.py From CogAlg with MIT License | 4 votes |
def __init__(self, fig, *args, horizontal=None, vertical=None, aspect=None, anchor='C'): """ Parameters ---------- fig : :class:`matplotlib.figure.Figure` *args : tuple (*numRows*, *numCols*, *plotNum*) The array of subplots in the figure has dimensions *numRows*, *numCols*, and *plotNum* is the number of the subplot being created. *plotNum* starts at 1 in the upper left corner and increases to the right. If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*. """ self.figure = fig if len(args) == 1: if isinstance(args[0], SubplotSpec): self._subplotspec = args[0] else: try: s = str(int(args[0])) rows, cols, num = map(int, s) except ValueError: raise ValueError( 'Single argument to subplot must be a 3-digit integer') self._subplotspec = GridSpec(rows, cols)[num-1] # num - 1 for converting from MATLAB to python indexing elif len(args) == 3: rows, cols, num = args rows = int(rows) cols = int(cols) if isinstance(num, tuple) and len(num) == 2: num = [int(n) for n in num] self._subplotspec = GridSpec(rows, cols)[num[0]-1:num[1]] else: self._subplotspec = GridSpec(rows, cols)[int(num)-1] # num - 1 for converting from MATLAB to python indexing else: raise ValueError(f'Illegal argument(s) to subplot: {args}') # total = rows*cols # num -= 1 # convert from matlab to python indexing # # i.e., num in range(0,total) # if num >= total: # raise ValueError( 'Subplot number exceeds total subplots') # self._rows = rows # self._cols = cols # self._num = num # self.update_params() # sets self.fixbox self.update_params() pos = self.figbox.bounds Divider.__init__(self, fig, pos, horizontal or [], vertical or [], aspect=aspect, anchor=anchor)