How do I make an UIAxis's InnerPosition equal its OuterPosition?
24 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am currently trying to create a uiaxis object in app designer with no margins. Currently I have a 5 pixel margin around a uiaxis’s plot box (see the image below.). I have tried the following fixes;however , the 5 pixel margin persist:
- Removed all labels, tics, grids,
- Disabled box,
- Set the xlim and ylim to [0,Inf]
- Set the xlim and ylim to [-InF, Inf]
How do I remove the margin?
[1/16/2019] In other words, how do I make an axis's InnerPostion equal to its OuterPosition? Please note that my TighInset is already zero.
Most people would not care about 5 pixels, however the invisible margins create additional white space. I have positioned all of my components using the uigridlayout function. My layout makes sure that all components are separated by 10 pixels. The margins make the UIAXIS look as if it was accidently spaced 15 pixels from each component. This is unprofessional.
The Margin is the space between the blueline and the black box.
Here is the axis position information
K>> exampleAxis.OuterPosition
ans =
11 159 1000 400
K>> exampleAxis.InnerPosition
ans =
16 164 990 390
K>> app.DieAxes.TightInset
ans =
0 0 0 0
K>> exampleAxis.TightInset
ans =
0 0 0 0
Here all the properties. Please note that this is an example so there will be no reference to the gridlayout handle.
Show all properties
ALim: [0 1]
ALimMode: 'auto'
AlphaScale: 'linear'
Alphamap: [1×64 double]
AmbientLightColor: [1 1 1]
BackgroundColor: [0.9400 0.9400 0.9400]
BeingDeleted: 'off'
Box: 'off'
BoxStyle: 'full'
BusyAction: 'queue'
ButtonDownFcn: ''
CLim: [0 1]
CLimMode: 'auto'
CameraPosition: [0.5000 0.5000 9.1603]
CameraPositionMode: 'auto'
CameraTarget: [0.5000 0.5000 0.5000]
CameraTargetMode: 'auto'
CameraUpVector: [0 1 0]
CameraUpVectorMode: 'auto'
CameraViewAngle: 6.6086
CameraViewAngleMode: 'auto'
Children: [0×0 GraphicsPlaceholder]
Clipping: 'off'
ClippingStyle: '3dbox'
Color: [0 0 0]
ColorOrder: [7×3 double]
ColorOrderIndex: 1
ColorScale: 'linear'
Colormap: [64×3 double]
CreateFcn: ''
DataAspectRatio: [1 1 1]
DataAspectRatioMode: 'auto'
DeleteFcn: ''
FontAngle: 'normal'
FontName: 'Helvetica'
FontSize: 4
FontSmoothing: 'on'
FontUnits: 'pixels'
FontWeight: 'normal'
GridAlpha: 0.1500
GridAlphaMode: 'auto'
GridColor: [0.1500 0.1500 0.1500]
GridColorMode: 'auto'
GridLineStyle: '-'
HandleVisibility: 'on'
InnerPosition: [16 164 990 390]
Interruptible: 'on'
LabelFontSizeMultiplier: 1.1000
Layer: 'top'
Layout: [0×0 matlab.ui.layout.LayoutOptions]
Legend: [0×0 GraphicsPlaceholder]
LineStyleOrder: '-'
LineStyleOrderIndex: 1
LineWidth: 1.0000e-05
MinorGridAlpha: 0.2500
MinorGridAlphaMode: 'manual'
MinorGridColor: [0.1000 0.1000 0.1000]
MinorGridColorMode: 'manual'
MinorGridLineStyle: ':'
NextPlot: 'replacechildren'
OuterPosition: [11 159 1000 400]
Parent: [1×1 Figure]
PlotBoxAspectRatio: [1 0.3939 0.3939]
PlotBoxAspectRatioMode: 'auto'
Position: [11 159 1000 400]
Projection: 'orthographic'
SizeChangedFcn: ''
SortMethod: 'childorder'
Tag: ''
TickDir: 'out'
TickDirMode: 'manual'
TickLabelInterpreter: 'tex'
TickLength: [0 0.1000]
TightInset: [0 0 0 0]
Title: [1×1 Text]
TitleFontSizeMultiplier: 1.1000
TitleFontWeight: 'bold'
Type: 'axes'
UIContextMenu: [0×0 GraphicsPlaceholder]
Units: 'pixels'
UserData: []
View: [0 90]
Visible: 'off'
XAxis: [1×1 NumericRuler]
XAxisLocation: 'bottom'
XColor: 'none'
XColorMode: 'manual'
XDir: 'normal'
XGrid: 'off'
XLabel: [1×1 Text]
XLim: [0 Inf]
XLimMode: 'manual'
XMinorGrid: 'off'
XMinorTick: 'off'
XScale: 'linear'
XTick: []
XTickLabel: {}
XTickLabelMode: 'manual'
XTickLabelRotation: 0
XTickMode: 'manual'
YAxis: [1×1 NumericRuler]
YAxisLocation: 'left'
YColor: 'none'
YColorMode: 'manual'
YDir: 'normal'
YGrid: 'off'
YLabel: [1×1 Text]
YLim: [0 Inf]
YLimMode: 'manual'
YMinorGrid: 'off'
YMinorTick: 'off'
YScale: 'linear'
YTick: []
YTickLabel: ''
YTickLabelMode: 'manual'
YTickLabelRotation: 0
YTickMode: 'manual'
ZAxis: [1×1 NumericRuler]
ZColor: [0.1500 0.1500 0.1500]
ZColorMode: 'auto'
ZDir: 'normal'
ZGrid: 'off'
ZLabel: [1×1 Text]
ZLim: [0 1]
ZLimMode: 'manual'
ZMinorGrid: 'off'
ZMinorTick: 'off'
ZScale: 'linear'
ZTick: [0 0.5000 1]
ZTickLabel: ''
ZTickLabelMode: 'manual'
ZTickLabelRotation: 0
ZTickMode: 'manual'
Respuestas (1)
Daniel Capellán Martín
el 18 de Abr. de 2020
Hello,
You may find the answer checking the following post:
https://www.mathworks.com/matlabcentral/answers/360670-imshow-in-app-designer-image-size-doesn-t-fit
Where the code that at least worked for me was the following:
% Fill figure with axes and remove tick labels
app.UIAxes.Position = [0 0 app.UIFigure.Position(3:4)];
% Remove title, axis labels, and tick labels
title(app.UIAxes, []);
xlabel(app.UIAxes, []);
ylabel(app.UIAxes, []);
app.UIAxes.XAxis.TickLabels = {};
app.UIAxes.YAxis.TickLabels = {};
% Display image and stretch to fill axes
I = imshow('Flower.jpg', 'Parent', app.UIAxes, ...
'XData', [1 app.UIAxes.Position(3)], ...
'YData', [1 app.UIAxes.Position(4)]);
% Set limits of axes
app.UIAxes.XLim = [0 I.XData(2)];
app.UIAxes.YLim = [0 I.YData(2)];
You can also try to work with OuterPosition and InnerPosition properties.
Hope it works for you!
0 comentarios
Ver también
Categorías
Más información sobre Graphics Object Properties en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!