# String formatting of plot labels produces "nothing"

**URL:** <https://discourse.julialang.org/t/string-formatting-of-plot-labels-produces-nothing/67693>\
**Category:** New to Julia\
**Tags:** question, plotting\
**Created:** [September 4, 2021, 2:37pm UTC](https://discourse.julialang.org/t/string-formatting-of-plot-labels-produces-nothing/67693 "2021-09-04T14:37:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhryniuk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dhryniuk/32/28885_2.png) [@dhryniuk](https://discourse.julialang.org/u/dhryniuk)\
**Post date:** [September 4, 2021, 2:37pm UTC](https://discourse.julialang.org/t/string-formatting-of-plot-labels-produces-nothing/67693/1 "2021-09-04T14:37:14Z")

</div>

I would like to format strings to autonomously change the plotting labels depending on the parameters used. I tried using the `Printf` package and have been partially successful:

```julia
label="⟨σ_1 σ_$s⟩$(@printf("%d", s))"

```

produces for `s=2`  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/a/1a9706332aec30557adff24f1fe63923ba5e2365.png)  
I would like to remove the string of “nothing” at the end of the label but I don’t know what causes it to appear. Using `@printf("%d", s)` in the REPL produces the right output, without the added “nothing” string.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 4, 2021, 2:40pm UTC](https://discourse.julialang.org/t/string-formatting-of-plot-labels-produces-nothing/67693/2 "2021-09-04T14:40:45Z")

</div>

`@printf` prints to stdout, you want `@sprintf`.
