# first, delete existing windows to save memory:
deleteAllWindows(CytoscapeConnection())
window.title = 'setCenter demo'
cw <- CytoscapeWindow (window.title, graph=makeSimpleGraph())
displayGraph (cw)
layoutNetwork(cw, 'force-directed')
original.center <- getCenter (cw) # named list, "x" and "y".
# now pan the display to the left, by setting the the visual center
# to increasing values of x, without changing the location of the
# simple graph
setCenter (cw, 200, 90)
system ('sleep 0.1')
setCenter (cw, 100, 90)
system ('sleep 0.1')
setCenter (cw, 0, 90)
system ('sleep 0.1')
setCenter (cw, -100, 90)
system ('sleep 0.1')
# and now pan back to the original position
setCenter (cw, -100, 0)
system ('sleep 0.1')
setCenter (cw, original.center$x, original.center$y)
Run the code above in your browser using DataLab