ListPlot with lots of same couples of values

try this also:

t = {{1, 2}, {3, 4}, {3, 4}, {3, 4}, {4, 5}, {3, 4}, {1, 2}, {6, 7}};

ListPlot[Labeled[Style[#1, PointSize[#2/50], Hue[#2/10]], 
    Style[#2, Bold, 12]] & @@@ (Tally[t])]

enter image description here


I suggest two more approaches in addition to the ones proposed in other answers:

Arrange duplicates on a circle:

Inspired by Rahul's jittering idea, you can also arrange the duplicates in a more regular fashion -- e.g., on a circle around their common center:

ClearAll[coordsF];
coordsF[sc_:.2] := Table[# + If[#2 === 1, 0, sc {Sin[2 Pi k /#2], Cos[2 Pi k /#2]}], 
  {k, #2}] &;

t = {{1, 2}, {3, 4}, {3, 4}, {3, 4}, {4, 5}};
tb = RandomInteger[{1, 7}, {50, 2}];


ListPlot[coordsF[] @@@ Tally[t], 
 BaseStyle -> PointSize[.03], Frame -> True, PlotStyle -> "SolarColors",
 Prolog -> {Opacity[.5], Blue, Thick, Line[t],
   EdgeForm[{Opacity[.5], Blue, Thick}],
   FaceForm[{Opacity[1], LightBlue}], Disk[#, .35] & /@ t},
 AxesOrigin -> {0, 0}, PlotRange -> {{0, 6}, {0, 6}}, AspectRatio -> 1]

enter image description here

ListPlot[coordsF[] @@@ Tally[tb], 
 BaseStyle -> PointSize[.03], Frame -> True, PlotStyle -> "SolarColors", 
 Prolog -> {Blue, Opacity[.5], Line@tb, Yellow, Opacity[.5],  Disk[#, .3] & /@ tb}, 
 AspectRatio -> 1, PlotRangePadding -> .5,  AxesOrigin -> {0, 0}]

enter image description here

BubbleChart:

BubbleChart with its many features and options is a natural tool for this kind of data. You can use Prolog or Epilog to add a line if you need to join the points.

BubbleChart[Append @@@ Tally[t], ChartStyle -> 63,
 ChartLabels -> (Style[#, # 10, Bold] & /@ Tally[t][[All, -1]]),
 Prolog -> {Thick, Blue, Line[t]}, PlotRange -> {{0, 6}, {0, 6}}]

enter image description here

BubbleChart with a custom ChartElementFunction:

The following custom ChartElementFunction produces a PieChart with equal divisions.

ceF[sc_: .03, style_: 24][c : {{xmin_, xmax_}, {ymin_, ymax_}}, y_, ___] :=
  With[{pc = PieChart[ConstantArray[1, {y[[-1]]}], ChartStyle->style], 
   cntr = Mean@Transpose@c}, 
   First[Replace[pc, DiskBox[x_, r_, z_] :> DiskBox[cntr, Scaled[sc], z], {0, Infinity}]]];

BubbleChart[List /@ (Append @@@ Tally[t]),
  Prolog -> {Thick, Blue, Line[t]}, 
  ChartElementFunction -> ceF[.05, 64], 
  PlotRange -> {{0, 6}, {0, 6}}] // Deploy

enter image description here

BubbleChart[List /@ (Append @@@ Tally[tb]),
  Prolog -> {Thick, Opacity[.5], Blue, Line[tb]}, 
  ChartElementFunction -> ceF[.04, "Rainbow"]] // Deploy

enter image description here


Jittering is a popular way to handle overplotting of discrete data.

data = {{1, 2}, {3, 4}, {3, 4}, {3, 4}, {4, 5}};
jitter = 0.5;
ListPlot[data + RandomReal[{-jitter/2, jitter/2}, Dimensions[data]]]

enter image description here

Tags:

Plotting