In [1]:
from pylab import *
%matplotlib inline
import matplotlib.cm as mcm
In [2]:
xkcd()
rcParams['font.size']=20
fig = gcf()
ax = gca()
xticks([]) # labels
yticks([])
ax.xaxis.set_ticks_position('none') # tick markers
ax.yaxis.set_ticks_position('none')
for side in ['bottom','right','top','left']:
    ax.spines[side].set_visible(False)
    
dps = fig.dpi_scale_trans.inverted()
bbox = ax.get_window_extent().transformed(dps)
width, height = bbox.width, bbox.height

# manual arrowhead width and length
hw = 1./20
hl = 1./20
lw = 1. # axis line width
ohg = 0.3 # arrow overhang

# compute matching arrowhead length and width
yhw = hw * height/width
yhl = hl * width/height

# draw x and y axis
ax.arrow(0, 0, 1, 0., fc='k', ec='k', lw = lw,
         head_width=hw, head_length=hl, overhang = ohg,
         length_includes_head= True, clip_on = False)

ax.arrow(0, 0, 0., 1, fc='k', ec='k', lw = lw,
         head_width=yhw, head_length=yhl, overhang = ohg,
         length_includes_head= True, clip_on = False)

clip_on = True #if only positive x or y values.

xlim(0, 1)
ylim(0, 1)

xlabel('Immigration control')
xticks([0.2, 0.8], ['Looser', 'Tighter'])
ylabel('Violence risk')
title('Immigration and fear')
yticks([0.2, 0.4, 0.6, 0.8], ['Very\nlow', 'Low', 'Medium', 'High'])

xs = arange(0.1, 0.9, 0.01)
ys = log10((1 - xs)*10)
plot(xs, ys, label='Pretend relationship')
annotate('Fear-mongerers\nalways say\nwe are here', xy=(0.3, 0.9), fontsize=12, ha='center', va='center')

plot([0.1, 0.9], [0.2, 0.1], label='Reality')
annotate('But we are more\nlike here', xy=(0.7, 0.1), fontsize=12, ha='center', va='center')

legend(loc=2, bbox_to_anchor=(1, 1), fontsize=12)
show();