Group Abstract Group Abstract

Message Boards Message Boards

0
|
10.5K Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to hide a line in a plot legend?

Posted 12 years ago

Hello. I have the following code:

FQ = Plot[{QBER}, {x, 0, NN}, PlotStyle -> {Thin, Black}, 
   PlotLegends -> Placed[{"Expected QBER"}, {Right, Right}]];

Figt = ListPlot[{BLt, CUt}, PlotRange -> {-0.01, 0.2}, Joined -> True,
    PlotStyle -> {Directive[Cyan, Thick], Directive[Magenta, Thick]}, 
   PlotMarkers -> {{"\[FilledCircle]", 4}, {"\[FilledCircle]", 4}}, 
   PlotLegends -> 
    Placed[{"Expected \!\(\*SubscriptBox[\(QBER\), \(LB\)]\), Eq. \
(7)", "Expected \!\(\*SubscriptBox[\(QBER\), \(UB\)]\), Eq. (8)"}, \
{Right, Right}]];

FLB = ListPlot[{Transpose[{x[NN], AQ}], Transpose[{x[NN], BL}]}, 
   Filling -> {1 -> {2}}, 
   PlotMarkers -> {{"\[FilledCircle]", 4}, {"-", 12}}, 
   PlotStyle -> {{Blue}, {Red}}, PlotRange -> {-0.01, 0.2}, 
   PlotLegends -> 
    Placed[{"\!\(\*OverscriptBox[\(QBER\), \(^\)]\)", 
      "\!\(\*SubscriptBox[\(QBER\), \(LB\)]\), Eq. (7)"}, {Right, 
      Right}]];

FUB = ListPlot[{Transpose[{x[NN], AQ}], Transpose[{x[NN], CU}]}, 
   Filling -> {2 -> {1}}, 
   PlotMarkers -> {{"\[FilledCircle]", 4}, {"-", 12}}, 
   PlotRange -> {-0.01, 0.2}, PlotStyle -> {{Blue}, {Green}}, 
   PlotLegends -> 
    Placed[{"\!\(\*OverscriptBox[\(QBER\), \(^\)]\)", 
      "\!\(\*SubscriptBox[\(QBER\), \(UB\)]\), Eq. (8)"}, {Right, 
      Right}]];

gg = Plot[{Eq9[QBER, i], Eq10[QBER, i]}, {i, 0, NN}, 
   PlotRange -> {-0.01, 0.2}, PlotStyle -> {Red, Green}, 
   PlotLegends -> 
    Placed[{"\!\(\*SubscriptBox[\(QBER\), \(LB\)]\), Eq. (9)", 
      "\!\(\*SubscriptBox[\(QBER\), \(UB\)]\), Eq. (10)"}, {Right, 
      Right}]];

Show[Figt, FUB, FLB, FQ, gg, 
 AxesLabel -> {"\!\(\*SubscriptBox[\(N\), \(w\)]\)", 
   "\!\(\*OverscriptBox[\(QBER\), \(^\)]\)"}]

which gives me a nice plot with legend. However, as you can see, the "\!(*OverscriptBox[(QBER), (^)])" appears twice, in FLB and FUB. If I put 'None' instead of the second "\!(*OverscriptBox[(QBER), (^)])" for example, the legend will desappear, but the plot mark for "\!(*SubscriptBox[(QBER), (UB)]), Eq. (8)" will appear as dot instead of a dash. Anyone knows how to delete the duplicated legend and keep the next ones okey?

Thank you.

POSTED BY: Alvaro Almeida
4 Replies
Posted 12 years ago

Hello. Thank you so much. I only needed to do a few changes and it worked. In order to help others that might have the same problem, what I have done was the following:

FUB = ListPlot[{Transpose[{x[NN], CU}], Transpose[{x[NN], AQ}]}, Filling -> {2 -> {1}}, PlotMarkers -> {{"-", 12}, {" ", 12}}]];

Basically I have changed the order of x and y.

POSTED BY: Alvaro Almeida

Hi Alvaro,

Try to change FUB to

FUB = ListPlot[{Transpose[{x[NN], AQ}], Transpose[{x[NN], CU}]}, Filling -> {2 -> {1}}, PlotMarkers -> {{"\[FilledCircle]", 4}, {"-", 12}}, PlotStyle -> {Blue, Green}, PlotLegends -> LineLegend[{None, "\!\(\*SubscriptBox[\(QBER\), \(UB\)]\), Eq. (8)"}, Joined -> True]];
POSTED BY: MinHsuan Peng
Posted 12 years ago
POSTED BY: Alvaro Almeida

Hi Alvaro,

If you could put a screenshot of your result or give a working code, it will be clearer to me what you are asking. In the meanwhile, I hope this answer your question.

Plot[{x, x + 1}, {x, 0, 1}, PlotStyle -> {Red, Green}, PlotLegends -> Placed[{None, "b"}, Right]]

showing<em>partlegend

POSTED BY: MinHsuan Peng
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard