How to use xformatter/yformatter in Plot to change the number to 2M (million) or 2K(thousands)

Hi in the follwing figure I want to change my x-axis and y-axis number into format 2M (million) or 2K(thousands). How can I do it? I think I have to use xformatter or yformatter command but i don’t know how exactly I can use it here! I am attaching the code and the figure below.

using Plots 
using Interact
@manipulate for Days in 1:length(dates)
     plot(T_US[1:Days],US_data_new_cases[1:Days])
     xlims!(T_US[1],T_US[end])
     annotate!(T_US[Days],US_data_new_cases[Days], text(" US", 10, :black))
     ylabel!("New Confirmed Cases in Past Seven Days")
     title!("COVID-19 cases")
end

Screenshot 2020-10-14 at 12.31.53 PM

Use yformatter in plot(…).
Something like
plot(…,
yformatter=y->round(Int64, y÷1000))
for scaling by 1000

1 Like