import numpy as np import matplotlib.pyplot as plt plt.xkcd() fig = plt.figure( figsize=(5,3) ) # the data: n = 50 rng = np.random.RandomState(4637281) x = rng.rand(n)*9.0+0.5 y = rng.randn(n)*1.0+4.0 # plot it: ax = fig.add_subplot( 1, 1, 1 ) ax.spines['right'].set_visible(False) ax.spines['top'].set_visible(False) ax.yaxis.set_ticks_position('left') ax.xaxis.set_ticks_position('bottom') ax.set_xlim(0, 10.0) ax.set_ylim(0.0, 10.0) ax.set_xticks( np.arange(0, 11, 2)) ax.set_yticks( np.arange(0, 11, 2)) ax.set_xlabel('Time [Days]') ax.set_ylabel('Mass [kg]') outlier = (3.3, 8.6) ax.annotate('Outlier', xy=(outlier[0]+0.2, outlier[1]), xycoords='data', xytext=(5.4, 9.5), textcoords='data', ha='left', arrowprops=dict(arrowstyle="->", relpos=(0.0,0.5), connectionstyle="angle3,angleA=0,angleB=10") ) ax.scatter(x, y, s=50, c='b', zorder=5) ax.scatter(outlier[0], outlier[1], s=80, c='#CC0000', zorder=10) plt.tight_layout(); plt.savefig('outlier.pdf') #plt.show();