(Does anyone use GraphicsGrid? It seems like a trainwreck to me, with wild amounts of spacings that you can get rid of by manually tweaking them, but they crop right back up when you try to scale the image to a larger size).
So with the data defined as
getMaxPadding[p_List] := Map[Max, (BorderDimensions@ Image[Show[#, LabelStyle -> White, Background -> White]] & /@ p)~Flatten~{{2}, {3}}, {2}] + 1; combinedplot[data_, xrange_, yrange_, plotopts : OptionsPattern[]] := Module[ Module[ {rightdata, topdata, dy, contourplot, rightplot, topplot, padding, dimensions}, rightdata = Total /@Map[Total, data;data]; topdata = Total[data];Total @ data; dy = (yrange[[2]]Part[yrange, 2] + -Part[yrange, yrange[[1]]1]) / (Length[rightdata] - 1.0); rightdata = Transpose[ Transpose[{rightdata, {rightdata, Table[n, {n, yrange[[1]], yrange[[2]], dy}]} ]; contourplot = ListContourPlot[data, ListContourPlot[data, DataRange -> {xrange, yrange}, ContourShading -> None, Contours -> 30, PlotRange -> {xrange, yrange, All}, ContourStyle -> Table[ Table[ {Thick, Blend[{Blue, Green, Yellow, Red}, n]}, {n, 1 / 30, 1, 1 / 30} 1, 1/30} ], Evaluate[FilterRules[ Evaluate @ FilterRules[{plotopts}, Options[ListContourPlot]]],Options @ ListContourPlot], PlotRangePadding -> 0(*,ImageSize->300*) ]; padding = getMaxPadding[getMaxPadding @ {contourplot}];; dimensions = ImageDimensions[contourplot];ImageDimensions @ contourplot; rightplot = ListLinePlot[rightdata, ListLinePlot[rightdata, PlotStyle -> {{Red, Thickness[Thickness[0.04]}}, Axes -> False, PlotRange -> All, ImageSize -> {Automatic, dimensions[[2]]}Part[dimensions, 2]}, ImagePadding -> {{0, 5}, padding[[2]]Part[padding, 2]}, PlotRangePadding -> 0, AspectRatio -> 5 AspectRatio -> 5];]; topplot = ListLinePlot[topdata, ListLinePlot[topdata, PlotRange -> All, DataRange -> xrange, Axes -> False, PlotStyle -> {{Thickness[Thickness[0.008], Red}}, ImageSize -> {dimensions[[1]]Part[dimensions, 1], Automatic}, AspectRatio -> (1 / 5), PlotRangePadding -> 0, ImagePadding -> {padding[[1]]Part[padding, 1], {0, 10}} ]; Grid[{{topplot, Null}, {contourplot, rightplot}}, Alignment -> Bottom]];Bottom ] ]; 