# bayespy.plot.Plotter¶

class `bayespy.plot.``Plotter`(plotter, *args, **kwargs)[source]

Wrapper for plotting functions and base class for node plotters

The purpose of this class is to collect all the parameters needed by a plotting function and provide a callable interface which needs only the node as the input.

Plotter instances are callable objects that plot a given node using a specified plotting function.

Parameters
plotterfunction

Plotting function to use

argsdefined by the plotting function

Additional inputs needed by the plotting function

kwargsdefined by the plotting function

Additional keyword arguments supported by the plotting function

Examples

First, create a gamma variable:

```>>> import numpy as np
>>> from bayespy.nodes import Gamma
>>> x = Gamma(4, 5)
```

The probability density function can be plotted as:

```>>> import bayespy.plot as bpplt
>>> bpplt.pdf(x, np.linspace(0.1, 10, num=100))
[<matplotlib.lines.Line2D object at 0x...>]
```

However, this can be problematic when one needs to provide a plotting function for the inference engine as the inference engine gives only the node as input. Thus, we need to create a simple plotter wrapper:

```>>> p = bpplt.Plotter(bpplt.pdf, np.linspace(0.1, 10, num=100))
```

Now, this callable object `p` needs only the node as the input:

```>>> p(x)
[<matplotlib.lines.Line2D object at 0x...>]
```

Thus, it can be given to the inference engine to use as a plotting function:

```>>> x = Gamma(4, 5, plotter=p)
>>> x.plot()
[<matplotlib.lines.Line2D object at 0x...>]
```
`__init__`(plotter, *args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

 `__init__`(plotter, *args, **kwargs) Initialize self.