-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Milestone
Description
Bug report
Bug summary
The example below is taken straight from the texmanager
module docstring. The failure seems to be due to the function trying to stack numbers r
, g
, b
with an array alpha
without first converting them to arrays.
Code for reproduction
from matplotlib.texmanager import TexManager
tm = TexManager()
s = (r'\TeX\ is Number '
r'$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!')
Z = tm.get_rgba(s, fontsize=12, dpi=80, rgb=(1, 0, 0))
Actual outcome
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-59-bb42fe32143e> in <module>
5 s = (r'\TeX\ is Number '
6 r'$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!')
----> 7 Z = tm.get_rgba(s, fontsize=12, dpi=80, rgb=(1, 0, 0))
/usr/local/lib/python3.6/dist-packages/matplotlib/texmanager.py in get_rgba(self, tex, fontsize, dpi, rgb)
385 if Z is None:
386 alpha = self.get_grey(tex, fontsize, dpi)
--> 387 Z = np.dstack([r, g, b, alpha])
388 self.rgba_arrayd[key] = Z
389
/usr/local/lib/python3.6/dist-packages/numpy/lib/shape_base.py in dstack(tup)
697 """
698 _warn_for_nonsequence(tup)
--> 699 return _nx.concatenate([atleast_3d(_m) for _m in tup], 2)
700
701
ValueError: all the input array dimensions except for the concatenation axis must match exactly
Expected outcome
Expect an array Z
to be retruned
Matplotlib version
- Operating system: Ubuntu 18.04.4 LTS
- Matplotlib version: 3.2.0rc2+1643.g122575cd5
- Python version: 3.6.9
Metadata
Metadata
Assignees
Labels
No labels