Message Boards Message Boards

GROUPS:

Add distribution plots to residual plot

Posted 2 months ago
421 Views
|
5 Replies
|
4 Total Likes
|

Hi,

How do I add the distributions for the train and test data set like the attached figure in my notebook?

enter image description here

Attachments:
5 Replies
Posted 2 months ago

Some ideas here and here.

Posted 2 months ago

Hi Rohit,

Thanks for your help.

I didn't get an expected output for SmoothDensityHistogram ?

And

I want the points to be displayed like a circle when I use DensityHistogram.

I really appreciate your help.

Alex

Attachments:
Posted 2 months ago

Hi Alex,

Looks like SmoothDensityHistogram does not support Method -> {"DistributionAxes" -> "SmoothHistogram"}. You have to use "Histogram", or generate a SmoothHistogram separately and add it to the plot as shown in the first link I mentioned.

I want the points to be displayed like a circle when I use DensityHistogram.

Add ChartElementFunction -> "Bubble". The bubbles are oval because the range of x and y values is different. You can work around that by providing a binning specification that is in the ratio of the range of x and y which is 10/8. e.g. Using {{2.5}, {2}}

GraphicsRow[Table[DensityHistogram[data, {{2.5}, {2}},
   ColorFunction -> "DarkRainbow",
   Method -> {"DistributionAxes" -> p},
   ImageSize -> 500,
   BaseStyle -> {FontFamily -> "Helvetica"},
   LabelStyle -> Bold,
   ChartElementFunction -> "Bubble"],
  {p, {"SmoothHistogram", "BoxWhisker"}}]]

enter image description here

Posted 2 months ago

A perfect solution. Thank you, Rohit.

I tried to add Y=X to the plots and change the color of distribution plots.Please see the enclosed notebook.Where did I go wrong?

GraphicsRow[
 Table[DensityHistogram[data, {{2.5}, {2}}, 
   ColorFunction -> "DarkRainbow", 
   Method -> {"DistributionAxes" -> p}, 
   Epilog -> {data, Line[{{0, 0}, {80, 80}}]}, ImageSize -> 500, 
   BaseStyle -> {FontFamily -> "Helvetica"}, LabelStyle -> Bold, 
   ChartElementFunction -> "Bubble"], {p, {"SmoothHistogram", 
    "BoxWhisker"}}]]
Posted 2 months ago

Epilog takes a list of Graphics primitives and directives. e.g.

Epilog -> {Blue, Thick, Line[{{0, 0}, {80, 80}}]}
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract