xomics.plot_settings

xomics.plot_settings(font_scale=1, font='Arial', weight_bold=True, adjust_only_font=False, adjust_further_elements=True, grid=False, grid_axis='y', no_ticks=False, short_ticks=False, no_ticks_x=False, short_ticks_x=False, no_ticks_y=False, short_ticks_y=False, show_options=False)[source]

Configures general plot settings.

This function modifies the global settings of matplotlib and seaborn libraries. It adjusts font embedding for vector formats like PDF and SVG, ensuring compatibility and editability across various viewers and editing software.

Parameters:
  • font_scale (float) – Scaling factor to scale the size of font elements. Consistent with seaborn.set_context().

  • font (str) – Name of text font. Common options are ‘Arial’, ‘Verdana’, ‘Helvetica’, or ‘DejaVu Sans’ (Matplotlib default).

  • weight_bold (bool) – If True, font and line elements are bold.

  • adjust_only_font (bool) – If True, only the font style will be adjusted, leaving other elements unchanged.

  • adjust_further_elements (bool) – If True, makes additional visual and layout adjustments to the plot (errorbars, legend).

  • grid (bool) – If True, display the grid in plots.

  • grid_axis (str) – Choose the axis (‘y’, ‘x’, ‘both’) to apply the grid to.

  • no_ticks (bool) – If True, remove all tick marks on both x and y axes.

  • short_ticks (bool) – If True, display short tick marks on both x and y axes. Is ignored if no_ticks=True.

  • no_ticks_x (bool) – If True, remove tick marks on the x-axis.

  • short_ticks_x (bool) – If True, display short tick marks on the x-axis. Is ignored if no_ticks=True.

  • no_ticks_y (bool) – If True, remove tick marks on the y-axis.

  • short_ticks_y (bool) – If True, display short tick marks on the y-axis. Is ignored if no_ticks=True.

  • show_options (bool) – If True, show all plot runtime configurations of matplotlib.

Examples

Create default seaborn plot:

>>> import matplotlib.pyplot as plt
>>> import seaborn as sns
>>> import xomics as xo
>>> data = {'Classes': ['Class A', 'Class B', 'Class C'], 'Values': [23, 27, 43]}
>>> sns.barplot(x='Classes', y='Values', data=data)
>>> sns.despine()
>>> plt.title("Seaborn default")
>>> plt.tight_layout()
>>> plt.show()

(Source code, png, hires.png, pdf)

../_images/xomics-plot_settings-1.png

Adjust polts with xOmics:

>>> import matplotlib.pyplot as plt
>>> import seaborn as sns
>>> import xomics as xo
>>> data = {'Classes': ['Class A', 'Class B', 'Class C'], 'Values': [23, 27, 43]}
>>> colors = xo.plot_get_clist()
>>> xo.plot_settings()
>>> sns.barplot(data=data, x='Classes', y='Values', palette=colors, hue="Classes", legend=False)
>>> sns.despine()
>>> plt.title("Adjusted")
>>> plt.tight_layout()
>>> plt.show()

(Source code, png, hires.png, pdf)

../_images/xomics-plot_settings-2.png

See also