Closed
Description
If I try to use a numpy float as the input of the matplotlib.pyplot.figaspect
function, I get an error.
This is the code
import numpy as np
import matplotlib.pyplot as plt
aspect = np.float64(2) / np.float64(1)
# print aspect
w, h = plt.figaspect(aspect)
fig = plt.figure(figsize=(w,h))
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
with the Error
/usr/local/lib/python2.7/dist-packages/matplotlib/figure.pyc in figaspect(arg)
1770 # Extract the aspect ratio of the array
1771 if isarray:
-> 1772 nr, nc = arg.shape[:2]
1773 arr_ratio = float(nr) / nc
1774 else:
ValueError: need more than 0 values to unpack
If I convert aspect
to a float
, it works ok