Message Boards Message Boards

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

Why doesn't Show place legends in order?

Posted 11 years ago
Hi,

I am wondering why when I use Show to combine 6 plots, the plot legend does not show in order? The order should be 150, 250, 350, 450, 550, 650. However when I step through Show adding one plot at a time, I notice that mathematica does something weird with the order of the legend. How can I get the order of the Legend or Show to be correct, such that there is a logical sequence of the label?

Thanks,
 data = {
     {0., 23.1628, 15., 12., 5., 2., .75, 0.0},
     {0., 53.611, 100., 83.27448, 40., 33., 25., 10.0},
     {0., 71.7055, 100., 79, 72.996, 30.76314, 17., 15.},
     {0., 71.92428, 100., 100, 83.35182, 41.09816, 35., 10.0},
     {0., 75.87498, 100., 100., 88.65755, 87.0691, 34.27131, 20.},
     {0., 100., 100., 100., 88.65755, 87.0691, 80.4311, 39.40}
     } // TableForm;
 time = {0., 120., 300., 600., 900., 1200., 1500., 1800.};
activity = Table[Transpose[{time, data[[1, i]]}], {i, 1, 6}];
tickSpecs = {{{0, "0"}, {120, "2"}, {300, "5"}, {600, "10"}, {900,
     "15"}, {1200, "20"}, {1500, "25"}, {1800, "30"}}, Automatic};
label = {"150 ", "250 ", "350 ", "450 ", "550 ", "650 "};
colors = {Black, Red, Orange, Green, Blue, Purple, Magenta};

Plots = Table[ListPlot[activity[[i]],
    PlotRange -> All,
    PlotStyle -> {Darker[colors[[i]]], Dashing[{0.05}], Thick,
      AbsolutePointSize[12]},
    Joined -> True,
    Mesh -> All,
    Ticks -> {Automatic, None},
    FrameTicks -> tickSpecs,
    Frame -> {Left, Bottom},
    FrameStyle -> Thick,
    Axes -> False,
    LabelStyle -> {FontSize -> 20, FormatType -> Bold},
    ImageSize -> 450,
    PlotLegends ->
     LineLegend[{label[[i]]},
      LabelStyle -> Directive[Bold, 15],
      LegendMarkerSize -> Automatic]],
   {i, 1, 6}];
Show[Plots]
POSTED BY: Pat Mac
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