tsplot crashes when there is only one datapoint
See original GitHub issuewhen data has only one datapoint (for a given unit and condition), tsplot crashes with an out of bounds exception.
seaborn/timeseries.py in tsplot(data, time, unit, condition, value, err_style, ci, interpolate, color, estimator, n_boot, err_palette, err_kws, legend, ax, **kwargs)
328 # Pad the sides of the plot only when not interpolating
329 ax.set_xlim(x.min(), x.max())
--> 330 x_diff = x[1] - x[0]
331 if not interpolate:
332 ax.set_xlim(x.min() - x_diff, x.max() + x_diff)
IndexError: index 1 is out of bounds for axis 0 with size 1
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Toad Data Point - Commonly Crashes, Performance Issues
A common issue we find is that the program will randomly crash/close out completely. This occurs both while it is in active use...
Read more >What's new in each version — seaborn 0.11.2 documentation
The tsplot() function was rewritten to accept data in a long-form DataFrame and to plot different traces by condition. This introduced a relatively...
Read more >Matplotlib crashes after saving many plots - Stack Overflow
I would create a single figure and clear the figure each time (use .clf ). import matplotlib.pyplot as plt fig = plt.figure() for...
Read more >Excel graphing having a one data point drop out, data errantly ...
I have tried over writing the formulas as the graphs generally don't graph the raw data but formulas from it to analyze data,...
Read more >Time Series Data Visualization with Python
Line plots of observations over time are popular, but there is a suite of other plots that you can use to learn more...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Closing with tsplot deprecation.
https://cloud.sagemath.com/projects/26d7dccf-e180-450e-b348-05e3242d8779/files/2016-12-14-171122.ipynb
Creating the example, I noticed that it only breaks if the single data point trace comes last because x is a loop variable, so the padding only takes the last trace into account… which means that the padding is probably off when you have traces that vary wildly in their span in general.
Thanks, Andreas