Plot with plot markers without using ListPlot

I would like to plot a continuous function with Plot with plot markers as if it were a ListPlot plot.

Simple example: I have

f[x_]:=x
Plot[f[x],{x,0,10}]

but for external reasons I need the figure to look like that of

ListPlot[Table[{x,f[x]},{x,0,10}]]

It works well. But imagine now my f[x] function contains several functions:

f[x_]:={x,x^2,x^3}

Plotting with plot is the same:

Plot[f[x],{x,0,10}]

However, the conversion to a set of points with Table is now complicated.

The question is: what would be the easiest way (the shortest code) to produce a plot marker plot for such f[x]? Can it be done directly with Plot without using ListPlot and Table ?

Perhaps this would help:

f[x_]:={x,x^2,x^3};
DiscretePlot[Evaluate[f[x]], {x, 0, 1, 0.1}, Filling -> None,
PlotMarkers -> {{"a", 5}, {"b", 10}, {"c", 15}},
PlotLegends -> "Expressions", Frame -> True] • Odd that PlotLegend does not print the symbols defined by PlotMarkers? Mar 21 '14 at 12:15
• @bobthechemist I could have made it do that but it is not default and just wanted to illustrate a way to 'discretize' as per q...legends always need some fiddling Mar 21 '14 at 12:18
• Thank you. Choosing this solution as the most natural one, although two others are also good. Mar 31 '14 at 13:54

If you want to avoid using ListPlot all together, you can explore the Mesh option to Plot:

Plot[f[x], {x, 0, 1}, Mesh -> 20, MeshShading -> {None}] The same MeshStyle will be applied to each of the functions, making this solution somewhat limited. If you insist on a Plot solution, however, we can do something silly like this:

Show@{Plot[#[], {x, 0, 1}, Mesh -> 20, MeshShading -> {None},
MeshStyle -> #[]] & /@ Transpose[{f[x], {Red, Green, Blue}}]} • Which is which? ;)
– Kuba
Mar 21 '14 at 13:21
• @Kuba Yeah, limitation to this approach. Mar 21 '14 at 13:22
• @kuba how's that :-) Mar 21 '14 at 13:26
• Works :) but can't compete for the shortest solution :P
– Kuba
Mar 21 '14 at 13:32
• @Kuba, hence the reason you'll never see me on code golf Mar 21 '14 at 13:34

The DiscretePlot proposed by ubpdqn is a natural solution. You can, however, expand the discretization like the one you used ListPlot[Table[{x,f[x]},{x,0,10}]] on the list like this f[x_]:={x,x^2,x^3}. Indeed, this is your function:

f[x_] := {x, x^2, x^3};

Let us define a function making a list like the one you used, but a bit differently:

g[z_] := Table[{x, z}, {x, 0, 1, 0.1}];

Then the solution is

ListPlot[g /@ f[x], PlotMarkers -> Automatic]

The result should look like this: Update 2: Post-processing to replace lines with markers works in both version 9 and version 11:

Module[{i = 1, j}, Plot[Evaluate[funcs], {t, 0, 2 Pi}, PlotPoints -> 40,
MaxRecursion -> 0, PlotStyle -> {Red, Green, Blue},
PlotLegends -> LineLegend["Expressions", Joined -> False, LegendMarkers -> markers]] /.
Line[x_] :> (j = i++; (Inset[markers[[j]], #] & /@ x))] Update: It turns out that, in version 9, the same trick works with PlotStyle:

Plot[Evaluate[funcs], {t, 0, 2 Pi}, PlotPoints -> 50, MaxRecursion -> 0,
PlotStyle -> (Table[With[{i = i},
Function[w, Map[Function[z, Inset[i, z]], w]] @@ ## &], {i, markers}]),
PlotLegends -> LineLegend["Expressions", Joined -> False, LegendMarkers -> markers]] Although much cleaner than the MeshStyle trick in the original answer, unfortunately, this doesn't work in version 11 whereas MeshStyle trick works in both version 9 and 11.

You can use Mesh and inject the plot markers into the MeshStyle setting as follows:

funcs = {t Sin[t] Cos[t], t Sinc[t], Cos[t] Sinc[t] 2 t};
mesh = {20, 20, 30};
colors = ColorData[1, "ColorList"][[;; 3]];
markers = {"A", "B", "\[FilledUpTriangle]"};

Show[Module[{ins = Style[#4, #3, 16]}, Plot[#, {t, 0, 2 Pi}, Mesh -> #2, PlotStyle -> #3,
MeshStyle -> (Function[w, Map[Function[z, Inset[ins, z]], w]] @@ ## &),
PlotLegends -> Row[{ins, #}, Spacer]]] & @@@
Transpose[{funcs, mesh, colors, markers}]] Change PlotStyle -> #3 to PlotStyle -> None to remove the lines: 