Reputation: 41469
I would like to color the grid lines in a plot. Here is some reproducible code:
using Plots
Plots.plot(rand(10))
Output:
Imagine I want to have green grid lines, how can we change the color of grid lines in Julia? I check the docs, but I can only find attributes like alpha, line width and style and not the color.
Upvotes: 1
Views: 427
Reputation: 18217
Here is some code to get the green grid:
plt = Plots.plot(rand(10))
xaxis = Plots.get_axis(Plots.get_subplot(plt,1),:x)
yaxis = Plots.get_axis(Plots.get_subplot(plt,1),:y)
xaxis[:gridalpha] = 0.6
yaxis[:gridalpha] = 0.6
xaxis[:foreground_color_grid] = colorant"green"
yaxis[:foreground_color_grid] = colorant"green"
plt
Many other attributes are described in the docs page you linked to.
Upvotes: 3