Re: Problem for using "Epilog" to plot legend
- To: mathgroup at smc.vnet.net
- Subject: [mg87494] Re: Problem for using "Epilog" to plot legend
- From: Albert Retey <awnl at arcor.net>
- Date: Fri, 11 Apr 2008 05:57:14 -0400 (EDT)
- References: <ftmtuu$4ob$1@smc.vnet.net>
davis wrote:
> Dear Group
>
> i want to use "Epilog" to plot a legend,but i have a problem for the "Line" command.
>
> ListPlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}}, Joined -> True,
> PlotMarkers -> Automatic,
> Epilog ->
> Inset[Framed@
> Column[{Graphics[{DotDashed, Line[{{1, 0}, {2, 0}}]}] Style["a"],
> Graphics[{Dotted, Line[{{1, 0}, {2, 0}}]}] Style["b"]},
> Spacings -> 0, ItemSize -> {15, 0.5}], {1.25, 7}]]
>
> the space between different rows in "legend area" are really large,
>
> but if i change the Line condition,such like below
>
> ListPlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}}, Joined -> True,
> PlotMarkers -> Automatic,
> Epilog ->
> Inset[Framed@
> Column[{Graphics[{DotDashed, Line[{{100, 0}, {2, 0}}]}]
> Style["a"],
> Graphics[{Dotted, Line[{{100, 0}, {2, 0}}]}] Style["b"]},
> Spacings -> 0, ItemSize -> {15, 0.5}], {1.25, 7}]]
>
> the rows became close to each other, but the length of the lines became too long
>
> how can i solve this?
>
> thank you
>
I found Grid to be more fitted for these things, because you can take
much more control about all the details like item sizes. Using
Dividers->All also gives you an idea what the sizes and margins really
are. This should be a reasonable starting point for fine tuning:
ListPlot[{{1, 2, 3, 5, 8}, {2, 3, 6, 9, 10}}, Joined -> True,
PlotMarkers -> Automatic,
Epilog -> Inset[Framed@Grid[{{
Graphics[{DotDashed, Line[{{100, 0}, {2, 0}}]}] , Style["a"]
}, {
Graphics[{Dotted, Line[{{100, 0}, {2, 0}}]}] , Style["b"]
}},
ItemSize -> {{5, 2}, 0.5},
Dividers -> None
],
{1.25, 7}]
]
hth,
albert