0

I have a graph where I would like to format the tick labels. For example I would like 0.35 to be 35%.

enter image description here

My code is below.

import matplotlib.pyplot as plt

plt.scatter(data["Profit_Margin"], data["Actual_Sales_Ex_RTC"], c=data["general"].map(colours))

plt.title("Multipack Crisps")

plt.xlabel("Profit Margin %")
plt.ylabel("Sales ex VAT")
  • What would be the equivalent of 'ax' in their code 'ax.xaxis.set_major_formatter(mtick.PercentFormatter(5.0))' in my code? Do I need to add a new line and define ax? – Luke Simpson Oct 28 '21 at 16:05
  • `fig, ax = plt.subplots()`, `ax.scatter`...`ax.set_title`. and so on. Perhaps read up on the [object-oriented interface](https://matplotlib.org/matplotblog/posts/pyplot-vs-object-oriented-interface/). – BigBen Oct 28 '21 at 16:06

0 Answers0