2

エラーメッセージのプロンプトに基づいて、ピクセルまたはインチのいずれかの方法を使用して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 のバグですか?

ありがとう。

4

1 に答える 1

0

ggsave(...)ggplot オブジェクトを指定せずに呼び出したり、事前に出力したりすることはサポートされていません (ただし、上記はバグあり、ユーザーが読み取り可能なメッセージを出力する必要があります)。

gg.draw()したがって、またはを使用して ggplot オブジェクトを出力し、上記のようprint(gg)に呼び出すかggsave(...)、ggplot-object: を渡しますggsave(gg, filename=...)

于 2014-07-05T18:33:54.267 に答える