Skip to content

Commit

Permalink
Add Time UI secondary axis
Browse files Browse the repository at this point in the history
Signed-off-by: Travis F. Collins <[email protected]>
  • Loading branch information
tfcollins committed Feb 13, 2024
1 parent 8e7a6f6 commit 54c2a10
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion examples/ad9081_jesd_eye_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
fig = plt.figure()

eye_data_per_lane = dev._jesd.get_eye_data()

num_lanes = len(eye_data_per_lane.keys())

for i, lane in enumerate(eye_data_per_lane):
Expand All @@ -22,7 +23,7 @@
y1 = eye_data_per_lane[lane]["y1"]
y2 = eye_data_per_lane[lane]["y2"]

plt.subplot(int(num_lanes / 2), 2, int(i) + 1)
ax1 = plt.subplot(int(num_lanes / 2), 2, int(i) + 1)
plt.scatter(x, y1, marker="+", color="blue")
plt.scatter(x, y2, marker="+", color="red")
plt.xlim(eye_data_per_lane[lane]["graph_helpers"]["xlim"])
Expand All @@ -37,5 +38,15 @@
plt.axvline(0, color="black") # vertical
plt.axhline(0, color="black") # horizontal
plt.grid(True)
# Add secondary x-axis
x_norm = [round(n * 0.1, 2) for n in range(11)]
x.sort()
x = np.linspace(min(x), max(x), 11)

ax2 = ax1.twiny()
ax2.set_xlim(ax1.get_xlim())
ax2.set_xticks(x)
ax2.set_xticklabels(x_norm)
ax2.set_xlabel("Unit Interval (UI)")

plt.show()

0 comments on commit 54c2a10

Please sign in to comment.