python - why the symbol '-' is omitted in 'y' axis when using science notation -
i use matplotlib plotting. today find out wired in plotting doesn't show '-' on y axis ticks. give me solutions it? thanks
the code is:
from pylab import * import numpy import scipy.io matplotlib.font_manager import fontproperties matplotlib import rc rc('font',**{'family':'serif','serif':['times new roman'],'size':7}) figure(num=1, figsize=(2.9,2.4), dpi=300, facecolor='w', edgecolor='k') x = np.linspace(0, 10, 1001, endpoint=true) y = numpy.power(x/100, 3) plot(x, y,'k-',label=r"simulatied $\sigma_x$") ylim(0,y.max()) ticklabel_format(style='sci',axis='y', scilimits=(0,0)) tight_layout() savefig("xy.pdf")
(https://www.dropbox.com/s/rfpavget4rlyww7/yx.png)
it seems problem caused font 'times new roman'. if changed font 'arial', '-' appears
rc('font',**{'family':'sans-serif','sans-serif':['arial'],'size':20})
Comments
Post a Comment