Plots.jl : Some Odd Attribute Behavior


#1

macos, julia 1.0.0.

julia> using Plots; x= 1:0.1:10; Y= [ sin.(x), cos.(x) ];

julia> plot( x, Y, tickfontrotation=50 )

julia> savefig("tickfontrotation.png")

I am looking the output of the above, and commands like tickfontrotation or tickfonthalign seem to set the tickfontsize, rather than what I would have guessed they were supposed to do.

tickfontrotation

Am I mistaken?


#2

Where did you find the command tickfontrotation? I think you want xrotation. I agree that this behavior is a bug, but its not a command that one would try after looking at the documentation.


#3
julia> using Plots

julia> plotattr(:Axis)
Defined Axis attributes are:
discrete_values, flip, foreground_color_axis,
foreground_color_border, foreground_color_grid,
foreground_color_guide, foreground_color_minor_grid,
foreground_color_text, formatter, grid, gridalpha, gridlinewidth,
gridstyle, guide, guidefontcolor, guidefontfamily,
guidefonthalign, guidefontrotation, guidefontsize,
guidefontvalign, lims, link, minorgrid, minorgridalpha,
minorgridlinewidth, minorgridstyle, minorticks, mirror, rotation,
scale, showaxis, tick_direction, tickfontcolor, tickfontfamily,
tickfonthalign, **tickfontrotation**, tickfontsize, tickfontvalign,
ticks, widen

tickfontrotation is not the only case. there are many other ones that exhibit the same buggy behavior.


#4

Whatever the problem is, it’s definitly this weird chunk of code:

You should file an issue about it


#5

Additionally, I think there is confusion about what plotattr(:Axis) refers to. It refers to options defined within the xaxis and yaxis options. The following works:

plot( x, Y, xaxis = (tickfontrotation = 60.0))

#6

hi genauguy—can I beg you to file the issue, please? I am just starting with playing around with Plots. A good part of what I might try to explain could be wrong.

for example, as you saw, I did not realize what plotattr is supposed to tell me. I am still confused.

julia> plotattr()
Specify an attribute type to get a list of supported attributes.
 Options are Series, Subplot, Plot, Axis

If plot( x, Y, xaxis = (tickfontrotation = 60.0)), then how would I use, say, the dpi=72 (a :Plot option)? Logically, should it be plot( x, Y, Plot=(dpi=72) ). This does not work.

So how are all the plotattr() from Series, Subplot, Plot, Axis supposed to be used (if they are not just stuck into the plot itself), and where would I find documentation on this?


#7

I am not a very experience plots user. But I find the documentation to be very helpful.

Based on playing around, it looks like dpi can be specified at the top level, without going in a function.

 plot(x, sin.(x), dpi = 74)

#8

I know. my question was more conceptual, though. when is the attribute an argument to the overall plot, and when is it a tuple handed to a different argument (like xaxis)?


#9

so I did file issues, and apparently this is a bug (as are some others) and not my ignorance.