Sub Main 'Create Grapher as an Object Dim Grapher As Object 'Start Grapher Set Grapher = CreateObject("Grapher.Application") 'Make Grapher visible Grapher.Visible = True 'Create a new document window Set Plot1 = Grapher.Documents.Add(grfPlotDoc) 'Set page size Plot1.PageSetup.pageSize = grfLetter Plot1.PageSetup.Orientation = grfLandscape pageheight = 8.5 pagewidth = 11 'Set the page units to inches Plot1.Windows.Item(1).PageUnits(grfInches) 'Prompts for data file, columns, number of matrix columns, rows, etc. DataFile$ = GetFilePath$() Num_Variables = CLng(InputBox("How many variables are there?")) First_Row = CLng(InputBox("What is the first row of data?")) Last_Row = CLng(InputBox("What is the last row of data?")) Tot_Width = CLng(InputBox("How big should the matrix be in inches?")) 'Create initial histogram graph Set Graph1 = Plot1.Shapes.AddHistogramGraph(DataFile$,1) Set Histogram1 = Graph1.Plots.Item(1) 'Set histogram properties Histogram1.AutoLastRow = False Histogram1.LastRow = Last_Row Histogram1.AutoFirstRow = False Histogram1.FirstRow = First_Row 'Set-up the initial axes Set YAxis1 = Graph1.Axes.Item(2) Set XAxis1 = Graph1.Axes.Item(1) YAxis1.Link.ToAxis = "X Axis 1" YAxis1.Link.xPos = True XAxis1.Link.ToAxis = "Y Axis 1" XAxis1.Link.yPos = True XAxis1.Link.YPosOffset = Tot_Width/Num_Variables XAxis1.length = Tot_Width/Num_Variables YAxis1.length = Tot_Width/Num_Variables XAxis1.Tickmarks.MajorSide = grfTicksTopRight XAxis1.Tickmarks.MinorSide = grfTicksNone XAxis1.TickLabels.MajorSide = grfTicksTopRight XAxis1.TickLabels.MinorOn = False XAxis1.title.Side = grfAxisTitleRightTop XAxis1.title.worksheet = DataFile$ XAxis1.title.text = "<<@a1>>" YAxis1.Visible = False 'Add X axes to the graph For i = 2 To Num_Variables Set XAxis = Graph1.AddAxis(grfXAxis) XAxis.length = Tot_Width/Num_Variables XAxis.Link.ToAxis = "X Axis 1" XAxis.Link.xPos = True XAxis.Link.XPosOffset = Tot_Width/Num_Variables*(i-1) XAxis.Link.yPos = True XAxis.Link.YPosOffset = 0 XAxis.Link.Limits = False XAxis.AutoMin = True XAxis.AutoMax = True XAxis.Tickmarks.MajorSide = grfTicksTopRight XAxis.Tickmarks.MinorSide = grfTicksNone XAxis.TickLabels.MajorSide = grfTicksTopRight XAxis.TickLabels.MinorOn = False XAxis.title.Side = grfAxisTitleRightTop XAxis.title.worksheet = DataFile$ 'Set the title from the cell - converting the i to a column letter with Chr(i+64) XAxis.title.text = "<<@"+Chr(i+64)+"1>>" ConvertToLetter = "" Next i 'Add first Y axis to the graph Set YAxis2 = Graph1.AddAxis(grfYAxis) YAxis2.Link.xPos = True YAxis2.Link.XPosOffset = 0 YAxis2.Link.ToAxis = "Y Axis 1" YAxis2.Link.yPos = True YAxis2.Link.YPosOffset = 0 YAxis2.Link.length = True YAxis2.length = 1.66667 YAxis2.title.worksheet = DataFile$ YAxis2.title.text = "<<@a1>>" YAxis2.Grid.AtMajorTicks = False 'Add each additional Y axis to the graph For i = 2 To Num_Variables Set YAxis = Graph1.AddAxis(grfYAxis) YAxis.length = Tot_Width/Num_Variables YAxis.Link.ToAxis = "Y Axis 2" YAxis.Link.xPos = True YAxis.Link.XPosOffset = 0 YAxis.Link.yPos = True YAxis.Link.YPosOffset = -1*Tot_Width/Num_Variables*(i-1) YAxis.Link.Limits = False YAxis.AutoMin = True YAxis.AutoMax = True YAxis.Grid.AtMajorTicks = False YAxis.title.worksheet = DataFile$ 'Set the title from the cell - converting the i to a column letter with Chr(i+64) YAxis.title.text = "<<@"+Chr(i+64)+"1>>" ConvertToLetter = "" Next i 'Add the master axes Set XAxisMaster = Graph1.AddAxis(grfXAxis) Set YAxisMaster = Graph1.AddAxis(grfYAxis) 'Set Master X properties With XAxisMaster .Tickmarks.MajorSide = grfTicksOff .Tickmarks.MinorSide = grfTicksOff .TickLabels.MajorOn = False .TickLabels.MinorOn = False .length = Tot_Width .AutoMin = False .Min = 0 .AutoMax = False .Max = Num_Variables .Grid.AtMajorTicks = True .Grid.ParallelTo = YAxisMaster.Name .Tickmarks.MajorSpacing = 1 .Link.ToAxis = "X Axis 1" .Link.yPos = True .Link.YPosOffset = Tot_Width*-1 .Link.xPos = True .Link.XPosOffset = 0 End With Set YAxis5 = Graph1.Axes.Item(8) 'Set Master Y properties With YAxisMaster .Tickmarks.MajorSide = grfTicksOff .Tickmarks.MinorSide = grfTicksOff .TickLabels.MajorOn = False .TickLabels.MinorOn = False .length = Tot_Width .AutoMin = False .Min = 0 .AutoMax = False .Max = Num_Variables .Grid.AtMajorTicks = True .Grid.ParallelTo = XAxisMaster.Name .Tickmarks.MajorSpacing = 1 controllingaxis = "Y Axis"+Str(Num_Variables+1) .Link.ToAxis = Str(controllingaxis) .Link.yPos = True .Link.YPosOffset = 0 .Link.xPos = True .Link.XPosOffset = 0 End With 'Add the scatter plots For i = 1 To Num_Variables 'i increments row = y For j = 1 To Num_Variables 'j increments column = x If i <> j Then XAxisName = "X Axis" + Str$(j) YAxisName = "Y Axis" + Str$(i+1) Set LineScatterPlot1 = Graph1.AddLinePlot(DataFile$,j,i,XAxisName,YAxisName) LineScatterPlot1.symbolFreq = 1 LineScatterPlot1.line.style = "Invisible" LineScatterPlot1.AutoLastRow = False LineScatterPlot1.LastRow = Last_Row LineScatterPlot1.AutoFirstRow = False LineScatterPlot1.FirstRow = First_Row End If Next j Next i 'Add the other histograms For i = 2 To Num_Variables Set YAxisHist = Graph1.AddAxis(grfYAxis) YAxisHist.length = Tot_Width/Num_Variables YAxisHist.Link.ToAxis = "Y Axis 2" YAxisHist.Link.xPos = True YAxisHist.Link.XPosOffset = 0 YAxisHist.Link.yPos = True YAxisHist.Link.YPosOffset = -1*Tot_Width/Num_Variables*(i-1) YAxisHist.Visible = False XAxisName = "X Axis"+ Str$(i) Set Histogram2 = Graph1.AddHistogram(DataFile$,i,XAxisName,YAxisHist.Name) Histogram2.AutoLastRow = False Histogram2.LastRow = Last_Row Histogram2.AutoFirstRow = False Histogram2.FirstRow = First_Row Histogram2.ResetToDefault Next 'Position the graph and turn off the title Graph1.left = pagewidth/2-(Graph1.width/2) Graph1.top = pageheight/2+(Graph1.width/2) Graph1.title.text = "" End Sub