# ListPlot with joined line

I have a plot that I would like to make it like a ListPlot with joined lines. I mean, for each integer ‘k’, I want to have a dot over each line.

Here is the simplified plot:

γ = 50;
F[n_] := 1 + n (23 γ) + 154;

Ftotal[n_, k_] := k F[n] + (27);
Plot[{Ftotal[500, k], Ftotal[300, k]}, {k, 7, 12}, Frame -> True,
PlotRange -> All]


• Have you seen the Mesh option of Plot[]? Jun 6, 2020 at 7:50
• @J.M.'stechnicaldifficulties Thanks you Jun 6, 2020 at 18:43

Show[
Plot[{Ftotal[500, k], Ftotal[300, k]}, {k, 7, 12},
Frame -> True, PlotRange -> All],
ListPlot[Transpose@Table[{{k, Ftotal[500, k]},
{k, Ftotal[300, k]}}, {k, 7, 12}]]]


or since the lines are straight

ListLinePlot[Transpose@Table[{{k, Ftotal[500, k]},
{k, Ftotal[300, k]}}, {k, 7, 12}],
PlotMarkers -> Graphics[{PointSize[0.025], Point[{0, 0}]}],
Frame -> True, PlotRange -> All]


Same output.

Also, plot with epilog

Plot[{Ftotal[500, k], Ftotal[300, k]}, {k, 7, 12},
Frame -> True, PlotRange -> All, Epilog -> {PointSize[0.015],
Transpose@Prepend[Map[Point, Table[
{{k, Ftotal[500, k]}, {k, Ftotal[300, k]}}, {k, 7, 12}], {2}],
{ColorData[97, 1], ColorData[97, 2]}]}]


Same output.

and as J. M.'s technical difficulties observes, use of Mesh

Plot[{Ftotal[500, k], Ftotal[300, k]}, {k, 7, 12},
Frame -> True, PlotRange -> All,
Mesh -> {Range[7, 12]}, MeshStyle -> PointSize[Medium]]


but in this instance the end points are not plotted.

It works with the ListLinePlot version though.

ListLinePlot[Transpose@Table[{{k, Ftotal[500, k]},
{k, Ftotal[300, k]}}, {k, 7, 12}],
Frame -> True, PlotRange -> All,
Mesh -> All, MeshStyle -> PointSize[Medium]]

• Awesome, thank you @chris Jun 6, 2020 at 18:33
• Chris, why do you make it a point to specify “since the lines are straight” before you give a method using ListLinePlot? Jun 7, 2020 at 20:28
• Hi. Because in plotting the integer results from Table any curve between the points would not be plotted. See this example : ListLinePlot[Transpose @ Table[{{k^16, Ftotal[500, k]}, {k^16, Ftotal[300, k]}}, {k, 4, 7}], PlotMarkers -> Graphics[{PointSize[0.025], Point[{0, 0}]}], Frame -> True, PlotRange -> All] Jun 7, 2020 at 20:38