Repository: sympy/sympy

Issue:
Printer for ComplexPlane for custom Intervals
Since ComplexSets have been implemented here #9463 , the printer for Singleton Complex class `S.Complex` is present, but the printer for `ComplexPlane` class doesn't exists.

This is there:
```python
In [3]: S.Complex
Out[3]: ℂ
```

Printer for the following needs to be added:
```python
In [4]: ComplexPlane(Interval(1, 5)*Interval(2, 7))
Out[4]: ComplexPlane(Lambda((x, y), x + I*y), [1, 5] x [2, 7])

In [5]: ComplexPlane(Interval(0, 1)*Interval(0, 2*pi), polar=True)
Out[5]: ComplexPlane(Lambda((r, theta), r*(I*sin(theta) + cos(theta))), [0, 1] x [0, 2*pi))
```


Discussion:

Patch:
diff --git a/sympy/printing/latex.py b/sympy/printing/latex.py
index 8f9c35051d..31dce95a55 100644
--- a/sympy/printing/latex.py
+++ b/sympy/printing/latex.py
@@ -1575,6 +1575,13 @@ def _print_ConditionSet(self, s):
             self._print(s.base_set),
             self._print(s.condition.expr))
 
+    def _print_ComplexPlane(self, s):
+        vars_print = ', '.join([self._print(var) for var in s.args[0].variables])
+        return r"\left\{%s\; |\; %s \in %s \right\}" % (
+            self._print(s.args[0].expr),
+            vars_print,
+            self._print(s.sets))
+
     def _print_Contains(self, e):
         return r"%s \in %s" % tuple(self._print(a) for a in e.args)
 
diff --git a/sympy/printing/pretty/pretty.py b/sympy/printing/pretty/pretty.py
index cfbe49f915..e1f457c622 100644
--- a/sympy/printing/pretty/pretty.py
+++ b/sympy/printing/pretty/pretty.py
@@ -1530,6 +1530,18 @@ def _print_ConditionSet(self, ts):
         return self._print_seq((variables, bar, variables, inn,
                                 base, _and, cond), "{", "}", ' ')
 
+    def _print_ComplexPlane(self, ts):
+        if self._use_unicode:
+            inn = u("\N{SMALL ELEMENT OF}")
+        else:
+            inn = 'in'
+        variables = self._print_seq(ts.args[0].variables)
+        expr = self._print(ts.args[0].expr)
+        bar = self._print("|")
+        prodsets = self._print(ts.sets)
+
+        return self._print_seq((expr, bar, variables, inn, prodsets), "{", "}", ' ')
+
     def _print_Contains(self, e):
         var, set = e.args
         if self._use_unicode:


Test patch:
diff --git a/sympy/printing/pretty/tests/test_pretty.py b/sympy/printing/pretty/tests/test_pretty.py
index 52f0ae3517..d2ad29306a 100644
--- a/sympy/printing/pretty/tests/test_pretty.py
+++ b/sympy/printing/pretty/tests/test_pretty.py
@@ -3108,6 +3108,15 @@ def test_pretty_ConditionSet():
     assert upretty(ConditionSet(Lambda(x, Eq(sin(x), 0)), S.Reals)) == ucode_str
 
 
+def test_pretty_ComplexPlane():
+    from sympy import ComplexPlane
+    ucode_str = u('{x + ⅈ⋅y | x, y ∊ [3, 5] × [4, 6]}')
+    assert upretty(ComplexPlane(Interval(3, 5)*Interval(4, 6))) == ucode_str
+
+    ucode_str = u('{r⋅(ⅈ⋅sin(θ) + cos(θ)) | r, θ ∊ [0, 1] × [0, 2⋅π)}')
+    assert upretty(ComplexPlane(Interval(0, 1)*Interval(0, 2*pi), polar=True)) == ucode_str
+
+
 def test_ProductSet_paranthesis():
     from sympy import Interval, Union, FiniteSet
     ucode_str = u('([4, 7] × {1, 2}) ∪ ([2, 3] × [4, 7])')
diff --git a/sympy/printing/tests/test_latex.py b/sympy/printing/tests/test_latex.py
index e758ae8783..a397db0c96 100644
--- a/sympy/printing/tests/test_latex.py
+++ b/sympy/printing/tests/test_latex.py
@@ -15,7 +15,7 @@
     uppergamma, zeta, subfactorial, totient, elliptic_k, elliptic_f,
     elliptic_e, elliptic_pi, cos, tan, Wild, true, false, Equivalent, Not,
     Contains, divisor_sigma, SymmetricDifference, SeqPer, SeqFormula,
-    SeqAdd, SeqMul, fourier_series, pi, ConditionSet, fps)
+    SeqAdd, SeqMul, fourier_series, pi, ConditionSet, ComplexPlane, fps)
 
 
 from sympy.ntheory.factor_ import udivisor_sigma
@@ -609,6 +609,13 @@ def test_latex_ConditionSet():
         r"\left\{x\; |\; x \in \mathbb{R} \wedge x^{2} = 1 \right\}"
 
 
+def test_latex_ComplexPlane():
+    assert latex(ComplexPlane(Interval(3, 5)*Interval(4, 6))) == \
+        r"\left\{x + i y\; |\; x, y \in \left[3, 5\right] \times \left[4, 6\right] \right\}"
+    assert latex(ComplexPlane(Interval(0, 1)*Interval(0, 2*pi), polar=True)) == \
+        r"\left\{r \left(i \sin{\left (\theta \right )} + \cos{\left (\theta \right )}\right)\; |\; r, \theta \in \left[0, 1\right] \times \left[0, 2 \pi\right) \right\}"
+
+
 def test_latex_Contains():
     x = Symbol('x')
     assert latex(Contains(x, S.Naturals)) == r"x \in \mathbb{N}"