spateo.configuration
#
Module Contents#
Classes#
Functions#
|
Function to offset the "center" of a colormap. Useful for |
Reset matplotlib.rcParams to defaults. |
|
|
|
|
Configure matplotlib.rcParams to spateo defaults (based on ggplot style and scanpy). |
|
Set resolution/size, styling and format of figures. |
|
formatting helper function that can be used to save publishable figures |
formatting helper function based on mpltex package that can be used to save publishable figures |
Attributes#
- class spateo.configuration.SpateoConfig(logging_level: int = logging.INFO, n_threads: int = os.cpu_count())[source]#
- class spateo.configuration.SpateoAdataKeyManager[source]#
-
- select_layer_data(layer: str, copy: bool = False, make_dense: bool = False) Union[numpy.ndarray, scipy.sparse.spmatrix] [source]#
- set_layer_data(layer: str, vals: numpy.ndarray, var_indices: Optional[numpy.ndarray] = None, replace: bool = False)[source]#
- spateo.configuration.shiftedColorMap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap')[source]#
Function to offset the “center” of a colormap. Useful for data with a negative min and positive max and you want the middle of the colormap’s dynamic range to be at zero.
Input#
cmap : The matplotlib colormap to be altered start : Offset from lowest point in the colormap’s range.
Defaults to 0.0 (no lower offset). Should be between 0.0 and midpoint.
- midpointThe new center of the colormap. Defaults to
0.5 (no shift). Should be between 0.0 and 1.0. In general, this should be 1 - vmax / (vmax + abs(vmin)) For example if your data range from -15.0 to +5.0 and you want the center of the colormap at 0.0, midpoint should be set to 1 - 5/(5 + 15)) or 0.75
- stopOffset from highest point in the colormap’s range.
Defaults to 1.0 (no upper offset). Should be between midpoint and 1.0.
- spateo.configuration.zebrafish_colors = ['#4876ff', '#85C7F2', '#cd00cd', '#911eb4', '#000080', '#808080', '#008080', '#ffc125',...[source]#
- spateo.configuration.config_spateo_rcParams(background='white', prop_cycle=zebrafish_256, fontsize=8, color_map=None, frameon=None)[source]#
Configure matplotlib.rcParams to spateo defaults (based on ggplot style and scanpy). :param background: The background color of the plot. By default we use the white ground
which is suitable for producing figures for publication. Setting it to black background will be great for presentation.
- Parameters
- prop_cycle : list (default: zebrafish_256)
A list with hex color codes
- fontsize : float (default: 6)
Size of font
- color_map : plt.cm or None (default: None)
Color map
- frameon : bool or None (default: None)
Whether to have frame for the figure.
- Returns
Nothing but configure the rcParams globally.
- spateo.configuration.set_figure_params(spateo=True, background='white', fontsize=8, figsize=(6, 4), dpi=None, dpi_save=None, frameon=None, vector_friendly=True, color_map=None, format='pdf', transparent=False, ipython_format='png2x')[source]#
- Set resolution/size, styling and format of figures.
This function is adapted from: https://github.com/theislab/scanpy/blob/f539870d7484675876281eb1c475595bf4a69bdb/scanpy/_settings.py
- Parameters
- spateo : bool (default: True)
Init default values for
matplotlib.rcParams
suited for spateo.- background : str (default: white)
The background color of the plot. By default we use the white ground which is suitable for producing figures for publication. Setting it to black background will be great for presentation.
- fontsize : [float, float] or None (default: 6)
- figsize : (float, float) (default: (6.5, 5))
Width and height for default figure size.
- dpi : int or None (default: None)
Resolution of rendered figures - this influences the size of figures in notebooks.
- dpi_save : int or None (default: None)
Resolution of saved figures. This should typically be higher to achieve publication quality.
- frameon : bool or None (default: None)
Add frames and axes labels to scatter plots.
- vector_friendly : bool (default: True)
Plot scatter plots using png backend even when exporting as pdf or svg.
- color_map : str (default: None)
Convenience method for setting the default color map.
- format : {'png', 'pdf', 'svg', etc.} (default: 'pdf')
This sets the default format for saving figures: file_format_figs.
- transparent : bool (default: False)
Save figures with transparent back ground. Sets rcParams[‘savefig.transparent’].
- ipython_format : list of str (default: ‘png2x’)
Only concerns the notebook/IPython environment; see IPython.core.display.set_matplotlib_formats for more details.