Drawing a bar spanning across several dates in the x axis

I am trying to plot a bar chart with these characteristics:
  • The x axis is of dates
  • Each bar should span across multiple dates
  • The number of dates for each bar is the same
  • The dates of each bar do not overlap. They are consecutive
On top of the above, I want to plot, on the same figure, a plot chart with these characteristics:
  • The x axis is of dates too (same range of dates as the bar)
  • There is only one value per date in this series
I know how to plot the plot chart and the bar chart on the same figure using plotyy.
The part I am missing is how to make each bar be plotted across several dates. Currently I can only plot each bar on one date.
This example may clarify things:
  • I have a dataset of X data points. Each data point comes from 1 day. This is the plot chart I need to plot. For example, for M=30 and dates Jan-15 through Feb-15. There is one value for Jan 15, another value for Jan 16, and so on.
  • Now, a second dataset has data coming from the same time period. But instead of having a single point per date, there is one data point for periods of N days. In the same example of above, let's say N=5. There is one value for [Jan-15 through Jan-19], another value for [Jan-20 through Jan-24] and so forth. These have to be plotted as bars that span N=5 dates each. These bars don't overlap.
  • Both things have to be plotted on the same figure (no sub plots)

 Réponse acceptée

Mark
Mark le 23 Sep 2012
I ended up using "area" plots to simulate what I wanted.
Thanks for the no help

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by