I'm trying to produce a simple scatter plot from a table, and I want to color-code the points in the plot based on one of the columns in the table itself. I managed to do it so far, by using
fig = plt.figure(figsize=(14,10))
ax = fig.add_subplot(111)
import matplotlib.pyplot as plt
ax.scatter(sub_ZH_match[:,9], sub_ZH_match[:,10], c=sub_ZH_match[:,2], s=60, marker=mod_marker, edgecolors='black', cmap=cm.jet_r, label='matches')
where, obviously
sub_ZH_match[:,9] -> x values
sub_ZH_match[:,10] -> y values
sub_ZH_match[:,2] -> values for the color coding.
but I don't get how to actually show the colorbar on the side of the plot.
It works when using this syntax
plt.scatter(sub_ZH_match[:,9], sub_ZH_match[:,10], c=sub_ZH_match[:,2], s=60, marker=mod_marker, edgecolors='black', cmap=cm.jet_r, label='matches')
clb = plt.colorbar()
clb.ax.tick_params(labelsize=18)
clb.set_label(r'$\nu$', fontsize=20)
but I wanted to understand how to do it when sticking to the syntax with the axes objects. Thanks!