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\}$$
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityIn 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]]
Tuples
, filter it withSelect
, plot withListPlot
, combine it with the curve usingShow
. $\endgroup$Epilog -> {Red, Point[Flatten[Array[List, {5, 5}], 1]]}
to your plot. $\endgroup$