X Tutup
Skip to content

pyplot.savefig doesn't expand ~ (tilde) in path #6067

@tobanw

Description

@tobanw

pyplot.savefig throws an error when given a path with a ~ for the user's home directory. Writing out the full path works as expected.

import matplotlib.pyplot as plt
output = '~/plot.png'
plt.plot(range(10))
plt.savefig(output)

FileNotFoundError: [Errno 2] No such file or directory: '~/plot.png'

Matplotlib 1.5.0, Python 3.4.3 (Anaconda 2.4.1), Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup