# You may import any python packages that will be available in the environment you will run this plotter in
# Environments can change based on the experiment's settings
{% for ref, lib in uses.uses.items() %}# Library "{{ lib }}" is available under "{{ ref }}"
{% endfor %}

# Makes sure we won't require an X11 connection
import matplotlib
matplotlib.use('Agg')

import numpy
import itertools

class Plotter(baselib.Plotter):
{% if uses.parameters %}
    # do initial setup work with the given parameters for the plotter
    def setup(self, parameters):
        super(Plotter, self).setup(parameters)
        # Parameters available:
        {% for p_name, param in uses.parameters.items() %}# Parameter "{{ p_name }}" with type "{{ param.type }}"
        {% endfor %}
        # get a parameter like:
        #       param1_value = parameters.get('param_1', self.param1_default)
        return True
{% endif %}
    # this will be called each time the sync'd input has more data available to be processed
    def process(self, inputs):
        fig, ax = super(Plotter, self).prepare_canvas()
        # apply at the beginning of this function or before returning for needed modifications
        super(Plotter, self).apply_parameters(ax)
        # ax.set_title(self.title, fontdict={'fontsize':self.title_fontsize})

        # ax.set_xlabel(self.xlabel, fontdict={'fontsize':self.axis_fontsize})
        # ax.set_ylabel(self.ylabel, fontdict={'fontsize':self.axis_fontsize})
        # ax.set_xlim((self.xlim_left,self.xlim_right))
        # ax.set_ylim((self.ylim_bottom,self.ylim_top))
        return super(Plotter, self).encode_figure(fig)
