MATLAB: How to plot monthly values of precipitation over multiple years and have years plotted on x-axis

bar chart

I have a table with headings of year, month, and value where the value is the total precipitation of the month. I would like to make a bar chart that has the year plotted on the x-axis, but I'd also like to color-code each year's worth of data (12 bars, one for each month) to make it clear where one year starts and another ends. How do I do this?

Best Answer

How do I reshape my array that is in the form (year, month, data value): 1991, 1, 45.2 1991, 2, 84.3 1991, 3, 23.3 1991, 4, 97.1 ... 2016, 12, 17.4 Into the form jan feb mar apr may .... dec 1991 45.2 84.3 23.3 97.4 .... ... 2016 .... 17.4