# Formating decimal separator in xticks when plotting with PlotlyJS

**URL:** <https://discourse.julialang.org/t/formating-decimal-separator-in-xticks-when-plotting-with-plotlyjs/105641>\
**Category:** Visualization\
**Tags:** plotting, plotlyjs\
**Created:** [November 1, 2023, 4:17am UTC](https://discourse.julialang.org/t/formating-decimal-separator-in-xticks-when-plotting-with-plotlyjs/105641 "2023-11-01T04:17:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnguyengiatan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nnguyengiatan/32/48837_2.png) [@nnguyengiatan](https://discourse.julialang.org/u/nnguyengiatan)\
**Post date:** [November 1, 2023, 4:17am UTC](https://discourse.julialang.org/t/formating-decimal-separator-in-xticks-when-plotting-with-plotlyjs/105641/1 "2023-11-01T04:17:54Z")

</div>

Hi all, I have the dataset as follow:

```julia
df = DataFrame(
    kvkt = [
        "Service", "Service", "Service", "Service", "Service",
        "Manufacturing", "Manufacturing", "Manufacturing", "Manufacturing", "Manufacturing",
        "Agriculture", "Agriculture", "Agriculture", "Agriculture", "Agriculture"
    ],
    year = [2017, 2018, 2019, 2020, 2021, 2017, 2018, 2019, 2020, 2021, 2017, 2018, 2019, 2020, 2021],
    mean_turnover = [1.3, 1.3, 1.2, 1.1, 1.7, 1.3, 1.2, 1.0, 0.9, 1.4, 1.0, 1.2, 1.2, 1.5, 1.1]
)

```

**I want to change xticks in this plot from dot to decimal, such as “1.3” to “1,3”**. I got the plot below with the following code:

```julia
p_turnover_k = Plot(
                df, x=:year, y=:mean_turnover,
                color=:kvkt,
                text=:mean_turnover,
                kind="bar",
                textposition="auto",
                labels=Dict(
                    :year => "Year",
                    :mean_turnover => "Turnover rate",
                    :kvkt => "Sector",
                ),
                Layout(barmode = "stack", 
                font_family = "Courier New",
                separators = ",",
                legend = attr(
                    x=1,
                    y=1.02,
                    yanchor="bottom",
                    xanchor="right",
                    orientation="h"
                )
                )
)

```

 ![x](https://global.discourse-cdn.com/julialang/original/3X/6/2/6225b0b6a24a9f50a5fe56ac4ae3a08c8dfe764f.png)

I tried the docs in PlotylyJS and found about **formatting** `xticks` for thousand number but not for my case. Thanks.

---

<div class="post-metadata">

**Author:** ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)\
**Post date:** [November 1, 2023, 5:59am UTC](https://discourse.julialang.org/t/formating-decimal-separator-in-xticks-when-plotting-with-plotlyjs/105641/2 "2023-11-01T05:59:25Z")

</div>

I don’t know of a way to do the change within plotly, but you can do it from julia as:

```julia
df.mean_turnover_text = replace.(string.(df.mean_turnover), "." => ",")

```

then change

> [@nnguyengiatan](#):
>
> `text=:mean_turnover,`

to  
`text=:mean_turnover_text`
