Skip to content

corrupt eps output on python3 #3494

Closed
Closed
@japs

Description

@japs

the following script works fine on python 2.7.8, however it produces a non valid eps file on python 3.4.1.

import numpy as np
import matplotlib
from matplotlib import pyplot as plt

if __name__ == "__main__":
    print ("Using matplotlib v%s" %matplotlib.__version__)
    x = np.linspace(0, 10)
    y = np.sin(x)

    plt.figure()
    plt.plot(x, y)
    plt.savefig("out.eps", format='eps')
    plt.show()

The two attachements following are the two outputs generated by python2 and python3 respectively (I changed the file extension to png to be able to upload them, but they are indeed eps files).
out_python2
out_python3

With a diff of the two files, and some manual editing, I found that the line responsible for the malfunctioning is the following

377c377                                                                    
< /DejaVuSans findfont                                                     
---                                                                        
> /b'DejaVuSans' findfont

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions