Python ggplot Синтаксис метода сохранения графиков?
Пробовал несколько итеративных версий, основанных на сообщениях об ошибках, чтобы сохранить ggplot в файл с использованием метода пикселей или дюймов:
ggsave(filename="nlrundiff.jpg", width=4, height=4, units='in', plot=plt)
Безуспешно в любом случае, результирующая выдержка из сообщения об ошибке выглядит следующим образом:
/usr/local/lib/python2.7/dist-packages/ggplot/utils/ggutils.pyc in ggsave(filename, plot, device, format, path, scale, width, height, units, dpi, limitsize, **kwargs)
118 from_inch = {"in":lambda x:x,"cm":lambda x: x * 2.54, "mm":lambda x: x * 2.54 * 10}
119
--> 120 w, h = figure.get_size_inches()
121 issue_size = False
122 if width is None:
AttributeError: 'NoneType' object has no attribute 'get_size_inches'
Это ошибка входного синтаксиса с моей стороны или ошибка Python ggplot?
Благодарю.
1 ответ
Призвание ggsave(...)
without specifying the ggplot object or printing it beforehand is not supported (but the above is a bug and should print a user readable message).
So, either print the ggplot object with gg.draw()
или же print(gg)
а затем позвоните ggsave(...)
like you did above OR pass in the ggplot-object: ggsave(gg, filename=...)
,