Skip to content

AudioData.plot()#395

Draft
Gautzilla wants to merge 10 commits into
Project-OSmOSE:mainfrom
Gautzilla:audiodata-plot
Draft

AudioData.plot()#395
Gautzilla wants to merge 10 commits into
Project-OSmOSE:mainfrom
Gautzilla:audiodata-plot

Conversation

@Gautzilla
Copy link
Copy Markdown
Contributor

Who's this 👴

Don't know to what extent this would be used, but this is a first shot at providing a way of plotting the audio data.

Example with the Core API:

sd = SpectroData(...)

fig, axs = plt.subplots(2,1)

sd.audio_data.plot(ax=axs[0]) # Plots the audio data
axs[0].set_ylim(-0.1, 0.1)
axs[0].set_xlim(sd.begin, sd.end)
axs[0].set_xticks([])

sd.plot(ax=axs[1])

fig.subplots_adjust(hspace=0)
plt.show()
image

@Gautzilla Gautzilla self-assigned this May 20, 2026
@Gautzilla Gautzilla added the Feature A new feature to add to OSEkit label May 20, 2026
@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented May 20, 2026

Coverage Status

coverage: 98.955% (+0.01%) from 98.944% — Gautzilla:audiodata-plot into Project-OSmOSE:main

@mathieudpnt
Copy link
Copy Markdown
Contributor

LGTM but I was wondering if one could change some plot properties like line width, color, etc ?

@Gautzilla
Copy link
Copy Markdown
Contributor Author

LGTM but I was wondering if one could change some plot properties like line width, color, etc ?

Yup that's good!

I've passed the *args and **kwargs to the Axes.plot() method:

sd = SpectroData(...)

fig, axs = plt.subplots(2,1)

sd.audio_data.plot(ax=axs[0], color="red", linestyle="dashdot", linewidth=2) # Plots the audio data
axs[0].set_ylim(-0.1, 0.1)
axs[0].set_xlim(sd.begin, sd.end)
axs[0].set_xticks([])

sd.plot(ax=axs[1])

fig.subplots_adjust(hspace=0)
plt.show()
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature A new feature to add to OSEkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants