Refactor signal visualizations to use Matplotlib, removing Altair dependencies and updating figure configurations for clarity
This commit is contained in:
parent
b032bb8610
commit
bc9d8904e2
2 changed files with 73 additions and 88 deletions
|
@ -43,7 +43,7 @@ t = np.arange(n+1)
|
|||
s = rng.choice([0, 1], n)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
ax.stairs(s, t, lw=3)
|
||||
ax.stairs(s, t, lw=3, baseline=None)
|
||||
ax.set(
|
||||
xlim=(0, n),
|
||||
ylim=(-.5, 1.5),
|
||||
|
@ -88,7 +88,6 @@ lhs = (qmc.LatinHypercube(d=n-2, rng=rng).random(1)[0] - .5) * t_max/n
|
|||
t = t_base + np.concatenate(([0], lhs, [0]))
|
||||
t = t_base
|
||||
s = 5 * rng.random(n)
|
||||
s[-1] = s[-2]
|
||||
|
||||
t_interp = np.linspace(0, t_max, 1024)
|
||||
s_interp = np.clip(CubicSpline(t, s)(t_interp), 0, 5)
|
||||
|
@ -127,7 +126,7 @@ t = np.arange(n+1)
|
|||
s = rng.integers(0, 16, n)
|
||||
|
||||
fig, ax = plt.subplots()
|
||||
ax.stairs(s, t, lw=3)
|
||||
ax.stairs(s, t, lw=3, baseline=None)
|
||||
ax.set(
|
||||
xlim=(0, n),
|
||||
ylim=(-.5, 16.5),
|
||||
|
@ -136,18 +135,6 @@ ax.set(
|
|||
)
|
||||
ax.yaxis.set_major_locator(ticker.MultipleLocator(1))
|
||||
ax.xaxis.set_major_locator(ticker.MultipleLocator(1))
|
||||
# alt.Chart(
|
||||
# data
|
||||
# ).mark_line(
|
||||
# interpolate="step-after",
|
||||
# strokeWidth=3,
|
||||
# ).encode(
|
||||
# alt.X("t:Q").axis(title="Temps (s)").scale(domain=(0,n)),
|
||||
# alt.Y("s:Q", axis=alt.Axis(title="Signal numérique", values=np.arange(0, 16))).# scale(domain=(0,15)),
|
||||
# ).properties(
|
||||
# width="container",
|
||||
# height=200,
|
||||
# )
|
||||
```
|
||||
Exemple de signal numérique
|
||||
````
|
Loading…
Add table
Add a link
Reference in a new issue