Repository: Qiskit/qiskit

Issue:
Small inconsistency in the mpl drawer
There is a small inconsistency how the parameters of a gate are showed in the matplotlib, with and without '(...)'.

```python
qr = QuantumRegister(2, 'q')
circuit_all = QuantumCircuit(qr)
circuit_all.u3(pi, pi, pi, qr[0])
circuit_all.cu3(pi, pi, pi, qr[0], qr[1])
circuit_all.draw(output='mpl')
```

![image](https://user-images.githubusercontent.com/766693/61549782-eb9a2780-aa1e-11e9-81ac-f638cce9c23b.png)


### What is the expected enhancement?

If I have to choose, I would go with removing the parenthesis everywhere. But, for sure, it should be everywhere the same... 


Discussion:
Similarly, another inconsistency in the way to present the parameters when `usepiformat` is used.
```python
circuit_all.draw(output='mpl', style={'usepiformat': True})
```
![image](https://user-images.githubusercontent.com/766693/61556571-1b9df680-aa30-11e9-8e22-9d4c667d03ea.png)

```python
circuit_all.draw(output='mpl', style={'usepiformat': False})
```
![image](https://user-images.githubusercontent.com/766693/61556581-235d9b00-aa30-11e9-9deb-292a2ba69e0c.png)

Interested in trying my hand at this to learn more about how Terra was wrote, but I haven't worked inside this project's source before. Any recommendation on a starting point for this (if you know one, otherwise I'll poke around until I find something).

Thank you :)
Awesome! You will find the mpl drawer code in the visualization folder. Start by running the visualization tests in the test folder. Let me know if you need any help! 
Hi @baileytincher, just checking to see how this is going. I wanted to give this a shot, but wanted to check with you before doing so.
@aasfaw I think you can go ahead. @baileytincher seems MIA.
> Hi @baileytincher, just checking to see how this is going. I wanted to give this a shot, but wanted to check with you before doing so.

I've been working on this a little, but by all means go ahead if you have an idea. I don't want to hold up the project if you can get it done sooner!

Resolving patch:
diff --git a/qiskit/visualization/matplotlib.py b/qiskit/visualization/matplotlib.py
--- a/qiskit/visualization/matplotlib.py
+++ b/qiskit/visualization/matplotlib.py
@@ -250,7 +250,8 @@ def _gate(self, xy, fc=None, wide=False, text=None, subtext=None):
 
         if wide:
             if subtext:
-                wid = WID * 2.2
+                boxes_wide = round(max(len(subtext), len(text)) / 10, 1) or 1
+                wid = WID * 1.5 * boxes_wide
             else:
                 boxes_wide = round(len(text) / 10) or 1
                 wid = WID * 2.2 * boxes_wide
@@ -663,8 +664,26 @@ def _draw_ops(self, verbose=False):
             for op in layer:
 
                 if op.name in _wide_gate:
+                    if op.type == 'op' and hasattr(op.op, 'params'):
+                        param = self.param_parse(op.op.params)
+                        if '$\\pi$' in param:
+                            pi_count = param.count('pi')
+                            len_param = len(param) - (5 * pi_count)
+                        else:
+                            len_param = len(param)
+                        if len_param > len(op.name):
+                            box_width = round(len(param) / 10)
+                            # If more than 4 characters min width is 2
+                            if box_width <= 1:
+                                box_width = 2
+                            if layer_width < box_width:
+                                if box_width > 2:
+                                    layer_width = box_width * 2
+                                else:
+                                    layer_width = 2
                     if layer_width < 2:
                         layer_width = 2
+
                 # if custom gate with a longer than standard name determine
                 # width
                 elif op.name not in ['barrier', 'snapshot', 'load', 'save',
@@ -675,7 +694,12 @@ def _draw_ops(self, verbose=False):
                     # handle params/subtext longer than op names
                     if op.type == 'op' and hasattr(op.op, 'params'):
                         param = self.param_parse(op.op.params)
-                        if len(param) > len(op.name):
+                        if '$\\pi$' in param:
+                            pi_count = param.count('pi')
+                            len_param = len(param) - (5 * pi_count)
+                        else:
+                            len_param = len(param)
+                        if len_param > len(op.name):
                             box_width = round(len(param) / 8)
                             # If more than 4 characters min width is 2
                             if box_width <= 1:
@@ -811,12 +835,8 @@ def _draw_ops(self, verbose=False):
                 elif len(q_xy) == 1:
                     disp = op.name
                     if param:
-                        prm = '({})'.format(param)
-                        if len(prm) < 20:
-                            self._gate(q_xy[0], wide=_iswide, text=disp,
-                                       subtext=prm)
-                        else:
-                            self._gate(q_xy[0], wide=_iswide, text=disp)
+                        self._gate(q_xy[0], wide=_iswide, text=disp,
+                                   subtext=str(param))
                     else:
                         self._gate(q_xy[0], wide=_iswide, text=disp)
                 #
@@ -989,7 +1009,7 @@ def param_parse(v):
         param_parts = [None] * len(v)
         for i, e in enumerate(v):
             try:
-                param_parts[i] = pi_check(e, output='mpl')
+                param_parts[i] = pi_check(e, output='mpl', ndigits=3)
             except TypeError:
                 param_parts[i] = str(e)
 


Test patch: