ShowLegend[graphics,legend1,legend2,…]
places the legend1, legend2, … in the given graphic graphics.
ShowLegend
ShowLegend[graphics,legend1,legend2,…]
places the legend1, legend2, … in the given graphic graphics.
更多信息和选项
- To use ShowLegend, you first need to load the Plot Legends Package using Needs["PlotLegends`"].
- Each legendi is in the same format as a call to Legend.
- The graphic graphics is placed in a rectangle whose center is at
, and whose boundaries are
. These coordinates must be used to place the legends. - The aspect ratio of graphics is unchanged.
范例
基本范例 (1)
Needs["PlotLegends`"]ShowLegend[DensityPlot[Sin[x y], {x, 0, π}, {y, 0, π}, Mesh -> False, PlotPoints -> 30], {ColorData["LakeColors"][1 - #1]&, 10, " 1", "-1", LegendPosition -> {1.1, -.4}}]ShowLegend[Plot3D[Sin[x y], {x, 0, π}, {y, 0, π}, ColorFunction -> "Rainbow"], {ColorData["Rainbow"][1 - #1]&, 10, " 1", "-1", LegendPosition -> {1.1, -.4}}]Plot with a legend for the filling styles:
ShowLegend[Plot[Sin[x], {x, 0, 10}, Filling -> Axis, FillingStyle -> {Red, Blue}], {{{Graphics[{Blue, Disk[{0, 0}, 1]}], Sin[x] > 0}, {Graphics[{Red, Disk[{0, 0}, 1]}], Sin[x] < 0}}}]技术笔记
相关指南
文本
Wolfram Research (2007),ShowLegend,Wolfram 语言函数,https://reference.wolfram.com/language/PlotLegends/ref/ShowLegend.html.
CMS
Wolfram 语言. 2007. "ShowLegend." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/PlotLegends/ref/ShowLegend.html.
APA
Wolfram 语言. (2007). ShowLegend. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/PlotLegends/ref/ShowLegend.html 年
BibTeX
@misc{reference.wolfram_2026_showlegend, author="Wolfram Research", title="{ShowLegend}", year="2007", howpublished="\url{https://reference.wolfram.com/language/PlotLegends/ref/ShowLegend.html}", note=[Accessed: 09-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_showlegend, organization={Wolfram Research}, title={ShowLegend}, year={2007}, url={https://reference.wolfram.com/language/PlotLegends/ref/ShowLegend.html}, note=[Accessed: 09-August-2026]}