level 2
热勇www♬
楼主
shadowbox[legend_] := Module[{w, h, dx}, dx = 0.02;
{w, h} = ImageDimensions@Rasterize[legend];
Graphics[{{Gray,
Rectangle[{dx, -dx}, {1 + dx, 1/w*h - dx}]}, {White,
EdgeForm[Gray], Rectangle[{0, 0}, {1, 1/w*h}]},
Inset[legend, {0.5, 1/w*h/2}, Center]}]]
ListLinePlot[
Table[Table[{x, f[x]}, {x, 0, 1, 0.05}], {f, {
# + Sin[2 \[Pi] #
]/3 &,
Sqrt[
#] + Sin[3 \[Pi] #
]/5 &, # &, # + Sin[\[Pi] #]/4 &}}],
InterpolationOrder -> 3, PlotMarkers -> "OpenMarkers",
PlotLegends ->
Placed[LineLegend[Automatic,
Table[StringTemplate["\[Alpha]=``"][\[Alpha]], {\[Alpha], {0.5,
0.7, 0.9, 1.1}}], LegendFunction -> shadowbox,
LegendLayout -> (Grid[Map[Row, Partition[#, 2], {2}]] &),
LegendMarkerSize -> {{40, 15}}], {0.7, 0.2}],
PlotTheme -> "Detailed"]

2022年04月15日 08点04分
1
{w, h} = ImageDimensions@Rasterize[legend];
Graphics[{{Gray,
Rectangle[{dx, -dx}, {1 + dx, 1/w*h - dx}]}, {White,
EdgeForm[Gray], Rectangle[{0, 0}, {1, 1/w*h}]},
Inset[legend, {0.5, 1/w*h/2}, Center]}]]
ListLinePlot[
Table[Table[{x, f[x]}, {x, 0, 1, 0.05}], {f, {
# + Sin[2 \[Pi] #
]/3 &,
Sqrt[
#] + Sin[3 \[Pi] #
]/5 &, # &, # + Sin[\[Pi] #]/4 &}}],
InterpolationOrder -> 3, PlotMarkers -> "OpenMarkers",
PlotLegends ->
Placed[LineLegend[Automatic,
Table[StringTemplate["\[Alpha]=``"][\[Alpha]], {\[Alpha], {0.5,
0.7, 0.9, 1.1}}], LegendFunction -> shadowbox,
LegendLayout -> (Grid[Map[Row, Partition[#, 2], {2}]] &),
LegendMarkerSize -> {{40, 15}}], {0.7, 0.2}],
PlotTheme -> "Detailed"]

