<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Visualizing 2D data
Colormaps are used to map quantities stored at each point of a (discretized) surface to colours.
Colours live in a 3D space.
2D data may contain metric or form information (or both).
How can we choose a good colormap?
Perception
Intuition
Convention
By default, we want to use a sequential colormap (not assuming anything about the structure of our data).
References
Step1:  Are we dealing with form or metric information here?
Step2:  Revise and edit to best convey the scientific result.
<ASSISTANT_TASK:>
Python Code:
import pickle
data = pickle.load(open('data/correlation_map.pkl', 'rb'))
data.keys()
type(data['excitation energy'])
data['excitation energy'].shape
data['correlation'].shape
import matplotlib
%matplotlib inline
matplotlib.style.use('ggplot')
import matplotlib.pyplot as plt
plt.imshow(data['correlation'])
Explanation: Visualizing 2D data
Colormaps are used to map quantities stored at each point of a (discretized) surface to colours.
Colours live in a 3D space.
2D data may contain metric or form information (or both).
How can we choose a good colormap?
Perception
Intuition
Convention
By default, we want to use a sequential colormap (not assuming anything about the structure of our data).
References:
- matplotlib: http://matplotlib.org/users/colormaps.html, https://matplotlib.org/users/dflt_style_changes.html
- viscm: https://bids.github.io/colormap/
- Another SciPy 2015 talk: https://www.youtube.com/watch?v=XjHzLUnHeM0
End of explanation
matplotlib.__version__
from matplotlib.cm import magma, inferno, plasma, viridis
# from colormaps import magma, inferno, plasma, viridis
correlation = data['correlation']
excitation = data['excitation energy']
emission = data['emission energy']
plt.imshow(correlation,
           origin='lower',
           cmap=magma)
plt.imshow(correlation,
           origin='lower',
           extent=[excitation.min(), excitation.max(), emission.min(), emission.max()],
           cmap=magma)
f, ax = plt.subplots(1, 1, figsize=(5, 5))
map0 = ax.imshow(correlation,
          origin='lower',
          extent=[excitation.min(), excitation.max(), emission.min(), emission.max()],
          cmap=magma)
ax.plot(excitation, excitation)
ax.set_xlabel('Excitation Energy (eV)')
f.colorbar(map0, ax=ax)
Explanation: Are we dealing with form or metric information here?
End of explanation
f, ax = plt.subplots(1, 1, figsize=(5, 5))
ax.imshow(correlation,
          origin='lower',
          extent=[excitation.min(), excitation.max(), emission.min(), emission.max()],
          cmap=viridis)
ax.plot(excitation, excitation)
ax.set_xlabel('Excitation Energy (eV)')
Explanation: Revise and edit to best convey the scientific result.
End of explanation
<END_TASK>