shellplot.figure.Figure

class shellplot.figure.Figure(figsize: Optional[Tuple[int]] = None, xlim: Optional[Any] = None, xticks: Optional[Any] = None, xticklabels: Optional[Any] = None, xlabel: Optional[str] = None, ylim: Optional[Any] = None, yticks: Optional[Any] = None, yticklabels: Optional[Any] = None, ylabel: Optional[str] = None, title: Optional[str] = None, **kwargs)[source]

Encapsulates a shellplot figure.

__init__(figsize: Optional[Tuple[int]] = None, xlim: Optional[Any] = None, xticks: Optional[Any] = None, xticklabels: Optional[Any] = None, xlabel: Optional[str] = None, ylim: Optional[Any] = None, yticks: Optional[Any] = None, yticklabels: Optional[Any] = None, ylabel: Optional[str] = None, title: Optional[str] = None, **kwargs) None[source]

Instantiate a new figure

Parameters
  • figsize (a tuple (width, height) in ascii characters, optional) – Size of the figure.

  • xlim (2-tuple/list, optional) – Set the x limits.

  • xticks (Optional[array_like], optional) – [description], by default None

  • xticklabels (Optional[array_like], optional) – [description], by default None

  • xlabel (Optional[str], optional) – Name to use for the xlabel on x-axis.

  • ylim (2-tuple/list, optional) – Set the y limits.

  • yticks (Optional[array_like], optional) – [description], by default None

  • yticklabels (Optional[array_like], optional) – [description], by default None

  • ylabel (Optional[str], optional) – Name to use for the ylabel on y-axis.

  • title (Optional[str], optional) – The title of the figure.

Methods

__init__([figsize, xlim, xticks, ...])

Instantiate a new figure

barh(x, **kwargs)

Plot horizontal bars

boxplot(x, **kwargs)

Plot a boxplot of x

clear()

Clear the figure, by removing all attached plots.

draw()

Draw the figure as a string

hist(x, **kwargs)

Plot a histogram of x

plot(x, y[, color])

Plot x versus y as scatter.

set_title(value)

set_xlabel(value)

Set the label of the x-axis

set_xlim(value)

Set limits of x-axis

set_xticklabels(value)

Set x-axis tick labels.

set_xticks(value)

Set x-axis ticks

set_ylabel(value)

Set y-axis tick labels.

set_ylim(value)

Set limits of y-axis

set_yticklabels(value)

Set y-axis tick labels.

set_yticks(value)

Set y-axis ticks

show()

Show the figure by printing to stdout.

barh(x: Any, **kwargs) None[source]

Plot horizontal bars

Parameters
  • x (array-like) – The width of the horizontal bars. Should be 1d np.ndarray or pandas series.

  • labels (array-like) – Array that is used to label the bars. Needs to have the same dim as x.

boxplot(x: Any, **kwargs) None[source]

Plot a boxplot of x

Note that currently this makes a boxplot using the quantiles: [0, 0.25, 0.5, 0.75, 1.0] - i.e. it the whiskers will not exclude outliers

Parameters
  • x (array-like) – The horizontal coordinates of the data points. Can be 1d or 2d np.ndarray/ pandas series/ dataframe. If 2d, each 1d slice will be plotted as a separate boxplot.

  • labels (array-like) – Array that is used to label the boxplots.

clear() None[source]

Clear the figure, by removing all attached plots.

draw() str[source]

Draw the figure as a string

Returns

Ascii string of figure

Return type

str

hist(x: Any, **kwargs) None[source]

Plot a histogram of x

Parameters
  • x (array-like) – The array of points to plot a histogram of. Should be 1d np.ndarray or pandas series.

  • bins (int, optional) – Number of bins in histogram. Default is 10 bins.

  • label (str) – The label of the plot for display in the legend

plot(x: Any, y: Any, color=None, **kwargs) None[source]

Plot x versus y as scatter.

Parameters
  • x (array-like) – The horizontal coordinates of the data points. Should be 1d or 2d np.ndarray or pandas series

  • y (array-like) – The vertical coordinates of the data points. Should be 1d or 2d np.ndarray or pandas series

  • color (array, optional) – Color of scatter. Needs to be of same dimension as x, y Should be 1-d np.ndarray or pandas series

  • line (bool, optional, default False) – Whether a line should be plotted using the x, y points. This will use a linear interpolation of the points.

  • label (str) – The label of the plot for display in the legend

set_xlabel(value)[source]

Set the label of the x-axis

set_xlim(value)[source]

Set limits of x-axis

set_xticklabels(value)[source]

Set x-axis tick labels.

set_xticks(value)[source]

Set x-axis ticks

set_ylabel(value)[source]

Set y-axis tick labels.

set_ylim(value)[source]

Set limits of y-axis

set_yticklabels(value)[source]

Set y-axis tick labels.

set_yticks(value)[source]

Set y-axis ticks

show() None[source]

Show the figure by printing to stdout.

Return type

None