# Problem with Exclusions when Floor is used

Plot[Floor[Sin[x]], {x, -Pi, Pi}, PlotLabel -> Floor[Sin[x]],  Frame -> True, GridLines -> Automatic,  GridLinesStyle -> Directive[LightGray, Dashed],  FrameTicks -> {Automatic, {Table[x, {x, {-Pi, 0, Pi}}], None}},  ExclusionsStyle -> {Dotted, Red}, PlotRange -> {{-Pi, Pi}, {-1, 1}}]


which gives

While I expect something like this, espeacially when x=Pi/2, for example, should be 1.

It misses it due to sampling. You can see this by asking to explicitly sample Pi/2

Plot[Floor[Sin[x]], {x, -Pi, Pi},
PlotPoints -> {50, {Pi/2}},
PlotLabel -> Floor[Sin[x]],
Frame -> True,
GridLines -> Automatic,
GridLinesStyle -> Directive[LightGray, Dashed],
FrameTicks -> {Automatic, {Table[x, {x, {-Pi, 0, Pi}}], None}},
ExclusionsStyle -> {Dotted, Red},
PlotRange -> {{-Pi, Pi}, {-1, 1.1}}]


Just adding more sample points did not help, it kept missing Pi/2. One way around this is to make 2 plots and use Show

f[x_] := If[Mod[x, Pi/2] != 0, Null, Sin[x]]
data = Table[{x, f[x]}, {x, -Pi, Pi, Pi/10}];
p1 = ListPlot[data, PlotStyle -> Red];

p2 = Plot[Floor[Sin[x]], {x, -Pi, Pi},
PlotLabel -> Floor[Sin[x]],
Frame -> True,
GridLines -> Automatic,
GridLinesStyle -> Directive[LightGray, Dashed],
FrameTicks -> {Automatic, {Range[-Pi, Pi, Pi/2], None}},
ExclusionsStyle -> {Dotted, Red},
PlotRange -> {{-Pi, Pi}, {-1, 1.1}}];
Show[p2, p1]


May be there is a better way without using 2 plots, but I could not figure it out.