matplotlib - How can I set the number of ticks in Julia using Pyplot? -
i struggling 'translate' instructions find python use of pyplot in julia. must simple question, know how set number of ticks in plot in julia using pyplot?
if have
x = [1,2,3,4,5] y = [1,3,6,8,11]
you can
pyplot.plot(x,y)
which draws plot
and do
pyplot.xticks([1,3,5])
for tics @ 1,3 , 5 on x-axis
pyplot.yticks([1,6,11])
for tics @ 1,6 , 11 on y-axis
tic spacing
if want fx 4 tics , want evenly spaced , dont mind floats, can
collect(linspace(x[1], x[end], 4).
if need tics integers , want 4 tics, can do
collect(x[1]:div(x[end],4):x[end])
edit
maybe wont belong here atleast you'll see it...
whenever you're looking method that's supposed in module x can find these methods typing in repl x. + tab key
to clarify, if want search module method suspect starts x, xticts, in repl (terminal/shell) do
pyplot.x
and press tab twice , you'll see
julia> pyplot.x xkcd xlabel xlim xscale xticks
and if you're not sure how method works, fx arguments, , there isnt available, can call
methods(pyplot.xticks)
to see every "version" method has
bonus
the module standard methods, maximum, vcat etc base
Comments
Post a Comment