1
$\begingroup$

I want to color distinguish my two smooth histograms, I am not able to do so. I am writing the following but it is not working, Can you aid?

data1 = RandomVariate[NormalDistribution[0, 1], {100, 2}];

data2 = RandomVariate[NormalDistribution[1, 1], {100, 2}];

Show[SmoothHistogram3D[data1], SmoothHistogram3D[data2], 
 PlotRange -> All]

Show[ColorFunction -> "DarkRainbow"]
$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Commented Mar 20, 2021 at 18:16

1 Answer 1

2
$\begingroup$
Clear["Global`*"]

SeedRandom[1234];

data1 = RandomVariate[NormalDistribution[0, 1], {100, 2}];

data2 = RandomVariate[NormalDistribution[1, 1], {100, 2}];

Manipulate[
 SmoothHistogram3D[{data1, data2},
  PlotStyle -> Opacity[opacity],
  PlotLegends -> {"data1", "data2"}],
 {{opacity, 1}, 0.5, 1, 0.05, Appearance -> "Labeled"}]

enter image description here

$\endgroup$
2
  • 1
    $\begingroup$ Thanks Bob n ! Can you please elaborate more on the following? I am a new user and very confused Manipulate[ SmoothHistogram3D[{data1, data2}, PlotStyle -> Opacity[opacity], PlotLegends -> {"data1", "data2"}], {{opacity, 1}, 0.5, 1, 0.05, Appearance -> "Labeled"}] $\endgroup$ Commented Mar 19, 2021 at 2:16
  • $\begingroup$ In Mathematica highlight any command or option in the code that you do not understand and press F1 for help. If after reading the documentation you then have a specific question ask on this forum. $\endgroup$
    – Bob Hanlon
    Commented Mar 19, 2021 at 2:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.