What is the syntax for vline() in Plots.jl?

question
plotting

#1

There is no documentation and reading the source code didn’t help much.


#2

vline, scatter, heatmap, etc all just pass through to the plot function. You can imagine it looks like:

vline(args...; kw...) = plot(args...; kw..., seriestype = :vline)

There’s nothing special about them… they’re just a convenience.


#3

@tbreloff and so if I want to have a bunch of vertical lines at x1, x2 and x3, what is the syntax?

It may be trivial to you, the person who has written the code, but as a user, I still have no clue of what to pass as args. Should it be a list [x1,x2,x3]? How to control the height of the lines? Etc.


#4

A list [x1,x2,x3] should be fine. If you want to be more precise with how you draw vertical lines, just do it yourself with the normal :path seriestype and separate each line segment with a NaN.


#5

For future reference, the command is:

vline([1,2,3]) # vertical lines at x = 1, 2 and 3.

Notice that you have to pass a 1x1 array if you are interested in a single vertical line (e.g. vline([2])).


#6

Remember, you can also add more lines using the ! variants of the functions, you don’t have to create them all at once.