How do I plot a 2d curve and label lattice points to one side of it?

I want to plot the curve $f[x]=\frac{1}{x}$, and draw a solid red dot at every lattice point in the following set: $$\{(m,n)\in \mathbb N^2\colon mn\geq 1\}$$

  • $\begingroup$ Make a lattice with Tuples, filter it with Select, plot with ListPlot, combine it with the curve using Show. $\endgroup$
    – Szabolcs
    Jul 23, 2015 at 6:37
  • $\begingroup$ You can add something like Epilog -> {Red, Point[Flatten[Array[List, {5, 5}], 1]]} to your plot. $\endgroup$ Jul 23, 2015 at 6:41

1 Answer 1


In V10.1 or later, you can use CoordinateBoundingBoxArray to generate the lattice.

With[{m = 5},
  Plot[1/x, {x, 0, m},
    Epilog -> {
      Red, PointSize[Medium],
      Point[Flatten[CoordinateBoundingBoxArray[{{1, 1}, {m, m}}], 1]]},
    AspectRatio -> Automatic,
    PlotRange -> {0, m},
    PlotRangePadding -> .15,
    Frame -> True]]



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.