Just to make sure I got this right: here, you use the fact that False inherits from 0, and True from 1 to set the position of the plot.
Wouldn't it be easier, and more straight forward to use an enumerate such as::

    for pos, connectivity in enumerate((None, knn_graph)):

and use pos instead of the ``connectivity is None`` ?