Buy Me a Coffee? Your support is much appreciated!

PayPal Me: https://www.paypal.me/jiejenn/5
Venmo: @Jie-Jenn

import numpy as np
import matplotlib.pyplot as plt

def format_number(data_value, indx):
    if data_value >= 1_000_000:
        formatter = '{:1.1f}M'.format(data_value*0.000_001)
    else:
        formatter = '{:1.0f}K'.format(data_value*0.001)
    return formatter

labels = ['A', 'B', 'C']
values = [500_000, 1_000_000, 3_300_000]

plt.style.use('ggplot')

fig, ax = plt.subplots(figsize=(10, 5))
    
ax.barh(labels, values)

step_value = 250000
plt.xticks(np.arange(0, max(values)+step_value, step_value))

plt.tight_layout()
plt.show()