xtgeoviz.plot.baseplot module

The baseplot module.

class xtgeoviz.plot.baseplot.BasePlot[source]

Bases: object

Base class for plots, proviridisding some functions to share.

Init method.

property contourlevels

Get or set the number of contour levels.

property colormap

Get or set the color table as a matplot cmap object.

property pagesize

Returns page size.

static define_any_colormap(cfile, colorlist=None)[source]

Defines any color map from file or a predefined name.

This is a static method, which returns a matplotlib CM object.

Parameters:
  • cfile (str) – File name (RMS format) or an alias for a predefined map name, e.g. ‘xtgeo’, or one of matplotlibs numerous tables.

  • colorlist (list, int, optional) – List of integers redefining color entries per zone and/or well, which starts from 0 index. Default is just keep the linear sequence as is.

static get_any_colormap_as_table(cmap)[source]

Returns the given color map cmap as a list of RGB tuples.

get_colormap_as_table()[source]

Get the current color map as a list of RGB tuples.

define_colormap(cfile, colorlist=None)[source]

Defines a color map from file or a predefined name.

Parameters:
  • cfile (str) – File name (RMS format) or an alias for a predefined map name, e.g. ‘xtgeo’, or one of matplotlibs numerous tables.

  • colorlist (list, int, optional) – List of integers redefining color entries per zone and/or well, which starts from 0 index. Default is just keep the linear sequence as is.

canvas(title=None, subtitle=None, infotext=None, figscaling=1.0)[source]

Prepare the canvas to plot on, with title and subtitle.

Parameters:
  • title (str, optional) – Title of plot.

  • subtitle (str, optional) – Sub title of plot.

  • infotext (str, optional) – Text to be written as info string.

  • figscaling (str, optional) – Figure scaling, default is 1.0

show()[source]

Call to matplotlib.pyplot show method.

Returns:

True of plotting is done; otherwise False

close()[source]

Explicitly closes the plot, meaning that memory will be cleared. After close is called, no more operations can be performed on the plot.

savefig(filename, fformat='png', last=True, **kwargs)[source]

Call to matplotlib.pyplot savefig method.

Parameters:
  • filename (str) – File to plot to

  • fformat (str) – Plot format, e.g. png (default), jpg, svg

  • last (bool) – Default is true, calls close on the plot, let last be False for all except the last plots.

  • kwargs – Additional keyword arguments that are passed to matplotlib when saving the figure

Returns:

True of plotting is done; otherwise False

Example:

myplot.savefig('TMP/layerslice.svg', fformat='svg', last=False)
myplot.savefig('TMP/layerslice.png')

Changed in version 2.4: added kwargs option