1
$\begingroup$

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

$\endgroup$
8
  • $\begingroup$ What version are you using? $\endgroup$
    – Öskå
    May 18, 2014 at 22:30
  • $\begingroup$ @Öskå version 9 I use. $\endgroup$ May 18, 2014 at 22:31
  • $\begingroup$ 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. $\endgroup$
    – Öskå
    May 18, 2014 at 22:31
  • $\begingroup$ @Ö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}] $\endgroup$ May 18, 2014 at 22:38
  • $\begingroup$ I can not help you further since I don't have v9.. $\endgroup$
    – Öskå
    May 18, 2014 at 22:41

1 Answer 1

2
$\begingroup$
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

$\endgroup$
2
  • $\begingroup$ thank you very much. I learned something new. $\endgroup$ May 19, 2014 at 9:19
  • $\begingroup$ @Seyhmus, glad it was useful. Thanks for the accept. $\endgroup$
    – kglr
    May 19, 2014 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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