# plotting vertical lines in ListLinePlot

I have a list such as here:

list1 = {{-(5/4), 3}, {-(3/4), 2}, {1/4, 6}, {3/4, 5}};

My desire is to have a plot similar to (just in shape not in data) however when I use of ListLinePlot, I just get a plot same as : I guess I have to insert some zeros between my main data in list? if it is correct, how many zeros are needed?

• Does the option Filling -> Axis not do what you want? It's the very first example in the ListPlot documentation. Oct 26, 2015 at 9:42
• Yes, But it doesn't satisfy all aim, because Filling just plots lines bellow points, I wanted to have zero horizontal line at the bottom of the plot as the first plot. Oct 26, 2015 at 9:51
• If it gets more complicated than this (I'm thinking of the horizontal red line), you can also build the graphics directly from Line primitives. Working with graphics primitives in Mathematica is easier than one might imagine. :-) reference.wolfram.com/language/tutorial/… Oct 26, 2015 at 11:25

Consider setting a custom gridline:

ListPlot[list1, PlotStyle -> White, Filling -> Bottom,
FillingStyle -> Directive[Thick, Red], GridLines -> {None, {0}},
GridLinesStyle -> Directive[Thick, Red]] The one difference from your picture is that a gridline goes all the way across the plot area. If it is important to you that the horizontal line ends at the extremes of your data set, then the following alternative might be what you want:

ListPlot[list1, PlotStyle -> White, Filling -> Bottom,
FillingStyle -> Directive[Thick, Red],
Epilog -> {Thick, Red, Line[{{-5/4, 0}, {3/4, 0}}]}] I would note that ListLinePlot is designed to join the points together; it is equivalent to ListPlot with the Joined option set to True. If you want disjoint points, you need ListPlot, with the Joined option set to False, which is the default.

list1 = {{-(5/4), 3}, {-(3/4), 2}, {1/4, 6}, {3/4, 5}};
xLim = {Min[#], Max[#]} &[list1[[All, 1]]];

zeroLine = Plot[0, {x,Min@xLim, Max@xLim}, PlotStyle -> {Thick, Red}];
listPlot = ListPlot[list1, Filling -> Axis, PlotStyle -> {Thick, Red}];
Show[zeroLine, listPlot, PlotRange -> Automatic] 