在 mathematica Grid[] 中结合图例
Combining legends in mathematica Grid[]
我试图在数学的网格中绘制 2 个具有相同图例的图形。这是代码示例:
Grid[{{Plot[{x + 1, 2 x + 1}, {x, 0, 10},
PlotStyle -> {{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, {RGBColor[0.880722, 0.611041, 0.142051], colors}},
PlotLegends -> {a, b}, ImageSize -> 400]},
{Plot[{-x + 10, -2 x + 10}, {x, 0, 10},
PlotStyle -> {{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, {RGBColor[0.880722, 0.611041, 0.142051], colors}},
PlotLegends -> {a, b}, ImageSize -> 400]}}]
我只想有一个图例,而不是两个,但由于有一条虚线,我找不到一种干净的方法来处理图例。
还添加了 ImagePadding
以对齐 y 轴。
Legended[
Grid[{{Plot[{x + 1, 2 x + 1}, {x, 0, 10},
PlotStyle -> {{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, {RGBColor[0.880722, 0.611041, 0.142051], colors}},
ImageSize -> 400,
ImagePadding -> {{14, Automatic}, {Automatic, Automatic}}]},
{Plot[{-x + 10, -2 x + 10}, {x, 0, 10},
PlotStyle -> {{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, {RGBColor[0.880722, 0.611041, 0.142051], colors}},
ImageSize -> 400,
ImagePadding -> {{14, Automatic}, {Automatic, Automatic}}]}}],
Placed[LineLegend[{{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, RGBColor[0.880722, 0.611041, 0.142051]}, {a, b}], Below]]
我试图在数学的网格中绘制 2 个具有相同图例的图形。这是代码示例:
Grid[{{Plot[{x + 1, 2 x + 1}, {x, 0, 10},
PlotStyle -> {{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, {RGBColor[0.880722, 0.611041, 0.142051], colors}},
PlotLegends -> {a, b}, ImageSize -> 400]},
{Plot[{-x + 10, -2 x + 10}, {x, 0, 10},
PlotStyle -> {{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, {RGBColor[0.880722, 0.611041, 0.142051], colors}},
PlotLegends -> {a, b}, ImageSize -> 400]}}]
我只想有一个图例,而不是两个,但由于有一条虚线,我找不到一种干净的方法来处理图例。
还添加了 ImagePadding
以对齐 y 轴。
Legended[
Grid[{{Plot[{x + 1, 2 x + 1}, {x, 0, 10},
PlotStyle -> {{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, {RGBColor[0.880722, 0.611041, 0.142051], colors}},
ImageSize -> 400,
ImagePadding -> {{14, Automatic}, {Automatic, Automatic}}]},
{Plot[{-x + 10, -2 x + 10}, {x, 0, 10},
PlotStyle -> {{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, {RGBColor[0.880722, 0.611041, 0.142051], colors}},
ImageSize -> 400,
ImagePadding -> {{14, Automatic}, {Automatic, Automatic}}]}}],
Placed[LineLegend[{{RGBColor[0.880722, 0.611041, 0.142051],
Dashed}, RGBColor[0.880722, 0.611041, 0.142051]}, {a, b}], Below]]