In QGIS 2.8.0 you can do that with the offset option in the Style Layer Properties. In my example with three polylines (they are exactly superposed too):
Click in "Simple line" of line2 to display "Offset" option (I set 1 mm):
Click in "Simple line" of line5 to display "Offset" option (I set -1 mm):
The result obtained (Offset of line4 unchanged; 0 mm):
Editing note (answering to alpha-beta-soup comment):
With the next code, executed in the Python Console of QGIS, I have the same result:
from PyQt4.QtGui import *
mc=iface.mapCanvas()
layers=[]
renderer = []
n = mc.layerCount()
symbol = range(n)
symbol[0] = QgsLineSymbolV2.createSimple({'color':'green',
'width':'1',
'offset':'1.0'})
symbol[1] = QgsLineSymbolV2.createSimple({'color':'red',
'width':'1',
'offset':'0.0'})
symbol[2] = QgsLineSymbolV2.createSimple({'color':'blue',
'width':'1',
'offset':'-1.0'})
for i in range(n):
layers.append(mc.layer(i))
for layer in layers:
renderer.append(layer.rendererV2())
for i in range(n):
renderer[i].setSymbol(symbol[i])
iface.mapCanvas().refresh()
for layer in layers:
iface.legendInterface().refreshLayerSymbology(layer)