{"action":"created","issue":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/4328","repository_url":"https://api.github.com/repos/mne-tools/mne-python","labels_url":"https://api.github.com/repos/mne-tools/mne-python/issues/4328/labels{/name}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/4328/comments","events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/4328/events","html_url":"https://github.com/mne-tools/mne-python/issues/4328","id":237130989,"number":4328,"title":"Why can't I plot two topomaps side by side in a Jupyter notebook?","user":{"login":"cbrnr","id":4377312,"avatar_url":"https://avatars1.githubusercontent.com/u/4377312?v=3","gravatar_id":"","url":"https://api.github.com/users/cbrnr","html_url":"https://github.com/cbrnr","followers_url":"https://api.github.com/users/cbrnr/followers","following_url":"https://api.github.com/users/cbrnr/following{/other_user}","gists_url":"https://api.github.com/users/cbrnr/gists{/gist_id}","starred_url":"https://api.github.com/users/cbrnr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbrnr/subscriptions","organizations_url":"https://api.github.com/users/cbrnr/orgs","repos_url":"https://api.github.com/users/cbrnr/repos","events_url":"https://api.github.com/users/cbrnr/events{/privacy}","received_events_url":"https://api.github.com/users/cbrnr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-20T08:28:46Z","updated_at":"2017-06-20T08:35:26Z","closed_at":null,"body":"I would like to plot two topomaps side by side in a Jupyter notebook. However, the following code (which works as expected in a Python console) only plots one topomap and an empty figure when run in a notebook:\r\n\r\n```Python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nimport mne\r\n\r\nchans = ['Fp1', 'AF7', 'AF3', 'F1', 'F3', 'F5', 'F7', 'FT7',\r\n         'FC5', 'FC3', 'FC1', 'C1', 'C3', 'C5', 'T7', 'TP7',\r\n         'CP5', 'CP3', 'CP1', 'P1', 'P3', 'P5', 'P7', 'P9',\r\n         'PO7', 'PO3', 'O1', 'Iz', 'Oz', 'POz', 'Pz', 'CPz',\r\n         'Fpz', 'Fp2', 'AF8', 'AF4', 'AFz', 'Fz', 'F2', 'F4',\r\n         'F6', 'F8', 'FT8', 'FC6', 'FC4', 'FC2', 'FCz', 'Cz',\r\n         'C2', 'C4', 'C6', 'T8', 'TP8', 'CP6', 'CP4', 'CP2',\r\n         'P2', 'P4', 'P6', 'P8', 'P10', 'PO8', 'PO4', 'O2']\r\n\r\ninfo = mne.create_info(chans, sfreq=512, ch_types=\"eeg\", montage=mne.channels.read_montage(\"biosemi64\"))\r\n\r\nfig, (left, right) = plt.subplots(ncols=2, figsize=(10, 5))\r\nmne.viz.plot_topomap(np.random.randint(0, 100, 64), info, vmin=0, axes=left)\r\nleft.set_title(\"x1\")\r\nmne.viz.plot_topomap(np.random.randint(0, 100, 64), info, vmin=0, axes=right)\r\nright.set_title(\"x2\")\r\nfig.suptitle(\"Overall title\")\r\n```\r\n![screen shot 2017-06-20 at 10 27 34](https://user-images.githubusercontent.com/4377312/27323786-1e1f2066-55a3-11e7-8147-b4873a1a2c8f.png)\r\n\r\nAny ideas why this is happening and how I could fix it?"},"comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments/309684023","html_url":"https://github.com/mne-tools/mne-python/issues/4328#issuecomment-309684023","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/4328","id":309684023,"user":{"login":"jaeilepp","id":3456414,"avatar_url":"https://avatars1.githubusercontent.com/u/3456414?v=3","gravatar_id":"","url":"https://api.github.com/users/jaeilepp","html_url":"https://github.com/jaeilepp","followers_url":"https://api.github.com/users/jaeilepp/followers","following_url":"https://api.github.com/users/jaeilepp/following{/other_user}","gists_url":"https://api.github.com/users/jaeilepp/gists{/gist_id}","starred_url":"https://api.github.com/users/jaeilepp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaeilepp/subscriptions","organizations_url":"https://api.github.com/users/jaeilepp/orgs","repos_url":"https://api.github.com/users/jaeilepp/repos","events_url":"https://api.github.com/users/jaeilepp/events{/privacy}","received_events_url":"https://api.github.com/users/jaeilepp/received_events","type":"User","site_admin":false},"created_at":"2017-06-20T08:35:26Z","updated_at":"2017-06-20T08:35:26Z","body":"I'm not very fluent with notebooks, but I think the problem is that the figure gets drawn prematurely. So hopefully it's fixed by changing last lines to:\r\n```\r\nfig, (left, right) = plt.subplots(ncols=2, figsize=(10, 5))\r\nmne.viz.plot_topomap(np.random.randint(0, 100, 64), info, vmin=0, axes=left, show=False)\r\nleft.set_title(\"x1\")\r\nmne.viz.plot_topomap(np.random.randint(0, 100, 64), info, vmin=0, axes=right, show=True)\r\nright.set_title(\"x2\")\r\nfig.suptitle(\"Overall title\")\r\n```"}}
{"actor":{"display_login":"jaeilepp"}}