Skip to content
Permalink
Browse files

Include pre-generated gif for display purposes

  • Loading branch information...
r-b-g-b committed Feb 14, 2019
1 parent e0dd915 commit 08b59cf01c22a2add295befe0c3f8b6f8ce2e13e
Showing with 24 additions and 2 deletions.
  1. BIN docs/flatmap_comparison.gif
  2. +24 −2 examples/quickflat/plot_make_gif.py
Binary file not shown.
@@ -9,23 +9,45 @@
"""
import cortex
import matplotlib.pyplot as plt
import numpy as np
np.random.seed(1234)

################################################################################
# Create several pycortex Volumes
#

volumes = {'first': cortex.Volume.random(subject='S1', xfmname='fullhead', vmin=-2, vmax=2),
'second': cortex.Volume.random(subject='S1', xfmname='fullhead', vmin=-2, vmax=2)}

################################################################################
# Plot flat maps individually
#

_ = cortex.quickflat.make_figure(volumes['first'])
_ = cortex.quickflat.make_figure(volumes['second'])
_ = plt.show()


################################################################################
# Generate an animated gif that switches between frames every 1.5 seconds
filename = "./my_flatmap.gif"
cortex.quickflat.make_gif(filename, volumes, frame_duration=1.5)
#

filename = "./flatmap_comparison.gif"
cortex.quickflat.make_gif(filename, volumes, frame_duration=1.5)

################################################################################
# Display gif inline in an IPython notebook
#

import io
from IPython.display import Image

stream = io.BytesIO()
cortex.quickflat.make_gif(stream, volumes, frame_duration=1.5)

Image(stream.read())


################################################################################
# .. image:: ../../flatmap_comparison.gif

0 comments on commit 08b59cf

Please sign in to comment.
You can’t perform that action at this time.