Dot Plot

Author

Eric W. Weisstein
April 27, 2011

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Statistics/DotPlot.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/DotPlot.html.

©2011 Wolfram Research, Inc. except for portions noted otherwise

Code

DotPlot[data_]:=Module[{m=Tally[Sort[data]]},
ListPlot[Flatten[Table[{#1,n},{n,#2}]&@@@m,1],Ticks->{Automatic,Range[0,Max[m[[All,2]]]]}]
]

Graphics

data=RandomInteger[{1,25},100];

DotPlot[data]

Variants

DotPlotDarren[data_,opts___]:=Block[{newdata=Flatten[Map[Transpose[{ConstantArray[#[[1]],#[[2]]],Range[#[[2]]]}]&,Tally[data]],1]},ListPlot[newdata,opts,PlotStyle->PointSize[.05],Ticks->{Range[Min[data],Max[data]],None},FrameTicks->{{None,None},{Range[Min[data],Max[data]],None}},PlotRange->{{Min[data]-1/2,Max[data]+1/2},{0,Max[newdata[[All,2]]]+1/2}}]]

DotPlotDarren[data]

DotPlotBrett1[data_,max_]:=Histogram[data,max,ChartElements->{Graphics[{Darker@Blue,PointSize[Large],Point[{0,1}]}],{Automatic,1}},GridLines->{None,Automatic}]

DotPlotBrett1[data,25]

DotPlotBrett2[data_,max_]:=Histogram[data,max,ChartElementFunction->(Point[Table[{Mean[First[#1]],y},{y,Last@Last[#1]}]]&),GridLines->{None,Automatic},ChartStyle->Directive[Darker[Blue],PointSize[Large]]]

DotPlotBrett2[data,25]

DotPlotBrett3[data_,max_]:=Histogram[data,max,ChartElementFunction->(Point[Table[{Mean[First[#1]],y},{y,Last@Last[#1]}]]&),ChartStyle->Directive[Darker[Blue],PointSize[Large]]]

DotPlotBrett3[data,25]