There are different plotting backends supported:
You create plotting object and can show it using the following functions:
mpld3 library allows you plot matplotlib in intarecative regime.
In [1]:
%pylab inline
In [2]:
import mpld3
In [3]:
from rep.plotting import FunctionsPlot
In [4]:
n_points = 30
first_func = (numpy.linspace(0, 10, n_points), numpy.random.random(n_points))
second_func = (numpy.linspace(-10, 0, n_points), numpy.random.random(n_points))
obj = FunctionsPlot({'first': first_func, 'second': second_func})
In [5]:
obj.plot(new_plot=True)
In [6]:
obj.plot(new_plot=True, xlim=(-5, 5), ylim=(0.2, 0.8), title='example', xlabel='x', ylabel='y', fontsize=15)
mpld3.display()
Out[6]:
In [7]:
obj.plot_plotly("functions")
Out[7]:
In [8]:
obj.plot_bokeh(figsize=(15, 10), xlabel='x', title='Example', ylim=(0, 0.5))
In [9]:
obj.plot_tmva(new_plot=True, figsize=(6, 6), title='TMVA example')
Out[9]:
In [10]:
obj1 = FunctionsPlot({'first': first_func})
obj2 = FunctionsPlot({'second': second_func})
In [11]:
# put new_plot to separate figures for lines in matplotlib
obj1.plot(new_plot=True)
obj2.plot(new_plot=True, xlabel='x')
In [12]:
obj1.plot(new_plot=True)
obj2.plot(new_plot=True, xlabel='x', show_legend=False)
In [13]:
obj1.plot(new_plot=True)
obj2.plot(new_plot=True, xlabel='x', show_legend=False)
mpld3.display()
Out[13]:
In [14]:
obj1.plot_plotly('one', title='plotly', xlabel='x', ylabel='points')
obj2.plot_plotly('two', title='plotly', xlabel='x', ylabel='points', xlim=(-8, -2), ylim=(0.2, 0.8), fontsize=13,
show_legend=False)
Out[14]:
In [15]:
obj1.plot_bokeh()
obj2.plot_bokeh(title='bokeh', xlabel='x', ylabel='points', xlim=(-8, -2), ylim=(0.2, 0.8), fontsize=13,
show_legend=False)