<jupyter_start><jupyter_text>Change the tick values and labels on a colour bar<jupyter_code>import matplotlib.pyplot as plt
import pandas as pd
# import data as Pandas dataframe and assign columns to objects
tvz = pd.read_excel('../Data/TVZ.xlsx', sheet_name='Data')
x = tvz.EffectivePorosity_VolPercent
y = tvz.SampleDepth_mMD
z = tvz.Vp_mps

fig, ax = plt.subplots(1,1,figsize=(6,3))

# note the object assignment "cax" and "cbar"
# and then the use of the object in the next step

# make the colour scaled axis (plot)
cax = ax.scatter(x, y, c=z)

# make the colour bar with specified ticks
cbar = fig.colorbar(cax, ticks=[2000,3000,4000])

# change the tick labels
cbar.ax.set_yticklabels([2,3,4])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1095890410958904, 'fraction_numerical': 0.026027397260273973, 'mean_word_length': 5.356521739130435, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '584199', 'license': 'Apache-2.0', 'n_tokens_mistral': 285, 'n_tokens_neox': 271, 'n_words': 82, 'path': 'Recipes/control-colour-bar-ticks.ipynb', 'repo_name': 'ICWallis/tutorial-publication-ready-figures', 'size': '730'}