The Dot and the Line (1965)
The Dot and the Line: A Romance in Lower Mathematics (ISBN 1-58717-066-3) is a book written and illustrated by Norton Juster, first published by Random House in 1963. The story was inspired by Flatland: A Romance of Many Dimensions, in which the protagonist visits a one-dimensional universe called Lineland, where women are dots and men are lines.
More at Wikipedia.