Skip to content

Add colorbar facilitator class #6

@phil-brad

Description

@phil-brad

Could look something like this:

class ColorbarPlot(MatPlotLibBase):
    def __init__(self, parent, file_dialog_service, cbar_height=0.2, v_gap=0.6, **kwargs):
        super().__init__(parent,
                         file_dialog_service,
                         v_axes=[Size.Fixed(cbar_height), Size.Fixed(v_gap), Size.Scaled(2.0)],
                         ny_default=3,
                         **kwargs)
        self._colorbar_axes = LocatableAxes(self._figure, self._divider.get_position())
        self._colorbar_axes.set_axes_locator(self._divider.new_locator(nx=1, ny=1))
        self._figure.add_axes(self._colorbar_axes)
        self._cbar = None

    def _plot_colorbar(self, label):
        if self._cbar is None:
            self._cbar = colorbar(self._points, self._colorbar_axes, orientation='horizontal')
            self._cbar.set_label(label)
        else:
            self._cbar.update_bruteforce(self._points)

    @property
    def colorbar(self):
        return self._cbar

    @colorbar.setter
    def colorbar(self, cbar):
        self._cbar = cbar

Extend to allow colorbar on the top, bottom, right-side or left-side

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions