Search code examples
plotwolfram-mathematica

How to plot constant vertical lines where x is a constant in Mathematica


How can I plot the set of constant vertical line x=0,1,2,3.. in Mathematica?

When I set Plot[1, {x, 0, 5}] then it is a horizontal line which means it sets y=1.


Solution

  • Try

    p={{{1,0},{1,3}},{{2,0},{2,3}},{{3,0},{3,3}}};
    ListPlot[p,Joined->True]
    

    If you need to then you can adjust the coloring and other graphics options like any other Plot.