forked from NSLS-II-XPD/xpdView
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #19 from chiahaoliu/REF_plot_update
REF: waterfall plot update
- Loading branch information
Showing
4 changed files
with
100 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""module to start pure mpl-backend viewer""" | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from xpdview.cross_2d import StackViewer, CrossSection | ||
from xpdview.waterfall import Waterfall | ||
|
||
# def data list to test | ||
img_data_list = [] | ||
key_list = [] | ||
int_data_list = [] | ||
x = np.linspace(0, 2*np.pi, 200) | ||
for i in range(5): | ||
key_list.append(str(i)) | ||
img_data_list.append(np.random.rand(50, 50)) | ||
int_data_list.append((x, np.sin(x))) | ||
|
||
# init | ||
viewer_fig = plt.figure('test_viewer') # let mpl decide backend | ||
cross_section = CrossSection(viewer_fig) | ||
stack_viewer = StackViewer(cross_section, img_data_list=img_data_list, | ||
key_list=key_list) | ||
waterfall_fig = plt.figure('test_waterfall') # let mpl decide backend | ||
waterfall = Waterfall(fig=waterfall_fig, key_list=key_list, | ||
int_data_list=int_data_list, | ||
unit=('x_unit', 'y_unit')) | ||
plt.show() |
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,19 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from xpdview.waterfall import Waterfall | ||
|
||
fig = plt.figure('test_title') | ||
unit = ('x unit', 'y unit') | ||
int_data_list = [] | ||
key_list = [] | ||
|
||
x = np.linspace(0, 4*np.pi, 200) | ||
for i in range(5): | ||
key_list.append(str(i)) | ||
int_data_list.append((x, np.sin(x))) | ||
|
||
p1 = Waterfall() | ||
p2 = Waterfall(fig, key_list=key_list, int_data_list=int_data_list, | ||
unit=unit) | ||
|
||
plt.show() |
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