1
$\begingroup$

Okay, this code works fine:

lmt=10; qq[zets_]:=1/Sqrt[1+zets^2]^3; zets[rr_,eps_,eta_]:=eps (1-rr^2) (1+eta (1+rr^2)); demcurves=Array[qq[zets[rr,2 #/lmt,0]]&,lmt/2]; Plot[demcurves,{rr,0,1}]

When I add labels with the code below, only the first curve is identified. How do I add labels for each curve?

demlabels = Map[ToString,Array[QqZz[N[2/lmt]#]&,lmt/2]]; Plot[demcurves,{rr,0,1},PlotLabels -> Placed[demlabels,Left]]

This works

Plot[{Labeled[ demcurves[[1]], demlabels[[1]], Below], Labeled[demcurves[[5]], demlabels[[5]], Below]}, {Rr, 0, 1}, PlotStyle -> {Red, {Blue, Dashed}}]

But this doesn't

labelray[limt_] := Array[Labeled[demcurves[[#]],demlabels[[#]],Above]&,limt]; Plot[labelray[lmt/2],{Rr,0,1}]

$\endgroup$
  • $\begingroup$ Try PlotLegends instead. Plot[demcurves, {rr, 0, 1}, PlotLegends -> Placed[demlabels, Left]] $\endgroup$ – Edmund May 26 '17 at 17:46
1
$\begingroup$
lmt = 10;
qq[zets_] := 1/Sqrt[1 + zets^2]^3;
zets[rr_, eps_, eta_] := eps (1 - rr^2) (1 + eta (1 + rr^2));
demcurves = Array[qq[zets[rr, 2 #/lmt, 0]] &, lmt/2];

demlabels = Map[ToString, Array[QqZz[N[2/lmt] #] &, lmt/2]];

Use Evaluate and rr vice Rr

labelray[limt_] := 
  Array[Labeled[demcurves[[#]], demlabels[[#]], Below] &, limt];
Plot[Evaluate@labelray[lmt/2], {rr, 0, 1}]

enter image description here

| improve this answer | |
$\endgroup$

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.