0
$\begingroup$

I created 4 set of the 15 plots by using "Table" command, then I put this plots together by "Show" command in way that first plot of each set being showed in the same plot, second plots of each set together and so on, I used "Table" again for tis part. Right now I need to add "lineLegend" to finial result. I tried different method but none of them worked. Below you can see part of my code. I can not share the original data here. test is list of list of list. I can add "lineLegend" to the induvial plot in this part of the code (graph = Table[...) but when I am trying to show them together I get error message. What is the sloution? And Thank you for your help. Below you can see one of the final plots, I like to add the "lineLegend" under the lines and it is better to be done by "Scaled" command as plots have different ranges. .

\[ScriptCapitalD] = 
  Table[Table[EmpiricalDistribution[test[[k]][[i]]], {i, 1, 15}], {k, 
    1, Length[test]}];
colaor = {Orange, Black, Blue, RGBColor[0.22, 0.41, 0.23]};
graph = Table[
   Table[{DiscretePlot[
      CDF[\[ScriptCapitalD][[m]][[j]], x], {x, Min[test[[m]][[j]]], 
       Max[test[[m]][[j]]], .01}, FillingStyle -> White, 
      PlotStyle -> {Thickness[0.008], colaor[[m]]}, 
      AxesOrigin -> {0, 0}, Frame -> True
      ]}, {j, 1, Length[\[ScriptCapitalD][[m]]]}], {m, 1, 
    Length[\[ScriptCapitalD]]}];

tickH = {Range[0, 8, 1], Range[0, 8, 1], Range[0, 9, 1], 
   Range[0, 5, 1], Range[0, 12, 1], Range[0, 7, 1], Range[0, 7, 1], 
   Range[0, 10, 1], Range[0, 9, 1], Range[0, 8, 1], Range[0, 10, 1], 
   Range[0, 7, 1], Range[0, 4, 1], Range[0, 3, 1], Range[0, 24, 2]};
tickV = {0, 0.2, 0.4, 0.6, 0.8, 1};
headings = {"Type 1", "Type 2", "Type 3", "Type 4", "Type 5", 
   "Type 6", "Type 7", "Type 8", "Type 9", "Type 10", "Type 11", 
   "Type 12", "Type 13", "Type 14", "Type 15"};
SN = {100, 1000, 5000, 10000};

Table[Show[graph[[1]][[i]], graph[[2]][[i]], graph[[3]][[i]], 
  graph[[4]][[i]],
  AspectRatio -> 1
  , FrameTicks -> {{tickV, None}, {tickH[[i]], None}}, 
  BaseStyle -> {FontSize -> 30}, 
  FrameTicksStyle -> Directive[30, Thickness[0.01]],
  
  FrameLabel -> {{"ECDF", None}, {"Number of Cells", headings[[i]]}},
  ImageSize -> 600, PlotRange -> All
  ], {i, 1, 15}]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Please use Quit[] to quit kernel. Then copy and paste your code from this web page into a new Mathematica notebook and evaluate it (on a fresh kernel without evaluating any other notebook). Have you explored GraphicsGrid ? $\endgroup$
    – Syed
    Mar 10 at 17:50

1 Answer 1

1
$\begingroup$

Since you did not provide a minimal working example, I will provide my own.

Clear["Global`*"]

colaor = {Orange, Black, Blue, RGBColor[0.22, 0.41, 0.23]};
SN = {100, 1000, 5000, 10000};

Legended[
 Show[
  Plot[Tooltip[#[[1]]], {x, 0, 1.5},
     PlotStyle -> #[[2]]] & /@
   Transpose[{x^Range[4], colaor}]],
 Placed[LineLegend[colaor, SN], {0.2, 0.75}]]

enter image description here

$\endgroup$
1
  • $\begingroup$ "Since you did not provide a minimal working example, I will provide my own." sassing like a boss!!! $\endgroup$
    – kcr
    Mar 10 at 19:12

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.