Wolfram Language

Visualization: Labels, Scales, Exclusions

Place Labels Relative to Data

Callout and Labeled can be placed at named locations relative to the data.

show complete Wolfram Language input
In[1]:=
Click for copyable input
options = Sequence @@ {Filling -> Axis, ImageSize -> 400}; data1 = Table[{k, PDF[BinomialDistribution[50, 0.2], k]}, {k, 0, 50}]; data2 = Table[{k, PDF[BinomialDistribution[50, 0.5], k]}, {k, 0, 50}]; data3 = Table[{k, PDF[BinomialDistribution[50, 0.7], k]}, {k, 0, 50}];
In[2]:=
Click for copyable input
ListPlot[{Callout[data1, "0.2", Above], Callout[data2, "0.5", Above], Callout[data3, "0.7", Above]}, options]
Out[2]=
In[3]:=
Click for copyable input
Grid[Partition[{ Plot[{Labeled[Sinc[x - 1], Sinc[x - 1], Above], Cos[x/1.1 + 0.3]/2}, {x, 0, 8}, ImageSize -> 250, PlotTheme -> "Business", PlotLabel -> "Above"], Plot[{Labeled[Sinc[x - 1], Sinc[x - 1], Below], Cos[x/1.1 + 0.3]/2}, {x, 0, 8}, ImageSize -> 250, PlotTheme -> "Business", PlotLabel -> "Below"]}, 2]]
Out[3]=

A position can be used as a LabelingFunction to automatically place labels.

In[4]:=
Click for copyable input
data = Accumulate@Table[RandomInteger[5], 10]; ListLinePlot[data -> data, LabelingFunction -> Top, PlotMarkers -> Automatic, Filling -> Axis, PlotTheme -> "Business"]
Out[4]=

Related Examples

de es fr ja ko pt-br ru zh