question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add simple time series plotting function

See original GitHub issue

Hey,

I just thought of adding a little helper function to the display module which simply plots a time series. Basically a plt.plot() but uses the librosa.display.TimeFormatter. I have this already as a helper function and it comes in handy in times where you might have 1d-features with different sampling rate and want to compare them…whatever, no big deal. Is this interesting as a general function?

Code

import numpy as np
import matplotlib.pyplot as plt

import librosa
import librosa.display


sr = 10

x = np.random.rand(100)

plt.figure(figsize=(10, 6))
times = librosa.samples_to_time(np.arange(len(x)), sr=sr)
plt.plot(times, x)
plt.gca().xaxis.set_major_formatter(librosa.display.TimeFormatter(lag=False))
plt.gca().xaxis.set_label_text('Time')

plt.show()

example

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bmcfeecommented, May 12, 2021

I propose that this feature be rolled into #1207

0reactions
lostanlencommented, Apr 23, 2018

Color-code the waveform according to a perceptual audio feature (e.g. spectral brightness à la Traktor) and you’ve got a unique viz in the Pythonic landscape here ☺️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotting Time Series Data
The plotting of time series object is most likely one of the steps of the analysis of time-series data. The \code{ is a...
Read more >
How to Plot a Time Series in Matplotlib? - GeeksforGeeks
We need to have two axes for our graph i.e X and Y-axis. We will start by having a dataframe to plot the...
Read more >
Basic Time Series Plotting | Unidata Python Training
To learn about time series analysis, we first need to find some data and get it into Python. In this case we're going...
Read more >
Time Series Data Visualization with Python
Visualization plays an important role in time series analysis and forecasting. Plots of the raw sample data can provide valuable diagnostics ...
Read more >
How to Plot a Time Series in R (With Examples) - Statology
This tutorial explains how to plot a time series in R, including several examples.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found