Qurak

Combine legended and non-legended plots

範例 共 2 個步驟,在同一個工作階段中依序執行。每一步都在引擎上實際執行過,下方的輸出就是它產生的結果。

步驟 1
styleoptions = Sequence@@{PlotRangePadding -> {{0.01, Scaled[0.01]}, {None, Scaled[0.05]}}, AxesStyle -> Gray, ImageSize -> 200};
gridlines = GridLines -> Table[Function[{xmin, xmax}, With[{x1 = Round[xmin, 0.1], x2 = Round[xmax, 0.1]}, Join[{#, Directive[LightGray, Opacity[0.4]]}& /@ DeleteCases[Range[x1, x2, 0.02], Alternatives@@Range[x1, x2, 0.1]], {#, Directive[Gray, Opacity[0.3]]}& /@ Range[x1, x2, 0.1]]]], {2}];
labelstyle = {14, Gray, FontFamily -> "Helvetica"};
gridoptions = Sequence@@{Frame -> All, FrameStyle -> Directive[LightGray, AbsoluteThickness[2]], Alignment -> {Center, {Bottom, Center}}};

沒有輸出——這個步驟是在為下一步做準備。

步驟 2
pl1 = Plot[Table[Sqrt[Sin[t]] Exp[-x Sin[t] ^ 4], {x, {1, 10, 100, 1000, 10000}}]//Evaluate, {t, 0, Pi / 2}, AxesOrigin -> {0, 0.01}, PlotRange -> {0.01, All}, Evaluate@styleoptions, PlotStyle -> (Directive[AbsoluteThickness[4], #]& /@ ColorData[68, "ColorList"]), PlotLegends -> LineLegend[{1, 10, 100, 1000, 10000}, LegendLabel -> x, LabelStyle -> labelstyle], PlotLabel -> Style[f[x], labelstyle]];
pl2 = Plot[Table[(8 E x) ^ (-1 / 8) Exp[-(2 Sqrt[2] Sqrt[x] - 1) (t - ArcSin[(8 x) ^ (-1 / 4)]) ^ 2], {x, {1, 10, 100, 1000, 10000}}]//Evaluate, {t, 0, Pi / 2}, Evaluate@styleoptions, PlotStyle -> (Directive[Thickness[0.01], Dashing[{0.02, 0.03}], #]& /@ ColorData[68, "ColorList"]), PlotLabel -> Style["approximations", labelstyle]];


Grid[{{Show[pl1, Ticks -> None], Show[pl2, Ticks -> None]}, {Show[pl1, pl2, ImageSize -> 400, gridlines, LabelStyle -> labelstyle, PlotLabel -> None], SpanFromLeft}}, Evaluate@gridoptions]
輸出
Grid[{{-Graphics-, -Graphics-}, {-Graphics-, SpanFromLeft}}, Frame -> All, FrameStyle -> Directive[GrayLevel[0.85], AbsoluteThickness[2]], Alignment -> {Center, {Bottom, Center}}]

使用到的函式

相關的操作範例

所有操作範例 · 函式參考 · 從 MCP 用戶端使用這個