# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

## Changing Axes Properties

This example shows how to get properties of an axes in MATLAB® and change axes property values to customize your graph.

### Axes Objects

All plots are contained within an axes.

```x = linspace(0,12); y = 10*exp(-0.65*x); figure plot(x,y)```

The `gca` function returns the current axes for the current figure. Like all graphics objects, axes have properties that you can view and modify. These properties have default values. The display of the axes object, `ax`, shows the most commonly used axes properties, such as `XLim`, `YLim`, `XScale`, and `YScale`.

`ax = gca`
```ax = Axes with properties: XLim: [0 12] YLim: [0 10] XScale: 'linear' YScale: 'linear' GridLineStyle: '-' Position: [0.1300 0.1100 0.7750 0.8150] Units: 'normalized' Show all properties ```

### Get Individual Axes Properties

To access individual properties, use dot notation syntax `object.PropertyName`. For example, return the x-axis limits.

`ax.XLim`
```ans = 0 12 ```

### Change Commonly Used Axes Properties

Several functions are available to change axes properties. For example, use the `axis` function to change the axes scaling and appearance.

`axis square`

Use the `xlim`, `ylim`, and `zlim` functions to change the axes limits.

`xlim([0 10])`

Use the `xlabel`, `ylabel`, and `zlabel` functions to label the axes.

```xlabel('x') ylabel('exp(x)')```

### Change Other Axes Properties

To customize the look of the axes, change property values using dot notation syntax `object.PropertyName`.

```ax.YScale = 'log'; % set y-axis to logarithmic scaling ax.FontSize = 12; % set font size for axes labels ax.XGrid = 'on'; % draw gridlines perpendicular to x-axis ax.YGrid = 'on'; % draw gridlines perpendicular to y-axis```

### Get All Axes Properties

Graphics objects in MATLAB have many properties. To see all the properties of an object, use the `get` command.

`get(ax)`
``` ALim: [0 1] ALimMode: 'auto' ActivePositionProperty: 'outerposition' AmbientLightColor: [1 1 1] BeingDeleted: 'off' Box: 'on' BoxStyle: 'back' BusyAction: 'queue' ButtonDownFcn: '' CLim: [0 1] CLimMode: 'auto' CameraPosition: [5 5.0050 17.3205] CameraPositionMode: 'auto' CameraTarget: [5 5.0050 0] CameraTargetMode: 'auto' CameraUpVector: [0 1 0] CameraUpVectorMode: 'auto' CameraViewAngle: 6.6086 CameraViewAngleMode: 'auto' Children: [1x1 Line] Clipping: 'on' ClippingStyle: '3dbox' Color: [1 1 1] ColorOrder: [7x3 double] ColorOrderIndex: 2 CreateFcn: '' CurrentPoint: [2x3 double] DataAspectRatio: [5 4.9950 1] DataAspectRatioMode: 'auto' DeleteFcn: '' FontAngle: 'normal' FontName: 'Helvetica' FontSize: 12 FontSmoothing: 'on' FontUnits: 'points' FontWeight: 'normal' GridAlpha: 0.1500 GridAlphaMode: 'auto' GridColor: [0.1500 0.1500 0.1500] GridColorMode: 'auto' GridLineStyle: '-' HandleVisibility: 'on' HitTest: 'on' Interruptible: 'on' LabelFontSizeMultiplier: 1.1000 Layer: 'bottom' Legend: [0x0 GraphicsPlaceholder] LineStyleOrder: '-' LineStyleOrderIndex: 1 LineWidth: 0.5000 MinorGridAlpha: 0.2500 MinorGridAlphaMode: 'auto' MinorGridColor: [0.1000 0.1000 0.1000] MinorGridColorMode: 'auto' MinorGridLineStyle: ':' NextPlot: 'replace' OuterPosition: [0 0 1 1] Parent: [1x1 Figure] PickableParts: 'visible' PlotBoxAspectRatio: [1 1 1] PlotBoxAspectRatioMode: 'manual' Position: [0.1300 0.1100 0.7750 0.8150] Projection: 'orthographic' Selected: 'off' SelectionHighlight: 'on' SortMethod: 'childorder' Tag: '' TickDir: 'in' TickDirMode: 'auto' TickLabelInterpreter: 'tex' TickLength: [0.0100 0.0250] TightInset: [0.0093 0.0896 0 0.0226] Title: [1x1 Text] TitleFontSizeMultiplier: 1.1000 TitleFontWeight: 'bold' Type: 'axes' UIContextMenu: [0x0 GraphicsPlaceholder] Units: 'normalized' UserData: [] View: [0 90] Visible: 'on' XAxis: [1x1 NumericRuler] XAxisLocation: 'bottom' XColor: [0.1500 0.1500 0.1500] XColorMode: 'auto' XDir: 'normal' XGrid: 'on' XLabel: [1x1 Text] XLim: [0 10] XLimMode: 'manual' XMinorGrid: 'off' XMinorTick: 'off' XScale: 'linear' XTick: [0 2 4 6 8 10] XTickLabel: {6x1 cell} XTickLabelMode: 'auto' XTickLabelRotation: 0 XTickMode: 'auto' YAxis: [1x1 NumericRuler] YAxisLocation: 'left' YColor: [0.1500 0.1500 0.1500] YColorMode: 'auto' YDir: 'normal' YGrid: 'on' YLabel: [1x1 Text] YLim: [0.0100 10] YLimMode: 'auto' YMinorGrid: 'on' YMinorTick: 'on' YScale: 'log' YTick: [0.0100 0.1000 1 10] YTickLabel: {4x1 cell} YTickLabelMode: 'auto' YTickLabelRotation: 0 YTickMode: 'auto' ZAxis: [1x1 NumericRuler] ZColor: [0.1500 0.1500 0.1500] ZColorMode: 'auto' ZDir: 'normal' ZGrid: 'off' ZLabel: [1x1 Text] ZLim: [-1 1] ZLimMode: 'auto' ZMinorGrid: 'off' ZMinorTick: 'off' ZScale: 'linear' ZTick: [-1 0 1] ZTickLabel: '' ZTickLabelMode: 'auto' ZTickLabelRotation: 0 ZTickMode: 'auto' ```