I have multiple figures of data with two y-axes. The left axis shows the histocounts of the values; the right axis gives the cummulative probability of distribution.
I cannot find a way to point to a figure handle and select the left-side ylim data and then reset the ylim values.
Goal: I wish to automatically determine the maximum ylim among the figures to then reset all the plots to the max ylim for easy comparison. The only working "solution" is using yyaxis to select "left" or 'right" and then accessing the ylim values. This however requires that the I manually use gcf after the analysis run and have the figure of interest at the top of the stack.
To summarize: I wish to get the max left-side ylims among a group of figures and then reset all the upper left-side ylims to the group maximum. To further help illustrate this issue, I have included sample data generating fake data for four data sets.
Thank you in advance any help.
data = randn(1,1000*n,4);
ylabel('cummulative plot');
title(sprintf('phony balony data set #%s',num2str(n)));
get(f(3).CurrentAxes);
ALim: [0 1]
ALimMode: 'auto'
AlphaScale: 'linear'
Alphamap: [0 0.0159 0.0317 0.0476 0.0635 0.0794 0.0952 0.1111 0.1270 0.1429 0.1587 0.1746 0.1905 0.2063 0.2222 0.2381 0.2540 0.2698 0.2857 0.3016 0.3175 0.3333 … ] (1×64 double)
AmbientLightColor: [1 1 1]
BeingDeleted: off
Box: on
BoxStyle: 'back'
BusyAction: 'queue'
ButtonDownFcn: ''
CLim: [0 1]
CLimMode: 'auto'
CameraPosition: [-0.2000 0.5000 17.3205]
CameraPositionMode: 'auto'
CameraTarget: [-0.2000 0.5000 0]
CameraTargetMode: 'auto'
CameraUpVector: [0 1 0]
CameraUpVectorMode: 'auto'
CameraViewAngle: 6.6086
CameraViewAngleMode: 'auto'
Children: [1×1 Line]
Clipping: on
ClippingStyle: 'rectangle'
Color: [1 1 1]
ColorOrder: [0.8500 0.3250 0.0980]
ColorOrderIndex: 1
ColorScale: 'linear'
Colormap: [256×3 double]
ContextMenu: [0×0 GraphicsPlaceholder]
CreateFcn: ''
CurrentPoint: [2×3 double]
DataAspectRatio: [7.9200 1 2]
DataAspectRatioMode: 'auto'
DeleteFcn: ''
FontAngle: 'normal'
FontName: 'Helvetica'
FontSize: 10
FontSizeMode: 'auto'
FontSmoothing: on
FontUnits: 'points'
FontWeight: 'normal'
GridAlpha: 0.1500
GridAlphaMode: 'auto'
GridColor: [0.1500 0.1500 0.1500]
GridColorMode: 'auto'
GridLineStyle: '-'
GridLineWidth: 0.5000
GridLineWidthMode: 'auto'
HandleVisibility: 'on'
HitTest: on
InnerPosition: [0.1300 0.1100 0.7750 0.8150]
InteractionOptions: [1×1 matlab.graphics.interaction.interactionoptions.InteractionOptions]
Interactions: [1×1 matlab.graphics.interaction.interface.DefaultAxesInteractionSet]
Interruptible: on
LabelFontSizeMultiplier: 1.1000
Layer: 'bottom'
Layout: [0×0 matlab.ui.layout.LayoutOptions]
Legend: [0×0 GraphicsPlaceholder]
LineStyleCyclingMethod: 'aftercolor'
LineStyleOrder: [7×2 char]
LineStyleOrderIndex: 2
LineWidth: 0.5000
MinorGridAlpha: 0.2500
MinorGridAlphaMode: 'auto'
MinorGridColor: [0.1000 0.1000 0.1000]
MinorGridColorMode: 'auto'
MinorGridLineStyle: ':'
MinorGridLineWidth: 0.5000
MinorGridLineWidthMode: 'auto'
NextPlot: 'add'
NextSeriesIndex: 2
OuterPosition: [0 0 1 1]
Parent: [1×1 Figure]
PickableParts: 'visible'
PlotBoxAspectRatio: [1 0.7897 0.7897]
PlotBoxAspectRatioMode: 'auto'
Position: [0.1300 0.1100 0.7750 0.8150]
PositionConstraint: 'outerposition'
Projection: 'orthographic'
Selected: off
SelectionHighlight: on
SortMethod: 'childorder'
Subtitle: [1×1 Text]
SubtitleFontWeight: 'normal'
Tag: ''
TickDir: 'in'
TickDirMode: 'auto'
TickLabelInterpreter: 'tex'
TickLength: [0.0100 0.0250]
TightInset: [0.0964 0.0990 0.0877 0.0526]
Title: [1×1 Text]
TitleFontSizeMultiplier: 1.1000
TitleFontWeight: 'bold'
TitleHorizontalAlignment: 'center'
Toolbar: [1×1 AxesToolbar]
Type: 'axes'
Units: 'normalized'
UserData: []
View: [0 90]
Visible: on
XAxis: [1×1 NumericRuler]
XAxisLocation: 'bottom'
XColor: [0.1500 0.1500 0.1500]
XColorMode: 'auto'
XDir: 'normal'
XGrid: on
XLabel: [1×1 Text]
XLim: [-4.1600 3.7600]
XLimMode: 'auto'
XLimitMethod: 'tickaligned'
XMinorGrid: off
XMinorTick: off
XScale: 'linear'
XTick: [-4 -3 -2 -1 0 1 2 3]
XTickLabel: {8×1 cell}
XTickLabelMode: 'auto'
XTickLabelRotation: 0
XTickLabelRotationMode: 'auto'
XTickMode: 'auto'
YAxis: [2×1 NumericRuler]
YAxisLocation: 'right'
YColor: [0.8500 0.3250 0.0980]
YColorMode: 'manual'
YDir: 'normal'
YGrid: on
YLabel: [1×1 Text]
YLim: [0 1]
YLimMode: 'auto'
YLimitMethod: 'tickaligned'
YMinorGrid: off
YMinorTick: off
YScale: 'linear'
YTick: [0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1]
YTickLabel: {11×1 cell}
YTickLabelMode: 'auto'
YTickLabelRotation: 0
YTickLabelRotationMode: 'auto'
YTickMode: 'auto'
ZAxis: [1×1 NumericRuler]
ZColor: [0.1500 0.1500 0.1500]
ZColorMode: 'auto'
ZDir: 'normal'
ZGrid: on
ZLabel: [1×1 Text]
ZLim: [-1 1]
ZLimMode: 'auto'
ZLimitMethod: 'tickaligned'
ZMinorGrid: off
ZMinorTick: off
ZScale: 'linear'
ZTick: [-1 0 1]
ZTickLabel: ''
ZTickLabelMode: 'auto'
ZTickLabelRotation: 0
ZTickLabelRotationMode: 'auto'
ZTickMode: 'auto'
get(f(3).CurrentAxes);
ALim: [0 1]
ALimMode: 'auto'
AlphaScale: 'linear'
Alphamap: [0 0.0159 0.0317 0.0476 0.0635 0.0794 0.0952 0.1111 0.1270 0.1429 0.1587 0.1746 0.1905 0.2063 0.2222 0.2381 0.2540 0.2698 0.2857 0.3016 0.3175 0.3333 … ] (1×64 double)
AmbientLightColor: [1 1 1]
BeingDeleted: off
Box: on
BoxStyle: 'back'
BusyAction: 'queue'
ButtonDownFcn: ''
CLim: [0 1]
CLimMode: 'auto'
CameraPosition: [-0.2000 0.5000 17.3205]
CameraPositionMode: 'auto'
CameraTarget: [-0.2000 0.5000 0]
CameraTargetMode: 'auto'
CameraUpVector: [0 1 0]
CameraUpVectorMode: 'auto'
CameraViewAngle: 6.6086
CameraViewAngleMode: 'auto'
Children: [1×1 Line]
Clipping: on
ClippingStyle: 'rectangle'
Color: [1 1 1]
ColorOrder: [0.8500 0.3250 0.0980]
ColorOrderIndex: 1
ColorScale: 'linear'
Colormap: [256×3 double]
ContextMenu: [0×0 GraphicsPlaceholder]
CreateFcn: ''
CurrentPoint: [2×3 double]
DataAspectRatio: [7.9200 1 2]
DataAspectRatioMode: 'auto'
DeleteFcn: ''
FontAngle: 'normal'
FontName: 'Helvetica'
FontSize: 10
FontSizeMode: 'auto'
FontSmoothing: on
FontUnits: 'points'
FontWeight: 'normal'
GridAlpha: 0.1500
GridAlphaMode: 'auto'
GridColor: [0.1500 0.1500 0.1500]
GridColorMode: 'auto'
GridLineStyle: '-'
GridLineWidth: 0.5000
GridLineWidthMode: 'auto'
HandleVisibility: 'on'
HitTest: on
InnerPosition: [0.1300 0.1100 0.7750 0.8150]
InteractionOptions: [1×1 matlab.graphics.interaction.interactionoptions.InteractionOptions]
Interactions: [1×1 matlab.graphics.interaction.interface.DefaultAxesInteractionSet]
Interruptible: on
LabelFontSizeMultiplier: 1.1000
Layer: 'bottom'
Layout: [0×0 matlab.ui.layout.LayoutOptions]
Legend: [0×0 GraphicsPlaceholder]
LineStyleCyclingMethod: 'aftercolor'
LineStyleOrder: [7×2 char]
LineStyleOrderIndex: 2
LineWidth: 0.5000
MinorGridAlpha: 0.2500
MinorGridAlphaMode: 'auto'
MinorGridColor: [0.1000 0.1000 0.1000]
MinorGridColorMode: 'auto'
MinorGridLineStyle: ':'
MinorGridLineWidth: 0.5000
MinorGridLineWidthMode: 'auto'
NextPlot: 'add'
NextSeriesIndex: 2
OuterPosition: [0 0 1 1]
Parent: [1×1 Figure]
PickableParts: 'visible'
PlotBoxAspectRatio: [1 0.7897 0.7897]
PlotBoxAspectRatioMode: 'auto'
Position: [0.1300 0.1100 0.7750 0.8150]
PositionConstraint: 'outerposition'
Projection: 'orthographic'
Selected: off
SelectionHighlight: on
SortMethod: 'childorder'
Subtitle: [1×1 Text]
SubtitleFontWeight: 'normal'
Tag: ''
TickDir: 'in'
TickDirMode: 'auto'
TickLabelInterpreter: 'tex'
TickLength: [0.0100 0.0250]
TightInset: [0.0964 0.0990 0.0877 0.0526]
Title: [1×1 Text]
TitleFontSizeMultiplier: 1.1000
TitleFontWeight: 'bold'
TitleHorizontalAlignment: 'center'
Toolbar: [1×1 AxesToolbar]
Type: 'axes'
Units: 'normalized'
UserData: []
View: [0 90]
Visible: on
XAxis: [1×1 NumericRuler]
XAxisLocation: 'bottom'
XColor: [0.1500 0.1500 0.1500]
XColorMode: 'auto'
XDir: 'normal'
XGrid: on
XLabel: [1×1 Text]
XLim: [-4.1600 3.7600]
XLimMode: 'auto'
XLimitMethod: 'tickaligned'
XMinorGrid: off
XMinorTick: off
XScale: 'linear'
XTick: [-4 -3 -2 -1 0 1 2 3]
XTickLabel: {8×1 cell}
XTickLabelMode: 'auto'
XTickLabelRotation: 0
XTickLabelRotationMode: 'auto'
XTickMode: 'auto'
YAxis: [2×1 NumericRuler]
YAxisLocation: 'right'
YColor: [0.8500 0.3250 0.0980]
YColorMode: 'manual'
YDir: 'normal'
YGrid: on
YLabel: [1×1 Text]
YLim: [0 1]
YLimMode: 'auto'
YLimitMethod: 'tickaligned'
YMinorGrid: off
YMinorTick: off
YScale: 'linear'
YTick: [0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1]
YTickLabel: {11×1 cell}
YTickLabelMode: 'auto'
YTickLabelRotation: 0
YTickLabelRotationMode: 'auto'
YTickMode: 'auto'
ZAxis: [1×1 NumericRuler]
ZColor: [0.1500 0.1500 0.1500]
ZColorMode: 'auto'
ZDir: 'normal'
ZGrid: on
ZLabel: [1×1 Text]
ZLim: [-1 1]
ZLimMode: 'auto'
ZLimitMethod: 'tickaligned'
ZMinorGrid: off
ZMinorTick: off
ZScale: 'linear'
ZTick: [-1 0 1]
ZTickLabel: ''
ZTickLabelMode: 'auto'
ZTickLabelRotation: 0
ZTickLabelRotationMode: 'auto'
ZTickMode: 'auto'