mlchem.chem.visualise package¶
Submodules¶
mlchem.chem.visualise.drawing module¶
- class MolDrawer¶
Bases:
objectMolDrawer is a utility class for rendering molecular structures with customisable visual styles and annotations.
This class provides a flexible interface for drawing molecules using RDKit, with support for highlighting atoms, adjusting drawing styles, displaying legends, and visualising similarity or weight maps.
- mol¶
The molecule to be drawn.
- Type:
rdkit.Chem.rdchem.Mol or None
- highlightAtoms¶
List of atom indices to highlight.
- Type:
list
- size¶
Canvas size in pixels as [width, height].
- Type:
list[int, int]
- legend¶
Text to display as a legend below the molecule.
- Type:
str
- colour_dictionary¶
Predefined colour palette for drawing.
- Type:
dict
- drawing_options¶
Dictionary of drawing parameters and visual styles.
- Type:
dict
- __init__(...)¶
Initialise the MolDrawer with molecule, size, highlights, and legend.
- show_palette(...)¶
Display or save the colour palette used for drawing.
- update_drawing_options(...)¶
Update drawing options using a dictionary or keyword arguments.
- reset_drawing_options()¶
Reset drawing options to their default values.
- draw_mol(...)¶
Render a single molecule with the current drawing settings.
- load_images(...)¶
Load external images into the drawer.
- load_mols(...)¶
Load molecules and generate their images.
- show_images_grid(...)¶
Display all loaded images in a grid layout.
- __init__(mol: Mol | None = None, highlightAtoms: Iterable = [], size: Iterable = [300, 300], legend: str = '') None¶
Initialise the MolDrawer class for molecular visualisation.
This class sets up the molecule, drawing canvas, highlighting options, and default drawing styles for rendering molecular structures.
- Parameters:
mol (rdkit.Chem.rdchem.Mol or None, optional) – The molecule to be drawn. Default is None.
highlightAtoms (Iterable, optional) – List of atom indices to highlight. Default is an empty list.
size (Iterable, optional) – Canvas size as (width, height) in pixels. Default is [300, 300].
legend (str, optional) – Text to display as a legend below the molecule. Default is an empty string.
- Return type:
None
- draw_mol(mol: Mol = None, legend: str = '', highlightAtoms: Iterable = [], size: Iterable = None, ACS1996_mode: bool = False) Image¶
Render and return an image of a single molecule using the current drawing options.
This method draws a molecule with optional atom highlighting, legend text, custom canvas size, and support for ACS 1996-style rendering. It uses the drawing configuration stored in the MolDrawer instance.
- Parameters:
mol (rdkit.Chem.rdchem.Mol, optional) – The molecule to be drawn. If None, uses the molecule stored in self.mol.
legend (str, optional) – Text to display below the molecule as a legend. Default is an empty string.
highlightAtoms (Iterable, optional) – List of atom indices to highlight. Default is an empty list.
size (Iterable[int, int], optional) – Canvas size in pixels as (width, height). If None, uses self.size.
ACS1996_mode (bool, default=False) – If True, applies ACS 1996-style drawing conventions.
- Returns:
The rendered image of the molecule.
- Return type:
PIL.Image.Image
Examples
>>> mol = Chem.MolFromSmiles("CCO") >>> drawer = MolDrawer() >>> img = drawer.draw_mol(mol, legend="Ethanol", highlightAtoms=[1])
- load_images(img_list: Iterable[Image] | Image) None¶
Load images into the drawer without adding molecules.
This method allows you to load one or more pre-rendered images into the MolDrawer instance. These images can be used for visualisation, layout composition, or exporting as part of a grid. This method is equivalent to overwrite the img_list attribute.
- Parameters:
img_list (PIL.Image.Image or Iterable[PIL.Image.Image]) – A single image or a list of images to be added to the drawer.
- Return type:
None
Examples
>>> from PIL import Image >>> img = Image.open("example.png") >>> drawer = MolDrawer() >>> drawer.load_images(img)
>>> drawer.load_images([img1, img2, img3])
- load_mols(mols: Mol | Iterable[Mol]) None¶
Load molecules and generate standard images in the drawer.
This method accepts one or more RDKit molecule objects, stores them in the drawer, and generates their corresponding images using the default or customised drawing options. These images are stored internally and can be displayed later in a grid or individually.
- Parameters:
mols (rdkit.Chem.rdchem.Mol or Iterable[rdkit.Chem.rdchem.Mol]) – A single molecule or an iterable of molecules to be loaded and rendered.
- Return type:
None
Examples
>>> from rdkit import Chem >>> mol1 = Chem.MolFromSmiles("CCO") >>> mol2 = Chem.MolFromSmiles("c1ccccc1") >>> drawer = MolDrawer() >>> drawer.load_mols([mol1, mol2])
- reset_drawing_options() None¶
Reset the drawing options to their default values.
This method reinitialises the internal drawing options dictionary to the default configuration defined in a fresh instance of the MolDrawer class. It is useful when you want to discard all customisations and revert to the original visual style.
- Return type:
None
Examples
>>> drawer = MolDrawer() >>> drawer.update_drawing_options(atomPalette='avalon', rotate=90) >>> drawer.reset_drawing_options() # Reverts to default settings
- show_images_grid(images: Iterable[Image] = None, n_columns: int = 4, size: Iterable = None, buffer: int = 5, empty_tile_colour: str = 'white', save: bool = False, filename: str = '') None¶
Display all images arranged in a grid layout.
This method arranges a list of images into a grid and displays them using IPython. It supports customisation of the number of columns, image size, spacing between images, and background colour for empty tiles. Optionally, the grid can be saved to a file.
- Parameters:
images (Iterable[PIL.Image.Image], optional) – A list of images to be arranged in the grid. If None, uses the images stored in self.img_list.
n_columns (int, default=4) – Number of columns in the grid layout.
size (Iterable[int, int], optional) – Size of each image in pixels as (width, height). If None, uses the default size from self.size.
buffer (int, default=5) – Space in pixels between images in the grid.
empty_tile_colour (str, default='white') – Background colour for empty tiles. Must be a valid key in the colour_dictionary attribute.
save (bool, default=False) – If True, saves the grid image to a file.
filename (str, default='') – Filename to save the image if save is True.
- Return type:
None
- Raises:
AssertionError – If empty_tile_colour is not in the colour dictionary or if size is not a 2-element iterable.
Examples
>>> drawer = MolDrawer() >>> drawer.load_images([img1, img2, img3]) >>> drawer.show_images_grid(n_columns=2, buffer=10)
>>> drawer.show_images_grid(save=True, filename="grid_output.png")
- show_palette(palette: dict | None = None, save: bool = False, filename: str = '', size: Iterable = [1000, 300]) Image¶
Display the colour palette used for molecular drawings.
This method visualises the colour palette as an image. If no palette is provided, the default colour_dictionary is used. The image can also be saved to a file.
- Parameters:
palette (dict or None, optional) – A dictionary mapping colour names to RGB values. If None, uses the default palette from self.colour_dictionary.
save (bool, optional) – If True, saves the palette image to a file. Default is False.
filename (str, optional) – Filename to save the image if save is True. Default is an empty string.
size (Iterable, optional) – Size of the image in pixels as (width, height). Default is [1000, 300].
- Returns:
The image object representing the colour palette.
- Return type:
PIL.Image.Image
Examples
>>> drawer = MolDrawer() >>> drawer.show_palette() >>> drawer.show_palette(save=True, filename="palette.png")
- update_drawing_options(**args) None¶
Update the RDKit drawing options.
This method allows customisation of the molecule rendering style by updating the internal drawing options dictionary. Users can pass either a full or partial dictionary of options, or use keyword arguments directly.
- Parameters:
**args (dict) –
Keyword arguments representing drawing options. These can include:
- atomPalettestr or dict, default=’cdk’
Atom colour scheme. Options: ‘avalon’, ‘cdk’, ‘bw’, or a dictionary mapping atomic numbers to RGB tuples.
- backgroundColourstr or tuple, default=’white’
Background colour of the canvas.
- highlightColourstr or tuple, default=’tomato’
Colour used for highlighting atoms or bonds.
- highlightAlphafloat, default=1
Transparency of the highlight colour (0 = transparent, 1 = opaque).
- queryColourstr or tuple, default=’red’
Colour used for SMARTS query atoms.
- annotationColourstr or tuple, default=’black’
Colour for annotations (e.g., atom/bond notes).
dummiesAreAttachments : bool, default=False
addAtomIndices : bool, default=False
addBondIndices : bool, default=False
noAtomLabels : bool, default=False
explicitMethyl : bool, default=False
includeRadicals : bool, default=True
useComplexQueryAtomSymbols : bool, default=True
singleColourWedgeBonds : bool, default=False
drawMolsSameScale : bool, default=False
continuousHighlight : bool, default=True
circleAtoms : bool, default=True
atomHighlightsAreCircles : bool, default=True
fillHighlights : bool, default=True
highlightRadius : float, default=0.3
highlightBondWidthMultiplier : float, default=10
addStereoAnnotation : bool, default=False
unspecifiedStereoIsUnknown : bool, default=False
baseFontSize : float, default=0.6
annotationFontScale : float, default=0.5
legendFontSize : int, default=25
fixedFontSize : int, default=-1
minFontSize : int, default=6
maxFontSize : int, default=40
- fontFilestr, default=’’
Path to a custom font file.
multipleBondOffset : float, default=0.15
additionalAtomLabelPadding : float, default=0
bondLineWidth : float, default=2
scaleBondWidth : bool, default=False
scaleHighlightBondWidth : bool, default=True
fixedBondLength : float, default=-1
atomWeights : list, default=[]
mapStyle : {‘GC’, ‘C’}, default=’GC’
colourMap : str or list of RGB tuples, default=None
positiveColour : str or tuple, default=’green’
negativeColour : str or tuple, default=’mediumvioletred’
numContours : int, default=10
weightAlpha : float, default=0.2
scalingFactor : float, default=2
minRadius : float, default=2
maxRadius : float, default=30
mapRes : float, default=0.5
contourColour : str or tuple, default=’black’
contourWidth : float, default=1
dashNegative : bool, default=True
shapeTypes : list, default=[]
shapeSizes : list, default=[]
shapeColours : list, default=[]
shapeCoords : list, default=[]
clearBackground : bool, default=True
prepareMolsBeforeDrawing : bool, default=True
rotate : float, default=0
padding : float, default=0.05
atomLabelDeuteriumTritium : bool, default=False
- Return type:
None
Examples
>>> drawer = MolDrawer() >>> drawer.update_drawing_options(atomPalette='avalon', backgroundColour='white')
>>> options = {'highlightColour': 'orange', 'rotate': 90} >>> drawer.update_drawing_options(**options)
mlchem.chem.visualise.simmaps module¶
- class SimMaps¶
Bases:
object- static get_similarity_map_from_weights(mol: Mol, weights: Iterable, colorMap=None, scale: int = -1, size: tuple = (250, 250), sigma=None, coordScale: int | float = 1.5, step: float = 0.01, contour_colour: str | tuple = 'black', contourLines: int = 10, alpha: float = 0.5, contour_width: int | float = 1, resolution: float = 0.05, dash_negative: bool = True, draw2d=None, **kwargs) MolDraw2D | Figure¶
Generate a similarity map visualisation from atomic weights.
This method overlays a similarity map on a molecule using atomic weights, with optional contour lines and colour maps.
Adapted from RDKit (https://www.rdkit.org), originally licensed under the BSD 3-Clause License.
- Parameters:
mol (rdkit.Chem.rdchem.Mol) – The molecule to visualise.
weights (Iterable) – Atomic weights to visualise.
colorMap (str or list or matplotlib colormap, optional) – Colour map to use. If None, a custom PiWG colour map is used.
scale (int, default=-1) – Scaling factor. If negative, uses the maximum absolute weight.
size (tuple, default=(250, 250)) – Size of the output image.
sigma (float, optional) – Gaussian width. If None, estimated from bond lengths.
coordScale (float, default=1.5) – Scaling factor for coordinates.
step (float, default=0.01) – Step size for Gaussian calculation.
contour_colour (str or tuple, default='black') – Colour of contour lines. Can be a string or RGB tuple.
contourLines (int or list, default=10) – Number of contour lines or specific contour levels.
alpha (float, default=0.5) – Transparency of contour lines.
contour_width (float, default=1) – Width of contour lines.
resolution (float, default=0.05) – Grid resolution for contour plotting.
dash_negative (bool, default=True) – Whether to use dashed lines for negative weights.
draw2d (rdkit.Chem.Draw.rdMolDraw2D.MolDraw2D, optional) – RDKit drawing object. Required for rendering.
**kwargs (dict) – Additional keyword arguments passed to matplotlib drawing.
- Returns:
If draw2d is provided, returns the modified drawing object. Otherwise, returns a matplotlib figure.
- Return type:
rdMolDraw2D.MolDraw2D or matplotlib.figure.Figure
- Raises:
ValueError – If draw2d is not provided or the molecule has fewer than 2 atoms.
Examples
>>> SimMaps.get_similarity_map_from_weights(mol, weights, draw2d=drawer)
- static get_weights_from_fingerprint(refmol: Mol, probemol: Mol, fp_type: Literal['m', 'ap', 'rk', 'tt'] = 'm', similarity_metric: Literal['Tanimoto', 'Dice', 'Cosine', 'Sokal', 'Russel', 'RogotGoldberg', 'AllBit', 'OnBit', 'Kulczynski', 'McConnaughey', 'Asymmetric', 'BraunBlanquet', 'Tversky'] = 'Tanimoto', normalise: bool = False, return_df: bool = False, **kwargs) Iterable | DataFrame¶
Get atomic importance weights based on fingerprint similarity.
This method calculates atomic contributions by masking atoms in the probe molecule and computing the change in similarity to a reference molecule.
- Parameters:
refmol (rdkit.Chem.rdchem.Mol) – The reference molecule.
probemol (rdkit.Chem.rdchem.Mol) – The probe molecule whose atoms will be masked.
fp_type ({'m', 'ap', 'rk', 'tt'}, default='m') – Type of fingerprint to use.
similarity_metric (str, default='Tanimoto') – Similarity metric to use. Options include: ‘Tanimoto’, ‘Dice’, ‘Cosine’, ‘Sokal’, ‘Russel’, ‘RogotGoldberg’, ‘AllBit’, ‘OnBit’, ‘Kulczynski’, ‘McConnaughey’, ‘Asymmetric’, ‘BraunBlanquet’, ‘Tversky’.
normalise (bool, optional) – If True, normalises the weights to the range (-1, 1). Default is False.
return_df (bool, optional) – If True, returns a pandas DataFrame. Otherwise, returns a NumPy array.
**kwargs (dict) – Additional fingerprint-specific parameters. See below.
Parameters (Fingerprint)
----------------------
('m') (Morgan)
radius (-)
fpType (-)
atomId (-)
nBits (-)
useFeatures (-)
('ap') (Atom Pair)
fpType
atomId
nBits
minLength (-)
maxLength (-)
nBitsPerEntry (-)
('tt') (Topological Torsion)
fpType
atomId
nBits
targetSize (-)
nBitsPerEntry
('rk') (RDKit)
fpType
atomId
nBits
minPath (-)
maxPath (-)
nBitsPerHash (-)
- Returns:
Atomic contributions to similarity. Format depends on return_df.
- Return type:
Iterable or pandas.DataFrame
Examples
>>> SimMaps.get_weights_from_fingerprint(refmol, probemol, fp_type='m')
- static get_weights_from_model(mol_input: Mol | str, estimator, estimator_cols: Iterable, model_type: Literal['regression', 'classification'], actual_val: float, fp_type: Literal['m', 'ap', 'tt', 'rk'], normalise: bool = False, return_df: bool = False, **kwargs) Iterable | DataFrame¶
Get atomic importance weights from a predictive model using masked fingerprints.
This method calculates atomic contributions by iteratively masking each atom in the molecule and evaluating the change in model prediction.
- Parameters:
mol_input (rdkit.Chem.rdchem.Mol or str) – The input molecule as an RDKit Mol object or a SMILES string.
estimator (sklearn.base.BaseEstimator) – A trained scikit-learn estimator.
estimator_cols (Iterable) – Feature names used by the estimator.
model_type ({'regression', 'classification'}) – Type of model. Must be either ‘regression’ or ‘classification’.
actual_val (float) – The actual value predicted by the model. For classification, this is the probability of class 1; for regression, the continuous target value.
fp_type ({'m', 'ap', 'tt', 'rk'}) – Type of fingerprint to use: - ‘m’: Morgan - ‘ap’: Atom Pair - ‘tt’: Topological Torsion - ‘rk’: RDKit
normalise (bool, optional) – If True, normalises the weights to the range (-1, 1). Default is False.
return_df (bool, optional) – If True, returns a pandas DataFrame. Otherwise, returns a NumPy array.
**kwargs (dict) – Additional fingerprint-specific parameters. See below.
Parameters (Fingerprint)
----------------------
('m') (Morgan)
radius (-) – Radius of the Morgan fingerprint.
fpType (-) – Type of fingerprint: bit vector (‘bv’) or count-based.
atomId (-) – Atom to mask. -1 means no masking.
nBits (-) – Size of the bit vector.
useFeatures (-) – If True, uses FeatureMorgan; otherwise, ConnectivityMorgan.
('ap') (Atom Pair)
fpType
atomId
nBits
minLength (-)
maxLength (-)
nBitsPerEntry (-)
('tt') (Topological Torsion)
fpType
atomId
nBits
targetSize (-)
nBitsPerEntry
('rk') (RDKit)
fpType
atomId
nBits
minPath (-)
maxPath (-)
nBitsPerHash (-)
- Returns:
Atomic contributions to model prediction. Format depends on return_df.
- Return type:
Iterable or pandas.DataFrame
Examples
>>> SimMaps.get_weights_from_model("CCO", model, feature_names, "regression", 0.85, "m")
mlchem.chem.visualise.space module¶
- class ChemicalSpace¶
Bases:
objectA module to compute and visualise datasets in a compressed embedded space.
This class handles descriptor processing, dimensionality reduction, and preparation of molecular data for interactive visualisation.
- Parameters:
data (pd.DataFrame) – A DataFrame with 3 or 4 columns: ‘SMILES’, ‘NAME’, ‘CLASS’, and optionally ‘METADATA’.
needs_cleaning (bool, optional) – Whether the data requires cleaning. Default is False.
df_descriptors (pd.DataFrame, optional) – A DataFrame with SMILES as index and descriptor columns.
metadata_exists (bool, optional) – True if a 4th column is present in data. Default is False.
metadata_categorical (bool, optional) – True if the 4th column is categorical. Default is False.
- Raises:
ValueError – If the input data does not have the expected column structure.
- __init__(data: DataFrame, needs_cleaning: bool = False, df_descriptors: DataFrame = None, metadata_exists: bool = False, metadata_categorical: bool = False)¶
Initialise a ChemicalSpace object for visualising molecular datasets in a compressed embedded space.
This constructor sets up the molecular data, descriptor matrix, and metadata flags. It also validates the structure of the input data and loads default Bokeh visualisation settings.
- Parameters:
data (pd.DataFrame) – A DataFrame with either 3 or 4 columns: - ‘SMILES’: SMILES strings of the molecules. - ‘NAME’: Names or identifiers of the molecules. - ‘CLASS’: Class labels for grouping or colouring. - ‘METADATA’ (optional): Additional metadata for further grouping.
needs_cleaning (bool, optional) – Whether the data requires cleaning before processing. Default is False.
df_descriptors (pd.DataFrame, optional) – A DataFrame with SMILES as index and molecular descriptors as columns.
metadata_exists (bool, optional) – True if a fourth column (‘METADATA’) is present in data. Default is False.
metadata_categorical (bool, optional) – True if the metadata column is categorical. Default is False.
- Raises:
ValueError – If the data DataFrame does not have the expected column structure.
Notes
If df_descriptors is not provided, a message will be printed to remind the user to supply descriptors before visualisation.
Examples
>>> cs = ChemicalSpace(data=df, df_descriptors=desc_df, metadata_exists=True)
- plot(colour_list: list = None, shape_list: list = None, filename: str = '', title: str = '', title_fontsize: int = 25, height: int = 650, width: int = 866, marker_size: int = 10, save_html: bool = False) None¶
Generate a 2D scatter plot of the chemical space using Bokeh.
This method visualises the compressed chemical space using a scatter plot, with options to customise colours, shapes, size, and layout. It supports categorical metadata and can optionally save the plot as an HTML file.
- Parameters:
colour_list (list, optional) – List of colours for the plot markers. Each class will be assigned a colour. If not provided, defaults to: [‘Blue’, ‘Orange’, ‘Red’, ‘Black’, ‘Green’, ‘Cyan’, ‘Magenta’, ‘Yellow’].
shape_list (list, optional) – List of marker shapes. If not provided, defaults to: [‘circle’, ‘triangle’, ‘square’, ‘star’, ‘diamond’, ‘cross’, ‘x’, ‘asterisk’].
filename (str, optional) – Name of the file to save the plot as (without extension).
title (str, optional) – Title of the plot.
title_fontsize (int, optional) – Font size of the plot title. Default is 25.
height (int, optional) – Height of the plot in pixels. Default is 650.
width (int, optional) – Width of the plot in pixels. Default is 866 (650 / 0.75).
marker_size (int, optional) – Size of the plot markers. Default is 10.
save_html (bool, optional) – Whether to save the plot as an HTML file. Default is False.
- Returns:
Displays the plot in a Jupyter notebook and optionally saves it as HTML.
- Return type:
None
Examples
>>> chem_space.plot( ... colour_list=['blue', 'green'], ... shape_list=['circle', 'square'], ... filename='my_plot', ... title='Chemical Space', ... save_html=True ... )
- prepare(df_compressed: DataFrame)¶
Prepare the compressed dataframe for visualisation.
This method adds molecular structure files, names, and metadata to the compressed coordinates.
- Parameters:
df_compressed (pd.DataFrame) – A DataFrame with two columns [‘DIM_1’, ‘DIM_2’] representing the compressed coordinates of the molecules.
- Returns:
Updates the instance with prepared data for visualisation.
- Return type:
None
- Raises:
AssertionError – If df_compressed does not have exactly two columns named [‘DIM_1’, ‘DIM_2’].
ValueError – If the index of df_compressed or df_processed is not a series of SMILES strings.
Examples
>>> chem_space.prepare(df_compressed)
- process(diversity_filter: float | None, collinearity_filter: float | None, standardise: bool = True)¶
Process the descriptor data by applying diversity and collinearity filters, and optionally standardising the data.
- Parameters:
diversity_filter (float or None) – A float between 0 and 1. Higher values apply stricter filtering to remove less diverse descriptors.
collinearity_filter (float or None) – A float between 0 and 1. Higher values apply looser filtering to remove more collinear descriptors.
standardise (bool, optional) – Whether to standardise the filtered descriptor data. Default is True.
- Returns:
Updates the instance with processed descriptor data.
- Return type:
None
- Raises:
AssertionError – If diversity_filter or collinearity_filter are outside [0, 1).
Examples
>>> chem_space = ChemicalSpace(data, df_descriptors) >>> chem_space.process(diversity_filter=0.5, collinearity_filter=0.3)
- reset_bokeh_options()¶
Reset Bokeh plot options to their default values.
- Return type:
None
Examples
>>> chem_space.reset_bokeh_options()
- reset_bokeh_tooltips()¶
Reset Bokeh tooltips to their default values.
- Return type:
None
Examples
>>> chem_space.reset_bokeh_tooltips()
- update_bokeh_options(**args) None¶
Update the Bokeh plot options.
This method allows customisation of various Bokeh plot parameters for visualisations. Users can pass keyword arguments to set options such as title properties, legend properties, and axis properties.
- Parameters:
title_location (str, optional) – Location of the title. Options: ‘above’, ‘below’, ‘left’, ‘right’.
title_fontsize (str, optional) – Font size of the title (e.g., ‘25px’).
title_align (str, optional) – Alignment of the title. Options: ‘left’, ‘center’, ‘right’.
title_background_fill_colour (str, optional) – Background colour of the title.
title_text_colour (str, optional) – Text colour of the title.
legend_location (str, optional) – Location of the legend. Options: ‘top_left’, ‘top_center’, ‘top_right’, ‘center_right’, ‘bottom_right’, ‘bottom_center’, ‘bottom_left’, ‘center_left’, ‘center’.
legend_title (str, optional) – Title of the legend.
legend_label_text_font (str, optional) – Font of the legend labels (e.g., ‘times’).
legend_label_text_font_style (str, optional) – Font style of the legend labels (e.g., ‘italic’).
legend_label_text_colour (str, optional) – Text colour of the legend labels.
legend_border_line_width (int, optional) – Line width of the legend border.
legend_border_line_colour (str, optional) – Line colour of the legend border.
legend_border_line_alpha (float, optional) – Transparency of the legend border (0 to 1).
legend_background_fill_colour (str, optional) – Background colour of the legend.
legend_background_fill_alpha (float, optional) – Transparency of the legend background (0 to 1).
xaxis_label (str, optional) – Label of the x-axis.
xaxis_line_width (int, optional) – Line width of the x-axis.
xaxis_line_colour (str, optional) – Line colour of the x-axis.
xaxis_major_label_text_colour (str, optional) – Text colour of the x-axis major labels.
xaxis_major_label_orientation (str, optional) – Orientation of the x-axis major labels. Options: ‘horizontal’, ‘vertical’.
yaxis_label (str, optional) – Label of the y-axis.
yaxis_line_width (int, optional) – Line width of the y-axis.
yaxis_line_colour (str, optional) – Line colour of the y-axis.
yaxis_major_label_text_colour (str, optional) – Text colour of the y-axis major labels.
yaxis_major_label_orientation (str, optional) – Orientation of the y-axis major labels. Options: ‘horizontal’, ‘vertical’.
axis_minor_tick_in (int, optional) – Length of the minor ticks inward.
axis_minor_tick_out (int, optional) – Length of the minor ticks outward.
- Return type:
None
Examples
>>> plot.update_bokeh_options( ... title_location='above', ... title_fontsize='20px', ... legend_location='top_right', ... xaxis_label='PC1', ... yaxis_label='PC2' ... )