import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap
from marvin.tools import Maps
import marvin.utils.plot.map as mapplot

maps = Maps('8485-1901')
ha = maps.emline_gflux_ha_6564

# divide data into classes
ha_class = np.ones(ha.shape, dtype=int)
ha_class[np.where(ha.value > 5)] = 2
ha_class[np.where(ha.value > 20)] = 3

cmap = ListedColormap(['#104e8b', '#5783ad', '#9fb8d0'])
fig, ax, cb = mapplot.plot(dapmap=ha, value=ha_class, cmap=cmap, cbrange=(0.5, 3.5),
                           title='', cblabel='Class', return_cb=True)
cb.set_ticks([1, 2, 3])
cb.set_ticklabels(['I', 'II', 'III'])