2012-03-29 2 views
3

Mathematica의 플롯 기능에 문제가 있습니다. 세미 로그 그림에 여러 데이터 목록을 플롯하려고 시도하고 범례를 추가하려고합니다. 플롯은 괜찮 :Mathematica의 반올림 플롯에 범례 추가하기

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] 

그러나, 어떤 시도는 범례를 추가하거나 실패하거나 같은 규모에 배치하는 - 그리고 그것 semilog 음모 때문에, 내가 볼 모두를위한 라인 전설.

나는 Graphics 객체 별도로 내 전설을 만들려고 :

enter image description here

하지만 난 삽입 된 []와 에필로그 [놀고 있었는데 (이미지에 배치하는 방법을 알아낼 수 없습니다 ],하지만 나는 그들을 잘못 사용하고 있다고 생각한다).

Show[Graphics[ 
    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"}}]]] 

누군가가 첫 번째 그래프에 범례를 올바르게 추가하는 방법을 알고 있다면 도움이 될 것입니다. 아마도

+0

http://stackoverflow.com/a/7788587/353410 –

답변

3

:

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

enter image description here

+0

아, 작동 관련! Show 명령에서 PlotLegend 명령을 외부에 추가하려고했습니다. 도와 주셔서 감사합니다! – scallionpancake