Message Boards Message Boards

0
|
9655 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Legends in graphs using Show

Posted 10 years ago
Hello 

I am making a combination of two graphs; one made by ListPlot and other made by Plot to put them together i am using Show, i know how to put legends in graphs for both (ListPlot and Plot) but when i put them together inside Show [ ] the graph doesn't show up.

I have Mathematica 8 

Is there any solution to put the legends from my two different graphs combined in one using Show?


I hope you could help me.


Regards 
Posted 10 years ago
You can try making your legend separately and using GraphicsGrid to combine all three items.
lp = ListPlot[Thread[{Range[10], Sin[2.1 Range[10]]}],
   PlotStyle -> {Red, PointSize -> Large}];


p = Plot[Sin[2 x], {x, 0, 10}];
twoGraphs = Show[lp, p]
  Needs["PlotLegends`"]
 
 
  Legend[{{Graphics[{ColorData[1][1], Thick,
      Line[{{0, 0}, {1, 0}}]}],
    Sin[2 x]}, {Graphics[{Red, PointSize[Large], Point[{0, 0}]}],
    Sin[2.1 x]}}, LegendSize -> {1, .4}, LegendTextSpace -> .5,
  LegendShadow -> None];
 
pl = Graphics[%];
GraphicsGrid[{{twoGraphs, pl}}]
POSTED BY: Cesar Sul
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