# Problems trying to rotate annotations in a plot

**URL:** <https://discourse.julialang.org/t/problems-trying-to-rotate-annotations-in-a-plot/23639>\
**Category:** Visualization\
**Tags:** pyplot\
**Created:** [April 29, 2019, 9:21am UTC](https://discourse.julialang.org/t/problems-trying-to-rotate-annotations-in-a-plot/23639 "2019-04-29T09:21:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ale](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@ale](https://discourse.julialang.org/u/ale)\
**Post date:** [April 29, 2019, 9:21am UTC](https://discourse.julialang.org/t/problems-trying-to-rotate-annotations-in-a-plot/23639/1 "2019-04-29T09:21:38Z")

</div>

Hi,

I am trying to write some annotations in a plot, but instead of horizontally, I would like them to do that vertically.

I am using Julia 0.6.4. My code is like:

```julia
using Plots # Notice: I'm not using Pyplot package, but just the back-end!
pyplot()

# Initialize plot
wanted_font = font(9, "georgia") 
fig_2 = plot(
tickfont = wanted_font, legendfont = wanted_font, guidefont = wanted_font,
xlabel = "My x-axis", ylabel = "My y-axis",
size = (600,300),  
legend = false, grid = false,
xmin = 0, ymin = 0,
)

scatter!(fig_2,
x_vector, y_vector,
c = [1], marker = (:circle, 2), markerstrokewidth = 0.1,
)

how_many = 50 # After how many points to draw a vertical line
vline!(fig_2, [x_vector[how_many],
xaxis = [0, 1000], yaxis = [0, 500],
annotations=(x_vector[how_many], 250, text("My description", font(9,"georgia"))),
leg = false,
)

```

This piece of code simply plots an horizontal annotation saying “My description”. Does anyone have any suggestion on how to rotate such annotation?

Note: I have already checked [https://discourse.julialang.org/t/text-in-figure-using-pyplot/1337](https://discourse.julialang.org/t/text-in-figure-using-pyplot/1337) but if I try using e.g.: `text(4, 0.5, "hello", rotation=30)`  
I get the following error message: `function text does not accept keyword arguments`.

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [April 29, 2019, 9:33am UTC](https://discourse.julialang.org/t/problems-trying-to-rotate-annotations-in-a-plot/23639/2 "2019-04-29T09:33:02Z")

</div>

Something like this should work:

```julia
julia> plot(1:3)

julia> font = text("").font
Plots.Font("sans-serif", 14, :hcenter, :vcenter, 0.0, RGB{N0f8}(0.0,0.0,0.0))

julia> font.rotation = 90
90

julia> annotate!(2,2.5, text("text", font))

```

---

<div class="post-metadata">

**Author:** ![ale](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@ale](https://discourse.julialang.org/u/ale)\
**Post date:** [April 29, 2019, 9:50am UTC](https://discourse.julialang.org/t/problems-trying-to-rotate-annotations-in-a-plot/23639/3 "2019-04-29T09:50:08Z")

</div>

@mauro3 thanks very much, this works!!

For future reference, just a minor correction: in order to rotate of 90 degrees, what works is:

```julia
font.rotation = pi/2

```

Apparently angles need to be expressed in radiants!

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [April 29, 2019, 9:59am UTC](https://discourse.julialang.org/t/problems-trying-to-rotate-annotations-in-a-plot/23639/4 "2019-04-29T09:59:56Z")

</div>

In Julia 1.1 with a fresh-ish Plots.jl I had to use degrees. In Julia 0.6 it is indeed radians.
