Notwithstanding the answers emphasizing how to interpret the explanations on Needham's book, perhaps it would be a good idea to see how the current version of Wolfram Mathematica deals with the issue: A function $f(z)$ may be visualized using the command ComplexPlot3D, https://reference.wolfram.com/language/ref/ComplexPlot3D.html The way it is done is given a complex domain $$z=x+yi;\,x, y\in \{a\leq x \leq b,\, c\leq y \leq d\},$$ $$a,\,b,\,c,\,d\in \mathcal{R}$$ Then each point in the graph is (z,|f(z)|), with $f(z)=u+vi$ in the codomain of $f(z)$ and the magnitude or modulus of the function defined as $$|f(z)|=\sqrt{u^2+v^2}$$ with a color function that depends on the argument of the function, that is $$\arg(z)=\arg(x+yi)=\varphi$$ where $$\varphi = \arg (x+yi) = \begin{cases} 2 \arctan\left(\dfrac{y}{x + \sqrt{x^2 + y^2}}\right) &\text{if } y \neq 0 \text{ or } x > 0, \\ \pi &\text{if } x < 0 \text{ and } y = 0, \\ \text{undefined} &\text{if } x = 0 \text{ and } y = 0. \end{cases}$$ The aforementioned color function is what takes care of the "fourth dimension", so to speak, of the complex function, and it is very insightful, because of the color pattern that indicates how does it look like the function around zeroes, poles and essential singularities, or as it is explained there, in the wolfram reference page, "The color function goes from $-\pi$ to $\pi$ counterclockwise around zeros, clockwise around poles and infinite cycles near essential singularities." (I recommend visiting the page and looking at the pictures of the color function). Summarizing and recapitulating: the solution for obtaining the graph of a complex function in Mathematica, is by means of plotting $(x+y i,|f(z)|)$ with a color function that depends on the argument $\varphi$. Notice the mixture of using Cartesian coordinates in the domain, with polar coordinates for the range in the co-domain, using only the magnitude or modulus of the function as a third coordinate, and essentially "reinterpreting" the fourth coordinate as a color pattern.
Notice that when you use the magnitude of the function as a third coordinate, usually what you take is the principal branch of the magnitude, i.e., the positive value of the square root. Alternatives to Mathematica can be found, for example, in Python, which also uses $|f(z)|$ for the third dimension:
3D visualization of complex functions with matplotlib