Adding a legend to a semi-log plot in Mathematica

I am having problems with build functions in Mathematica. I am trying to build several lists of data on a semi-log plot and then add a legend. The plot is beautiful:

enter image description here

Show[ListLogPlot[bead31, PlotStyle -> Black, 
  PlotMarkers -> {"\[FilledSmallSquare]"}], 
 ListLogPlot[bead27, PlotStyle -> Blue, 
  PlotMarkers -> {"\[FilledSmallSquare]"}], 
 ListLogPlot[A5, PlotStyle -> Red, 
  PlotMarkers -> {"\[FilledSmallSquare]"}], 
 ListLogPlot[A10, PlotStyle -> Green, 
  PlotMarkers -> {"\[FilledSmallSquare]"}], 
 ListLogPlot[A20, PlotStyle -> Gray, 
  PlotMarkers -> {"\[FilledSmallSquare]"}], Frame -> True, 
 FrameLabel -> {Subscript[t, norm], \[Kappa]}, RotateLabel -> False, 
 PlotRange -> Automatic]


However, any attempts to add a legend either fail or fit into the same scale - and since its a semi-log plot, all I can see is a line for the legend.

I tried to create my legend separately as a Graphics object:

enter image description here

but I can't figure out how to put it in the image (I've played around with Inset [] and Epilog [], but I think I'm using them incorrectly).

  Legend[{{Graphics[{Black, Rectangle[{-1, -1}, {1, 1}]}], 
     "31 beads"}, {Graphics[{Blue, Rectangle[{-1, -1}, {1, 1}]}], 
     "27 beads"},
    {Graphics[{Red, Rectangle[{-1, -1}, {1, 1}]}], "A5"},
    {Graphics[{Green, Rectangle[{-1, -1}, {1, 1}]}], "A10"},
    {Graphics[{Gray, Rectangle[{-1, -1}, {1, 1}]}], "A20"}}]]]


If anyone knows how to add the legend to the first graph correctly, any help would be much appreciated.


source to share

1 answer


  Table[PartitionsQ[n], {n, 50}], 
  Table[{n, n!}, {n, 1, 20, .1}]}, 
    PlotLegend -> {"Parts", "Fact"}, LegendPosition -> {0.8, -0.8}]


enter image description here



All Articles