Message Boards Message Boards

0
|
266202 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

[?] Use Plot Labels for Parametric curves?

Posted 8 years ago

Below is a code snippet to plot a handful of curves with some plot labels. For some reason only the first label is used and not the other four. What am I missing here? I've successfully used PlotLabels for parametric curves before but they seem to fail me here. Got any ideas??:

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}]

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

Plot[demcurves,{rr,0,1},PlotLabels -> Placed[demlabels,Left]]
POSTED BY: Anthony DeGance
3 Replies
Posted 8 years ago

When I run corrected code on version 11.1.1.0 on Win 7 x64 it produces the expected output, as seen below. In the future, please put code in code bocks as noted in the group rules.

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}];
demlabels=Map[ToString,Array[qqzz[N[2/lmt]#]&,lmt/2]];
Plot[demcurves,{rr,0,1},PlotLabels->Placed[demlabels,Left]]

enter image description here

POSTED BY: David Keith

Gianluca,

Thank you for your response. Yes, I see that the online code does not work. The online definition of zets is wrong. On the left-hand-side of the definition of zets, rr must be replaced with rr_ and eps must be replaced by eps_. (The online editor omits the _ and I am unaware of what escape character to use to prevent its removal.)

If you correct the definition of zets and run the code you'll see what my problem is. Tony

POSTED BY: Anthony DeGance

Your code does not run, so here I am just guessing. The labels may be superimposed. Try placing them where the curves are far from each other, instead of Left.

POSTED BY: Gianluca Gorni
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