Here's my solution, which constructs the three components and uses Inset to combine them into a single graphic. I've taken some care so that:
- the coordinate systems should line up across the plots (check the gridlines)
- as many graphics and plotting options are respected without breaking the layout
- the graphic can be reasonable resized
customPlot[data_, o___] :=
Block[{xmin, xmax, ymin, ymax, x, y, mainplot, xhist, yhist,
opts = Flatten[{o}]},
{x, y} = Transpose[data];
xhist = HistogramList[x, 50];
yhist = HistogramList[y, 50];
{xmin, xmax} = Through[{Min, Max}[First[xhist]]];
{ymin, ymax} = Through[{Min, Max}[First[yhist]]];
mainplot =
ListPlot[data, Frame -> {{False, True}, {False, True}},
Axes -> False, FrameTicks -> None, AspectRatio -> 1,
PlotRange -> {{xmin, xmax}, {ymin, ymax}},
PlotRangePadding -> Scaled[0.02], ImagePadding -> {{None, 1}, {None, 1}},
FilterRules[opts, Options[ListPlot]],
FrameStyle -> GrayLevel[0.3], GridLines -> Automatic,
GridLinesStyle -> Directive[Gray, Dotted]];
xhist =
Histogram[x, {First[xhist]},
Frame -> {{True, True}, {True, False}},
FrameTicks -> {{None, None}, {Automatic, None}}, Axes -> False,
AspectRatio -> 1/3, ImagePadding -> {{1, 1}, {None, All}},
FilterRules[opts, Options[Histogram]],
GridLines -> {Automatic, None}, FrameStyle -> GrayLevel[0.3],
GridLinesStyle -> Directive[Gray, Dotted]];
yhist =
Histogram[y, {First[yhist]},
Frame -> {{True, False}, {True, True}}, Axes -> False,
FrameTicks -> {{Automatic, None}, {None, None}}, AspectRatio -> 3,
BarOrigin -> Left, ImagePadding -> {{All, None}, {1, 1}},
FilterRules[opts, Options[Histogram]],
GridLines -> {None, Automatic}, FrameStyle -> GrayLevel[0.3],
GridLinesStyle -> Directive[Gray, Dotted]];
Graphics[{{Opacity[0], Point[{{360, 360}, {-120, -120}}]},
Inset[mainplot, {0, 0}, {Left, Bottom}, {360, 360}],
Inset[xhist, {0, 0}, {Left, Top}, {360, Automatic}],
Inset[yhist, {0, 0}, {Right, Bottom}, {Automatic, 360}]},
PlotRange -> {{-120, 360}, {-120, 360}},
FilterRules[opts, Options[Graphics]],
ImagePadding -> {{30, 1}, {30, 1}}]
]
Now to create some data and try it out:
d = RandomVariate[BinormalDistribution[{0, 0}, {1, 2}, 0.4], 100];
customPlot[d]

customPlot[d,
PlotStyle -> Directive[PointSize[Large], Orange],
ChartStyle -> Orange, ChartElementFunction -> "FadingRectangle",
FrameStyle -> White, Background -> Black]

Fillingbefore - it's not the sort of thing we do at my employer. We are quite minimalist on the decoration side. – Verbeia♦ Mar 14 '12 at 21:47