Can you please see the code below and let me know why the png figure comes out empty (it only contains the x-axis, does not contain the scatterplot). The pdf file has no such problems.
I have tried saving another usual line plot in .png format and I had no problems. Does this have to do with scatter plot and .png format? Thank you. The code import matplotlib.pyplot as plt import numpy differences = numpy.random.uniform(-2,2,190) bin_values = numpy.arange(-2,2.6,0.1) hist, bins = numpy.histogram(differences, bins = bin_values) fig1 = plt.figure() fig1.set_figwidth(6) fig1.set_figheight(3) ax1 = fig1.add_axes([0.1, 0.3, 0.8, 0.9]) ax1.patch.set_facecolor('Linen') for left, hist_val in zip(bins[:-1], hist): xvec = [left]*hist_val yvec = 0.05*numpy.arange(hist_val) + 0.1 if len(xvec) > 0: ax1.scatter(xvec,yvec) ax1.axvline(1.3, ymax=0.6, color='DarkGreen') # The frame of the axes is referred to as # spines in matplotlib for i in ax1.spines.iteritems(): if i[0] in ['top','right', 'left']: i[1].set_visible(False) print i # Ticks only in bottom ax1.xaxis.set_ticks_position('bottom') ax1.yaxis.set_ticks_position('none') ax1.set_ylim(bottom=0,top=1.5) fig1.savefig('trial_figure.png', facecolor='Linen') fig1.savefig('trial_figure.pdf', facecolor='Linen') ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users