Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Vasudevan, Rama K
pycroscopy
Commits
3b1c71f1
Commit
3b1c71f1
authored
Aug 09, 2017
by
Somnath, Suhas
Committed by
CompPhysChris
Aug 14, 2017
Browse files
Added option to plot family of spectra with y offsets
parent
e9492f8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
pycroscopy/viz/plot_utils.py
View file @
3b1c71f1
...
...
@@ -258,8 +258,8 @@ def rainbow_plot(ax, ao_vec, ai_vec, num_steps=32, cmap=plt.cm.viridis, **kwargs
fig.colorbar(CS3)"""
def
plot_line_family
(
axis
,
x_axis
,
line_family
,
line_names
=
None
,
label_prefix
=
'Line'
,
label_suffix
=
''
,
cmap
=
plt
.
cm
.
viridis
,
**
kwargs
):
def
plot_line_family
(
axis
,
x_axis
,
line_family
,
line_names
=
None
,
label_prefix
=
'Line'
,
label_suffix
=
''
,
cmap
=
plt
.
cm
.
viridis
,
y_offset
=
0
,
**
kwargs
):
"""
Plots a family of lines with a sequence of colors
...
...
@@ -279,6 +279,8 @@ def plot_line_family(axis, x_axis, line_family, line_names=None, label_prefix='L
suffix for the legend (after the index of the curve)
cmap : matplotlib.colors.LinearSegmentedColormap object
Colormap to be used
y_offset : (optional) number
quantity by which the lines are offset from each other vertically (useful for spectra)
"""
num_lines
=
line_family
.
shape
[
0
]
...
...
@@ -290,7 +292,7 @@ def plot_line_family(axis, x_axis, line_family, line_names=None, label_prefix='L
line_names
=
[
'{} {} {}'
.
format
(
label_prefix
,
line_ind
,
label_suffix
)
for
line_ind
in
range
(
num_lines
)]
for
line_ind
in
range
(
num_lines
):
axis
.
plot
(
x_axis
,
line_family
[
line_ind
],
axis
.
plot
(
x_axis
,
line_family
[
line_ind
]
+
line_ind
*
y_offset
,
label
=
line_names
[
line_ind
],
color
=
cmap
(
int
(
255
*
line_ind
/
(
num_lines
-
1
))),
**
kwargs
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment