How to format axis tick labels from number to thousands or Millions (125,436 to 125.4K)

IIUC you can format the xticks and set these: In[60]: #generate some psuedo data df = pd.DataFrame({‘num’:[50000, 75000, 100000, 125000], ‘Rent/Sqft’:np.random.randn(4), ‘Region’:list(‘abcd’)}) df Out[60]: num Rent/Sqft Region 0 50000 0.109196 a 1 75000 0.566553 b 2 100000 -0.274064 c 3 125000 -0.636492 d In[61]: import matplotlib.pyplot as plt import matplotlib.ticker as ticker import seaborn as … Read more

How to change tick label font size

There is a simpler way actually. I just found: import matplotlib.pyplot as plt # We prepare the plot fig, ax = plt.subplots() # We change the fontsize of minor ticks label ax.tick_params(axis=”both”, which=”major”, labelsize=10) ax.tick_params(axis=”both”, which=”minor”, labelsize=8) This only answers to the size of label part of your question though.

How to force integer tick labels

This should be simpler: (from https://scivision.co/matplotlib-force-integer-labeling-of-axis/) import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator #… ax = plt.figure().gca() #… ax.xaxis.set_major_locator(MaxNLocator(integer=True)) Read the official docs: https://matplotlib.org/stable/api/ticker_api.html#matplotlib.ticker.MaxNLocator

Plot logarithmic axes

You can use the Axes.set_yscale method. That allows you to change the scale after the Axes object is created. That would also allow you to build a control to let the user pick the scale if you needed to. The relevant line to add is: ax.set_yscale(‘log’) You can use ‘linear’ to switch back to a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)