Hey all,
I intend to plot a recorded spectrum (the black line in the figure below) together with bar charts that are located at certain x-values. These bar charts should have different colors and be stacked above each other (be independent) as shown in the figure. However, the (simplified) code below does not result in such a plot. What could I try to change to make it work?
% line plot
x1=1:10;y1=1:10;%bar 1 data
xb1 = [2 5 7];yb1 = [4 4 4]; %bar 2 data
xb2 = [1 2 9];yb2 = [2 2 2];figurep1 = plot(x1,y1);hold onb1 = bar(xb1,yb1-2,0.2,'BaseValue',-2);b2 = bar(xb2,yb2-6,0.2,'r','BaseValue',-6);end
Thanks in advance!
bearli
Best Answer