-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from LaurentRDC/develop
Develop
- Loading branch information
Showing
6 changed files
with
310 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,5 @@ We currently have the following tutorials: | |
structure | ||
simulation | ||
baseline | ||
image | ||
image | ||
plotting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
.. include:: ../references.txt | ||
|
||
.. _plotting_tutorial: | ||
|
||
***************** | ||
Plotting Tutorial | ||
***************** | ||
|
||
Time-resolved diffraction measurements can benefit from careful plotting, especially | ||
for time-series of data. This tutorial will go over some of the functions that make this easier | ||
in :mod:`skued`. | ||
|
||
Contents | ||
======== | ||
|
||
* :ref:`colors` | ||
|
||
.. _colors: | ||
|
||
Colors | ||
====== | ||
|
||
Time-order | ||
---------- | ||
|
||
Time-resolved data possesses obvious ordering, and as such we can use colors to | ||
enhance visualization of such data. | ||
|
||
My favourite way to plot time-series data is to make use of rainbow colors to indicate time: | ||
|
||
.. plot:: | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from skued import spectrum_colors | ||
|
||
t = np.linspace(0, 10, num = 1000) | ||
y = np.exp(-t/0.4) + 10 *(1 - np.exp(-t/2)) + np.sin(2*np.pi*t) | ||
fig, ax = plt.subplots(1,1) | ||
ax.scatter(t, y, c = list(spectrum_colors(y.size))) | ||
|
||
ax.set_title('Some realistic dynamics') | ||
ax.set_xlabel('Time (ps)') | ||
ax.set_ylabel('Intensity (a.u.)') | ||
|
||
plt.show() | ||
|
||
This functionality can be accessed through the :func:`spectrum_colors` generator:: | ||
|
||
from skued import spectrum_colors, last | ||
|
||
colors = spectrum_colors(5) | ||
# Colors always go from purple to red (increasing wavelength) | ||
purple = next(colors) | ||
red = last(colors) | ||
|
||
You can see some examples of uses of :func:`spectrum_colors` in the :ref:`baseline tutorial <baseline_tutorial>`. | ||
|
||
:ref:`Return to Top <plotting_tutorial>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.