**Corrected in response to email from Juan Arias de Reyna**

The loci where $f$ is real and where $f$ is imaginary stay the same when $f$ is multiplied by a real constant. Let's simplify a little bit by distinguishing the preimages of the positive and negative real axis and the positive and negative imaginary axis.

Let's look at the case of a meromorphic function on $\mathbb C$. The basic necessary combinatorial topology condition is that their exists a branched map to the sphere $S^2$
with the given data.

If no critical values of $f$ are on the real or imaginary axis, then the X-Ray maps by a local homeomorphism, so it is a graph (not necessarily connected) properly embedded in $\mathbb C$ where every vertex has degree 4.

Whenever $z$ is a critical point where $f'(z)$ has a zero of order $k$ and $f(z)$ is on the real or imaginary axis, or both,
then it is a vertex of the X-Ray of degree $2k$ if it is not at the origin, or $4k$ if it lies at the origin. The labels of edges (positive or negative real or imaginary) are
all the same unless the critical value is 0, otherwise
the labels of edges must repeat in the same cyclic order as around 0 (if it's a 0) or the reverse, as around $\infty$ (if it's a pole).

It helps to orient the 4 half-axes so that
the real half-axes are oriented away from the origin and the imaginary half-axes are oriented toward the origin. Then the boundary of each quadrant has a consistent orientation, either counterclockwise (quadrants I and III) or clockwise (quadrants II and IV). The same holds in the preimage under $f$: the X-Ray must admit an orientation that is consistently counterclockwise on the boundary of some of the regions of its complement, and consistently
clockwise on the boundary of the others. It follows that around every vertex, the orientations must alternate inward and outward.

Furthermore, since $\mathbb R$ is linearly ordered, the real directed subgraph must be acyclic, and the imaginary directed subgraph must also be acyclic. (Note that this condition can be determined directly from the X-ray, without the ordering: equivalently, the
X-Ray should admit no cycles formed by a sequence of real edges where at each vertex, the cycle turns past an odd number of sectors. The analogous condition must hold for imaginary edges.)

In the figure above, you see that one component of the complement is an annulus, where one boundary component encloses a figure resembling a pair of intersecting ellipses. Here's an example with a disk minus two disks, obtained using Mathematica's Manipulate command to adjust positions of the poles. As the poles are moved around, the real and imaginary curves can fuse and then separate in a different pattern; you can see this close to happening below.

Let's specialize to the case that the functon is rational (as for the pictures above). In that case, the map is a branched covering map of finite degree, and the question becomes combinatorial. I claim that the necessary conditions above are also sufficient.

For a rational map, each component of the complement of the graph is a finite-sheeted branched cover of a disk that embeds in $S^2$, so it is either an open disk, or is homeomorphic to an open disk with a collection of disjoint disks removed from its interior.

If there are real or imaginary critical values (as in the case above of a real rational function that has some real critical values), then since the real and imaginary subgraphs have no directed cycles, there is a linear ordering on real critical values consistent with their order around the boundary of any region, and similarly for the imaginary critical values. We can therefore choose actual positions on $\mathbb R$ and $i\mathbb R$ consistent with their order around the boundary of each region.

If the regions are all disks, it's easy to see how to construct a branched covering: first do it edge by edge and then extend to each region by a branched covering of the region to its target orthant.

If there are multiply-connected regions, one way to construct *a* branched covering is to first sketch in hypothetical preimages for the unit circle in a way that cuts each region into disks. Each boundary component of a region alternates strings of real edges with a string of imaginary edges. In each string, after the positions of critical values have been chosen, exactly one interval contains a point on the unit circle, which we can call the midpoint.

Now match the midpoints of opposite classes of edges by disjoint arcs within each region.
For each region, to ensure that it will be is cut into one or more disks, first choose matchings to form a spanning tree for its set of boundary components. After that, proceed by matching however you fancy; the alternation of the labels of midpoints prevent you from getting trapped in a corner.

To go from a branched cover to a rational map, use the uniformization theorem, which says in particular that any complex 1-manifold homeomorphic to $S^2$ is also complex analytically homeomorphic. A branched cover of the sphere inherits a complex structure from the base, so it can be identified analytically with $S^2$: with this identification, the projection from the total space to the base space is a rational map.

The positions of the branch points and the combinatorial description of the branching pattern (basically, a homomorphism from the fundamental group of the complement of the branch points to a symmetric group, up to inner autormorphism in the image) determines the function up to a real constant. This gives a way to construct parameters for branched covers having a given isotopy class of X-ray. Locally, the critical values can vary independently.

The global description is trickier (but still combinatorially doable) because of the need to keep track of the combinatorics of the branched covering, not just the positions of the critical values. There are typically many rational maps or polynomials with a given set of critical values.

The more general case of an analytic or meromorphic function on $\mathbb C$ is much trickier, because the $f$ is not usually a branched covering map. The topological conditions for an "X-Ray" to come from a branched map are doable. However, I think the analytic conditions to decide whether there is a function defined on all of $\mathbb C$ with the given diagram or whether there are analytic functions on the unit disk (or both), will be a whole story in itself.