TITLE: A set $E$ such that $E$ is dense in $[0,1]\times [0,1]$, and the intersection of $E$ and any line parallel to the axes has at most one point
QUESTION [5 upvotes]: How can I construct a set $E$ such that $E$ is dense in $[0,1]\times [0,1]$, and the intersection of $E$ and any line parallel to the axes has at most one point?

I am finding this set in order to construct a counterexample to show that the Tonelli's Theorem is not true for Riemann integral because we can define a function
$$f(x,y)=\begin{cases}
1, &(x,y)\in E,\\
0, &(x,y)\notin E,
\end{cases}$$
then $f\notin R([0,1]\times [0,1])$, but we have the following:
$$ \int_0^1dy\int_0^1f(x,y) dx=0=\int_0^1dx\int_0^1f(x,y)dy.$$
Apparently, I also want the measure of $E$ to be $0$.

REPLY [5 votes]: Let $D$ be any countable dense subset of $\mathbb R\times\mathbb R$. The set of all lines intersecting $D$ in at least two points is countable, i.e., there is one line for each pair of points. Rotate $D$ so that none of those lines is horizontal or vertical.