barh overrides parent axes settings in double axis plot
Mostrar comentarios más antiguos
EDIT: submitted before I was finished. Attaching test data.
EDIT2: example plots of undesirable output.
I'm trying to plot a double x axis plot. Ax1 is parent to a time series plot. Ax2 is parent to a horizontal grouped bar chart. When I try to plot the horizontal bar chart using the second x-axis, it overrides ax1 settings. How do I prevent or fix this?
figure(1); clf
set(gcf,'Color','white')
set(gca,'units','centimeters')
pos = get(gcf,'pos')
set(gcf,'pos',[pos(1) pos(2) 20 50])
% time series plot
p1 = plot(x1_col1,y1,'color','b')
% time series axis settings
ax1 = gca;
set(ax1,'TickDir','out')
set(ax1,'YDir','reverse')
set(ax1,'YLim',[1980 2100])
set(ax1,'YTick',1980:10:2100)
set(ax1,'XLim',[20 160])
set(ax1,'XTick'[31 61 92 120 151])
set(ax1,'XTickLabel',{'Dec 1','Jan 1','Feb 1','Mar 1','Apr 1'})
set(xlabel('Snow Disappearance Date'))
hold on
p2 = plot(x1_col2,y1,'color','r')
% horizontal grouped bar plot
% bar plot axis settings
ax2 = axes('Position',ax1_pos,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none',...
'YLim',[1980 2100],...
'YDir','reverse',...
'XLim',[0 1]);
p2 = barh(y1,vw_area,'grouped','Parent',ax2);
% THIS IS WHERE THE AX2 flips to ax1 osition and overrides my time series plot.
Respuestas (0)
Categorías
Más información sobre Discrete Data Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!