Set and Style Axes Title Labels and Ticks
Mix.install([
{:plotly_ex, "~> 0.3"},
{:kino, "~> 0.18"}
])
Section
Set axis titles and style them via xaxis.title (a map with text and
font). Style tick labels via tickfont.
alias Plotly.{Figure, Scatter}
x = Enum.to_list(0..5)
y = [1, 3, 2, 4, 3, 5]
Figure.new()
|> Figure.add_trace(Scatter.new(x: x, y: y, mode: "lines+markers"))
|> Figure.update_layout(
title: "Set and Style Axes Title Labels and Ticks",
xaxis: %{
title: %{text: "x Axis Title", font: %{family: "Arial", size: 18, color: "#7f7f7f"}},
tickfont: %{family: "Old Standard TT", size: 14, color: "black"}
},
yaxis: %{
title: %{text: "y Axis Title", font: %{family: "Arial", size: 18, color: "#7f7f7f"}},
tickfont: %{family: "Old Standard TT", size: 14, color: "black"}
}
)
|> Plotly.show()