Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Here is my simple code:

f0[y_] := PDF[NormalDistribution[-1, 1], y]
f1[y_] := PDF[NormalDistribution[1, 1], y]
ParametricPlot[{{f0[y], f1[y]}, {y, f1[y]}}, {y, 0, 0.5}, 
    PlotStyle -> {Blue, Red}, BaseStyle -> 18, AxesStyle -> Arrowheads[0.03], 
    PlotLegends -> Placed[LineLegend[{
        Style["density composite", FontSize -> 21],
        Style["density only", FontSize-> 21]
        }, 
        LegendFunction -> (Framed[#, RoundingRadius -> 2, FrameStyle -> LightGray] &), 
        BaseStyle -> 18], {Right, Top}]]

enter image description here

I only get the legend "density composite" but not "density only" part. I need them in the same plot. One is for the blue curve and the other for the red one.

Thank you very much

share|improve this question
    
What version are you using? –  Öskå May 18 at 22:30
    
@Öskå version 9 I use. –  Seyhmus Güngören May 18 at 22:31
    
According to the documentation ParametricPlot[{{2 Cos[t], Sin[t]}, {Cos[t], 2 Sin[t]}}, {t, 0, 2 Pi}, PlotLegends -> "Expressions"] works. So it should be working with the example give in the Q&A. –  Öskå May 18 at 22:31
    
@Öskå But I cannot use expressions. I have this: Placed[LineLegend[{Style["Outliers", FontSize -> 21], Style["Modeling errors", FontSize -> 21]}, LegendFunction -> (Framed[#, RoundingRadius -> 2, FrameStyle -> LightGray] &), BaseStyle -> 18], {Right, Top}] –  Seyhmus Güngören May 18 at 22:38
    
I can not help you further since I don't have v9.. –  Öskå May 18 at 22:41

1 Answer 1

up vote 2 down vote accepted
f0[y_] := PDF[NormalDistribution[-1, 1], y];
f1[y_] := PDF[NormalDistribution[1, 1], y];
ParametricPlot[{{f0[y], f1[y]}, {y, f1[y]}}, {y, 0, 0.5}, 
  PlotStyle ->{Blue, Red}, BaseStyle ->18, AspectRatio -> .7, AxesStyle -> Arrowheads[0.03], 
  PlotLegends -> 
   Placed[LineLegend[{Blue, Red}, {"density composite", "density only"}, LabelStyle->21,
        LegendFunction -> (Framed[#, RoundingRadius -> 2, FrameStyle -> LightGray] &)],
   {Right, Top}]]

enter image description here

share|improve this answer
    
thank you very much. I learned something new. –  Seyhmus Güngören May 19 at 9:19
    
@Seyhmus, glad it was useful. Thanks for the accept. –  kguler May 19 at 9:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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