Failed to save eps

Hi,

Could anybody help me to take a look my following code? When I
save it to eps format, the eps file is corrupted. But i can save as pdf
format successfully instead.

Regards
tommy

from matplotlib.font_manager import FontProperties
data = ((16.31, 76.35, 62.62, 135.2),
(6.4, 12.64, 87, 124.8 ),
(6.08,60.18,75.2,100.59))

color=(‘b’,‘r’,‘g’,‘y’)
width
= 0.2
fig = plt.figure()
fig.set_size_inches((4.2,4.2))

ax = fig.add_axes((0.2,0.1,0.75,0.

8))
rects=[]
xticks=[]
patterns
= (’…’,’//’,‘xx’, ‘\\’)

for i in range(len(data)):
row = data[i]
for j in range(len(row)):

    rect, = ax.bar(i+width*j, row[j], width,fill=False, edgecolor='black', hatch=patterns[j])
    rect.set_hatch(patterns[j])
    rect.set_fill(False)
    if i==0:
        rects.append(rect)

xticks.append(i+2*width)

ax.set_xticks(xticks)
ax.set_xticklabels((‘Q1(s,p1,)’,'Q2(s,p2,)’,‘Q3(s,p3,*)’))

ax.set_ylabel(‘Resp. time (ms)’)
lg=fig.legend(rects, (‘3XL-Array’,‘3XL-MP’,‘Jena2(db-based)’,‘Jena2(file-based)’), loc=(0.65,0.7), prop=FontProperties(size=9))

lg.draw_frame(False)
draw()
fig.savefig(“4b.eps”, format=“eps”, bbox_inches=‘tight’) # Failed to save, the eps is corrupted
#fig.savefig(“4b.pdf”, format=“pdf”, bbox_inches=‘tight’) # pdf format can be save correctly.

It seems to be failing on the minus signs in the text, due to a recent (incorrect) change to declared encoding of the postscript file.

This has been corrected in r8305.

You didn't mention which version of matplotlib you are running... I'm not sure this bug would be in the latest released version, only SVN trunk.

Mike

afancy wrote:

···

Hi,

Could anybody help me to take a look my following code? When I save it to eps format, the eps file is corrupted. But i can save as pdf format successfully instead.

Regards
tommy

from matplotlib.font_manager import FontProperties
data = ((16.31, 76.35, 62.62, 135.2),
        (6.4, 12.64, 87, 124.8 ),
        (6.08,60.18,75.2,100.59))

color=('b','r','g','y')
width = 0.2 fig = plt.figure()
fig.set_size_inches((4.2,4.2))

ax = fig.add_axes((0.2,0.1,0.75,0.
8))
rects=
xticks=
patterns = ('...','//','xx', '\\\\')

for i in range(len(data)):
    row = data[i]
    for j in range(len(row)):
        rect, = ax.bar(i+width*j, row[j], width,fill=False, edgecolor='black', hatch=patterns[j])
        rect.set_hatch(patterns[j])
        rect.set_fill(False)
        if i==0:
            rects.append(rect)
    xticks.append(i+2*width)
   ax.set_xticks(xticks) ax.set_xticklabels(('Q1(s,p1,*)','Q2(s,p2,*)','Q3(s,p3,*)')) ax.set_ylabel('Resp. time (ms)')
lg=fig.legend(rects, ('3XL-Array','3XL-MP','Jena2(db-based)','Jena2(file-based)'), loc=(0.65,0.7), prop=FontProperties(size=9))
lg.draw_frame(False)
draw() fig.savefig("4b.eps", format="eps", bbox_inches='tight') # Failed to save, the eps is corrupted #fig.savefig("4b.pdf", format="pdf", bbox_inches='tight') # pdf format can be save correctly.
------------------------------------------------------------------------

------------------------------------------------------------------------------

  ------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA