# Time Series Plots with percentiles

Hi, I was wondering if there was a way in Julia to create timeseries plots with percentile bands. I have tried it using ribbon option in plot recipies. I do get some bands, but I am not understanding how to adjust the width based on percentile value. I believe I dont have a thorough understanding of how percentile values work in a time series plot. If someone has a working example or can explain the idea of how percentiles are calculated in a timeseries plots, I would really appreciate it ?.

What do your percentiles measure? Plotting a percentile band implies that there is some distribution at each point in time, either because you observe multiple time series (eg different countries) or because your time series is some sort of estimate which has a distribution (eg coefficients from a regression model).

Once you’ve figured out what your distributions are it’s a matter of

``````plot(timestamps, timeseries, ribbon = (percentile.(vector_of_distributions, 0.05), percentile.(vector_of_distributions, 0.95))
``````

Here I’m assuming that your data is organised in such a way that you have a vector of distributions (empirical or theoretical) where each element is the distribution at one point in time.

1 Like

@Nilshg, Thanks for the reply, my percentiles are measuring pm, wind speed and wind direction and a time lag parameter I have calculated. My data is coming in at every second and I have made this plot for the entire day. I have calculated the percentiles for a vector distribution of data for every one minute. I have been trying to add the different levels of percentiles in the same plot .Right now I see that ribbon option in plots can only add two levels at a time. Do you have any suggestion on how to add multiple percentile levels and also label them based on different colors ?.

These are my original plots , I have plotted the 25th and 75th percentiles

I am looking for a plot that looks some what like this with the labels for different percentiles