Consider the following code:
DiscretePlot[PrimePi[k], {k, 1, 50}, PlotRange -> {1, 10},
Frame -> True, Joined -> True]
I met this kind of problem in my research. Above is just an simple example. How can I restrict the plotrange into the frame not having something out side on the tick label? Thanks!