Example #1
0
    def _set_ml_title(self, text, plotid, ax):
        plot = self.graph.plots[plotid]
        tag = '{}_axis'.format(ax)
        xa = getattr(plot, tag)
        nxa = MPlotAxis()
        nxa.title = text
        nxa.clone(xa)

        setattr(plot, tag, nxa)
Example #2
0
    def _set_ml_title(self, text, plotid, ax):
        plot = self.graph.plots[plotid]
        tag = "{}_axis".format(ax)
        xa = getattr(plot, tag)
        nxa = MPlotAxis()
        nxa.title = text
        nxa.clone(xa)

        setattr(plot, tag, nxa)
Example #3
0
    def _set_ml_title(self, text, plotid, ax):
        plot = self.graph.plots[plotid]

        tag = '{}_axis'.format(ax)
        xa = getattr(plot, tag)
        # remove the axis tool
        self._remove_axis_tool(plot, xa)

        nxa = MPlotAxis()

        nxa.title = text
        nxa.clone(xa)

        setattr(plot, tag, nxa)
        self._add_axis_tool(plot, nxa)
Example #4
0
    def _set_title(self, axistag, title, plotid, font=None, size=None):
        """
        """
        if plotid is None:
            plotid = len(self.plots) - 1

        axis = getattr(self.plots[plotid], axistag)
        params = dict(title=title)

        if font not in VALID_FONTS:
            font = 'arial'

        if font is not None or size is not None:
            if size is None:
                size = 12

            tfont = '{} {}'.format(font, size)
            params.update(title_font=tfont)

        axis.trait_set(**params)

        if '<sup>' in title or '<sub>' in title:
            plot = self.plots[plotid]
            for t in plot.tools:
                if t.component == axis:
                    plot.tools.remove(t)
                    break

            nxa = MPlotAxis()
            nxa.title = title
            nxa.clone(axis)

            t = AxisTool(component=nxa)
            plot.tools.append(t)

            setattr(self.plots[plotid], axistag, nxa)
            # axis = nxa

        self.plotcontainer.request_redraw()