View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.charting
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default How to control aspect ratio of X,Y axes?

Hi,

VBA code is the only way to do this preciesly.
Something like this, which is only quick and nasty code.

'----------------
Sub X()

Dim lngStep As Long

With ActiveChart
If .PlotArea.Width .PlotArea.Height Then
.PlotArea.Width = .PlotArea.Height
Else
.PlotArea.Height = .PlotArea.Width
End If

lngStep = 1
If .PlotArea.InsideWidth .PlotArea.InsideHeight Then _
lngStep = -1
Do While .PlotArea.InsideWidth < .PlotArea.InsideHeight
.PlotArea.Width = .PlotArea.Width + lngStep
Loop

End With
End Sub
'----------------

Cheers
Andy

JoeU2004 wrote:
Is there a straight-forward way to control the aspect ratio of the X and
Y axes?

I managed to do it by manually dragging the length and width of the
chart area until the aspect ratio looked like what I wanted.

But I'd rather do it a more methodical way, if possible. For example, I
thought under the Format Axis Scale, I thought there might be
something for Units per Inch. Nope.

(I am using Excel 2003.)

Since my original X coordinate ranged from 1 to 597 and Y ranged from
118 to 155, the aspect ratio was way off. I wanted 1-to-1; that is, the
visual distance between 118 and 123 on Y is the same as the distance
between 1 and 6 on X.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info