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

**URL:** <https://discourse.julialang.org/t/how-to-use-xformatter-yformatter-in-plot-to-change-the-number-to-2m-million-or-2k-thousands/48345>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [October 14, 2020, 7:16am UTC](https://discourse.julialang.org/t/how-to-use-xformatter-yformatter-in-plot-to-change-the-number-to-2m-million-or-2k-thousands/48345 "2020-10-14T07:16:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kantvishu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kantvishu/32/18645_2.png) [@Kantvishu](https://discourse.julialang.org/u/Kantvishu)\
**Post date:** [October 14, 2020, 7:16am UTC](https://discourse.julialang.org/t/how-to-use-xformatter-yformatter-in-plot-to-change-the-number-to-2m-million-or-2k-thousands/48345/1 "2020-10-14T07:16:08Z")

</div>

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.

```julia
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](https://global.discourse-cdn.com/julialang/original/3X/d/c/dcdee04d7bd8fd41d159d0d904652df0a1a1c45d.png)

---

<div class="post-metadata">

**Author:** ![ollin23](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ollin23/32/9915_2.png) [@ollin23](https://discourse.julialang.org/u/ollin23)\
**Post date:** [October 18, 2020, 7:48pm UTC](https://discourse.julialang.org/t/how-to-use-xformatter-yformatter-in-plot-to-change-the-number-to-2m-million-or-2k-thousands/48345/2 "2020-10-18T19:48:51Z")

</div>

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