Skip to main content
added 69 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
{xbins, ybins} = {##, -Subtract[##]/nbins} & @@@ Most[binlims];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];

cft = Charting`FindTicks[{0, nbins}, {0, 1}];
MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
  FrameTicks -> {{cft, cft}, {cft, cft}}]

enter image description here

With nbins = 25 we get

enter image description here

SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];

cft = Charting`FindTicks[{0, nbins}, {0, 1}];
MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
  FrameTicks -> {{cft, cft}, {cft, cft}}]

enter image description here

With nbins = 25 we get

enter image description here

SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
{xbins, ybins} = {##, -Subtract[##]/nbins} & @@@ Most[binlims];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];

cft = Charting`FindTicks[{0, nbins}, {0, 1}];
MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
  FrameTicks -> {{cft, cft}, {cft, cft}}]

enter image description here

With nbins = 25 we get

enter image description here

deleted 3 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
{xbins, ybins} = {##, -Subtract[##] / nbins} & @@@ Most[binlims];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];
{xticks, yticks}
cft = MapIndexed[Charting`FindTicks[{#2[[1]]0, #nbins} &, #] & /@ Range @@@ {xbins0, ybins1};
];
MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
  FrameTicks -> {{#cft, #cft} & @ yticks, {#cft, #cft} & @ xticks}]

enter image description hereenter image description here

With nbins = 25 we get

enter image description here

SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
{xbins, ybins} = {##, -Subtract[##] / nbins} & @@@ Most[binlims];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];
{xticks, yticks} = MapIndexed[{#2[[1]], #} &, #] & /@ Range @@@ {xbins, ybins};

MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
 FrameTicks -> {{#, #} & @ yticks, {#, #} & @ xticks}]

enter image description here

SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];

cft = Charting`FindTicks[{0, nbins}, {0, 1}];
MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
  FrameTicks -> {{cft, cft}, {cft, cft}}]

enter image description here

With nbins = 25 we get

enter image description here

added 22 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
{xbins, ybins} = {##, -Subtract[##] /5 nbins} & @@@ Most[binlims];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];
{xticks, yticks} = MapIndexed[{#2[[1]], #} &, #] & /@ Range @@@ {xbins, ybins};

MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
 FrameTicks -> {{#, #} & @ yticks, {#, #} & @ xticks}]

enter image description here

SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
{xbins, ybins} = {##, -Subtract[##]/5} & @@@ Most[binlims];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];
{xticks, yticks} = MapIndexed[{#2[[1]], #} &, #] & /@ Range @@@ {xbins, ybins};

MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
 FrameTicks -> {{#, #} & @ yticks, {#, #} & @ xticks}]

enter image description here

SeedRandom[1]
data = Join[RandomReal[1, {300000, 2}], RandomChoice[{0, 1}, {300000, 1}], 2];
Dimensions[data]

{300000, 3}

nbins = 5;
binlims = Through[{Floor[Min@#, .01] &, Ceiling[Max@#, .01] &}@#] & /@ Transpose[data];
{xbins, ybins} = {##, -Subtract[##] / nbins} & @@@ Most[binlims];
binlists = BinLists[data, xbins, ybins, {0, 2, 2}];
binmeans =  Flatten /@ Map[Mean, binlists[[All, All, All, All, -1]], {-2}];
{xticks, yticks} = MapIndexed[{#2[[1]], #} &, #] & /@ Range @@@ {xbins, ybins};

MatrixPlot[binmeans, DataReversed -> True, ColorFunction -> "Rainbow",
 FrameTicks -> {{#, #} & @ yticks, {#, #} & @ xticks}]

enter image description here

edited body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
deleted 19 characters in body
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading
Source Link
kglr
  • 400.5k
  • 18
  • 488
  • 929
Loading