---
title: "DiscretePlot"
language: "en"
type: "Symbol"
summary: "DiscretePlot[f, {n, nmax}] generates a plot of f as a function of n when n = 1, ..., nmax. DiscretePlot[f, {n, nmin, nmax}] generates a plot when n runs from nmin to nmax. DiscretePlot[f, {n, nmin, nmax, dn}] uses steps dn. DiscretePlot[f, {n, {n1, ..., nm}}] uses the successive values n1, ..., nm. DiscretePlot[{f1, f2, ...}, ...] plots the values of all the fi."
keywords: 
- stem plot
- sequence plot
- discrete plot
- Riemann sum plot
- left Riemann sum plot
- right Riemann sum plot
- middle Riemann sum plot
- discrete distribution plot
- sampling plot
- bar plot
- hybrid plot
canonical_url: "https://reference.wolfram.com/language/ref/DiscretePlot.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Function Visualization"
    link: "https://reference.wolfram.com/language/guide/FunctionVisualization.en.md"
  - 
    title: "Discrete Calculus"
    link: "https://reference.wolfram.com/language/guide/DiscreteCalculus.en.md"
  - 
    title: "Data Visualization"
    link: "https://reference.wolfram.com/language/guide/DataVisualization.en.md"
  - 
    title: "Nonparametric Statistical Distributions"
    link: "https://reference.wolfram.com/language/guide/NonparametricStatisticalDistributions.en.md"
  - 
    title: "Statistical Visualization"
    link: "https://reference.wolfram.com/language/guide/StatisticalVisualization.en.md"
related_functions: 
  - 
    title: "ListPlot"
    link: "https://reference.wolfram.com/language/ref/ListPlot.en.md"
  - 
    title: "ListLinePlot"
    link: "https://reference.wolfram.com/language/ref/ListLinePlot.en.md"
  - 
    title: "ListLogPlot"
    link: "https://reference.wolfram.com/language/ref/ListLogPlot.en.md"
  - 
    title: "DateListPlot"
    link: "https://reference.wolfram.com/language/ref/DateListPlot.en.md"
  - 
    title: "ListStepPlot"
    link: "https://reference.wolfram.com/language/ref/ListStepPlot.en.md"
  - 
    title: "Plot"
    link: "https://reference.wolfram.com/language/ref/Plot.en.md"
  - 
    title: "Table"
    link: "https://reference.wolfram.com/language/ref/Table.en.md"
---
# DiscretePlot

DiscretePlot[f, {n, nmax}] generates a plot of f as a function of n when n = 1, …, nmax.

DiscretePlot[f, {n, nmin, nmax}] generates a plot when n runs from nmin to nmax.

DiscretePlot[f, {n, nmin, nmax, dn}] uses steps dn. 

DiscretePlot[f, {n, {n1, …, nm}}] uses the successive values n1, …, nm.

DiscretePlot[{f1, f2, …}, …] plots the values of all the fi.

## Details and Options

* ``DiscretePlot`` is typically used to visualize sequences.

[image]

* ``DiscretePlot`` uses the standard Wolfram Language iterator specification.

* ``DiscretePlot`` treats the variable ``n`` as local, effectively using ``Block``.

* ``DiscretePlot`` has attribute ``HoldAll`` and evaluates ``f`` only after assigning specific numerical values to ``n``.

* In some cases, it may be more efficient to use ``Evaluate`` to evaluate ``f`` symbolically before specific numerical values are assigned to ``n``.

* The precision used in evaluating ``f`` is the minimum precision used in the iterator.

* The form ``w[f]`` provides a wrapper ``w`` to be applied to the resulting graphics primitives.

* The following wrappers can be used:

|                        |                                                            |
| ---------------------- | ---------------------------------------------------------- |
| Annotation[f, label]   | provide an annotation                                      |
| Button[f, action]      | define an action to execute when the element is clicked    |
| Callout[f, label]      | label the element with a callout                           |
| Callout[f, label, pos] | place the callout at relative position pos                 |
| EventHandler[f, …]     | define a general event handler for the element             |
| Hyperlink[f, uri]      | make the element act as a hyperlink                        |
| Labeled[f, label]      | make the data a hyperlink                                  |
| Labeled[f, label, pos] | place the label at relative position pos                   |
| Legended[f, label]     | identify the element in a legend                           |
| PopupWindow[f, cont]   | attach a popup window to the element                       |
| StatusArea[f, label]   | display in the status area when the element is moused over |
| Style[f, opts]         | show the element using the specified styles                |
| Tooltip[f, label]      | attach an arbitrary tooltip to the element                 |

* ``Callout`` and ``Labeled`` can use the following positions ``pos``:

|                             |                                                           |
| --------------------------- | --------------------------------------------------------- |
| Automatic                   | automatically placed labels                               |
| Above, Below, Before, After | positions around the data                                 |
| x                           | near the data at a position x                             |
| {s, Above}, {s, Below}, …   | relative position at position s along the data            |
| {pos, epos}                 | epos in label placed at relative position pos of the data |

* Labels that depend on ``n`` will be applied for each plot element, while labels that are independent of ``n`` will only occur once.

* ``DiscretePlot`` has the same options as ``Graphics``, with the following additions and changes:  []

|                        |                   |                                                          |
| :--------------------- | :---------------- | :------------------------------------------------------- |
| AspectRatio            | 1 / GoldenRatio   | ratio of height to width                                 |
| Axes                   | True              | whether to draw axes                                     |
| ClippingStyle          | None              | what to draw when lines are clipped                      |
| ColorFunction          | Automatic         | how to determine the coloring of lines                   |
| ColorFunctionScaling   | True              | whether to scale arguments to ColorFunction              |
| EvaluationMonitor      | None              | expression to evaluate at every function evaluation      |
| ExtentElementFunction  | Automatic         | how to generate raw graphics for extent fills            |
| ExtentMarkers          | None              | markers to use for extent boundaries                     |
| ExtentSize             | None              | width to extend from plot point                          |
| Filling                | Axis              | filling from extent                                      |
| FillingStyle           | Automatic         | style to use for filling                                 |
| Joined                 | Automatic         | whether to join points                                   |
| LabelingFunction       | Automatic         | how to label points                                      |
| LabelingSize           | Automatic         | maximum size of callouts and labels                      |
| Method                 | Automatic         | what method to use                                       |
| PerformanceGoal        | \$PerformanceGoal | aspects of performance to try to optimize                |
| PlotLabels             | None              | labels for elements                                      |
| PlotLegends            | None              | legends for sequences                                    |
| PlotMarkers            | None              | markers to use for plot points                           |
| PlotRange              | Automatic         | range of values to include                               |
| PlotRangeClipping      | True              | whether to clip at the plot range                        |
| PlotStyle              | Automatic         | graphics directives to determine the style of each line  |
| PlotTheme              | \$PlotTheme       | overall theme for the plot                               |
| RegionFunction         | (True &)          | how to determine whether a point should be included      |
| ScalingFunctions       | None              | how to scale individual coordinates                      |
| WorkingPrecision       | MachinePrecision  | precision for internal computation                       |

* The arguments supplied to ``ColorFunction`` are $x$, $y$.

* With the setting ``ExtentSize -> {sl, sr}``, a horizontal line is drawn around each plot point, extending ``sl`` to the left and ``sr`` to the right. With ``ExtentMarkers -> {ml, mr}``, the markers ``ml`` and ``mr`` will be used as left and right extent boundary markers.

* With the default settings ``Joined -> Automatic`` and ``Filling -> Axis``, ``DiscretePlot`` switches between drawing points with a stem filling when there are few points and lines with a solid filling when there are many points.

* The arguments supplied to ``ExtentElementFunction`` are the element region ``{{xmin, xmax}, {ymin, ymax}}`` and the sample point ``{xi, yi}``.

* With the setting ``ExtentSize -> None``, ``xmin`` is equal to ``xmax``. With the setting ``Filling -> None``, ``ymin`` is equal to ``ymax``.

* ``ColorData["DefaultPlotColors"]`` gives the default sequence of colors used by ``PlotStyle``.

* Possible settings for ``ScalingFunctions`` include:

|          |                    |
| -------- | ------------------ |
| sy       | scale the y axis   |
| {sx, sy} | scale x and y axes |

* Each scaling function ``si`` is either a string ``"scale"`` or ``{g, g^-1}``, where ``g^-1`` is the inverse of ``g``.

### List of all options

|                        |                   |                                                                                    |
| ---------------------- | ----------------- | ---------------------------------------------------------------------------------- |
| AlignmentPoint         | Center            | the default point in the graphic to align with                                     |
| AspectRatio            | 1 / GoldenRatio   | ratio of height to width                                                           |
| Axes                   | True              | whether to draw axes                                                               |
| AxesLabel              | None              | axes labels                                                                        |
| AxesOrigin             | Automatic         | where axes should cross                                                            |
| AxesStyle              | {}                | style specifications for the axes                                                  |
| Background             | None              | background color for the plot                                                      |
| BaselinePosition       | Automatic         | how to align with a surrounding text baseline                                      |
| BaseStyle              | {}                | base style specifications for the graphic                                          |
| ClippingStyle          | None              | what to draw when lines are clipped                                                |
| ColorFunction          | Automatic         | how to determine the coloring of lines                                             |
| ColorFunctionScaling   | True              | whether to scale arguments to ColorFunction                                        |
| ContentSelectable      | Automatic         | whether to allow contents to be selected                                           |
| CoordinatesToolOptions | Automatic         | detailed behavior of the coordinates tool                                          |
| Epilog                 | {}                | primitives rendered after the main plot                                            |
| EvaluationMonitor      | None              | expression to evaluate at every function evaluation                                |
| ExtentElementFunction  | Automatic         | how to generate raw graphics for extent fills                                      |
| ExtentMarkers          | None              | markers to use for extent boundaries                                               |
| ExtentSize             | None              | width to extend from plot point                                                    |
| Filling                | Axis              | filling from extent                                                                |
| FillingStyle           | Automatic         | style to use for filling                                                           |
| FormatType             | TraditionalForm   | the default format type for text                                                   |
| Frame                  | False             | whether to put a frame around the plot                                             |
| FrameLabel             | None              | frame labels                                                                       |
| FrameStyle             | {}                | style specifications for the frame                                                 |
| FrameTicks             | Automatic         | frame ticks                                                                        |
| FrameTicksStyle        | {}                | style specifications for frame ticks                                               |
| GridLines              | None              | grid lines to draw                                                                 |
| GridLinesStyle         | {}                | style specifications for grid lines                                                |
| ImageMargins           | 0.                | the margins to leave around the graphic                                            |
| ImagePadding           | All               | what extra padding to allow for labels etc.                                        |
| ImageSize              | Automatic         | the absolute size at which to render the graphic                                   |
| Joined                 | Automatic         | whether to join points                                                             |
| LabelingFunction       | Automatic         | how to label points                                                                |
| LabelingSize           | Automatic         | maximum size of callouts and labels                                                |
| LabelStyle             | {}                | style specifications for labels                                                    |
| Method                 | Automatic         | what method to use                                                                 |
| PerformanceGoal        | \$PerformanceGoal | aspects of performance to try to optimize                                          |
| PlotLabel              | None              | an overall label for the plot                                                      |
| PlotLabels             | None              | labels for elements                                                                |
| PlotLegends            | None              | legends for sequences                                                              |
| PlotMarkers            | None              | markers to use for plot points                                                     |
| PlotRange              | Automatic         | range of values to include                                                         |
| PlotRangeClipping      | True              | whether to clip at the plot range                                                  |
| PlotRangePadding       | Automatic         | how much to pad the range of values                                                |
| PlotRegion             | Automatic         | the final display region to be filled                                              |
| PlotStyle              | Automatic         | graphics directives to determine the style of each line                            |
| PlotTheme              | \$PlotTheme       | overall theme for the plot                                                         |
| PreserveImageOptions   | Automatic         | whether to preserve image options when displaying new versions of the same graphic |
| Prolog                 | {}                | primitives rendered before the main plot                                           |
| RegionFunction         | (True &)          | how to determine whether a point should be included                                |
| RotateLabel            | True              | whether to rotate y labels on the frame                                            |
| ScalingFunctions       | None              | how to scale individual coordinates                                                |
| Ticks                  | Automatic         | axes ticks                                                                         |
| TicksStyle             | {}                | style specifications for axes ticks                                                |
| WorkingPrecision       | MachinePrecision  | precision for internal computation                                                 |

---

## Examples (111)

### Basic Examples (4)

Plot a sequence:

```wl
In[1]:= DiscretePlot[PrimePi[k], {k, 1, 50}]

Out[1]= [image]

In[2]:= DiscretePlot[MoebiusMu[k], {k, 1, 50}]

Out[2]= [image]
```

---

Plot several sequences:

```wl
In[1]:= Table[PDF[BinomialDistribution[50, p], k], {p, {0.3, 0.5, 0.8}}];

In[2]:= DiscretePlot[Evaluate[%], {k, 1, 50}]

Out[2]= [image]
```

---

Show a Riemann sum approximation to the area under a curve:

```wl
In[1]:= Show[DiscretePlot[Sin[t], {t, 0, 2Pi, Pi / 6}, ExtentSize -> Full], Plot[Sin[t], {t, 0, 2Pi}]]

Out[1]= [image]
```

With bars to the left and right of the sample points:

```wl
In[2]:= Table[DiscretePlot[Sin[t], {t, 0, 2Pi, Pi / 6}, ExtentSize -> a, PlotMarkers -> "Point", AxesOrigin -> {0, 0}], {a, {Left, Right}}]

Out[2]= {[image], [image]}
```

---

Use legends to identify functions:

```wl
In[1]:= data = Table[PDF[BinomialDistribution[50, p], k], {p, {0.3, 0.5, 0.8}}];

In[2]:= DiscretePlot[Evaluate@data, {k, 1, 50}, PlotLegends -> {0.3, 0.5, 0.8}]

Out[2]= [image]
```

### Scope (19)

#### Data and Wrappers (4)

Plot multiple functions:

```wl
In[1]:= DiscretePlot[{Sin[t], Cos[t], Sin[Pi + t]}, {t, 0, 2Pi, Pi / 12}]

Out[1]= [image]
```

---

Use wrappers on functions or sets of functions:

```wl
In[1]:= {DiscretePlot[{Sin[t], Style[Cos[t], Red], Sin[Pi + t]}, {t, 0, 2 * Pi, Pi / 12}], DiscretePlot[Style[{Sin[t], Cos[t], Sin[Pi + t]}, Red], {t, 0, 2 * Pi, Pi / 12}]}

Out[1]= {[image], [image]}
```

Wrappers can be nested:

```wl
In[2]:= DiscretePlot[Style[{Sin[t], Style[Cos[t], Blue], Sin[Pi + t]}, Red], {t, 0, 2 * Pi, Pi / 12}]

Out[2]= [image]
```

---

Override the default tooltips:

```wl
In[1]:= DiscretePlot[{Sin[t], Tooltip[Cos[t], "my data"], Sin[Pi + t]}, {t, 0, 2 * Pi, Pi / 12}]

Out[1]= [image]
```

Use ``PopupWindow`` to provide additional drilldown information:

```wl
In[2]:=
DiscretePlot[Evaluate@Table[PopupWindow[PDF[
      PoissonDistribution[λ], t], SmoothHistogram[Tooltip[RandomVariate[PoissonDistribution[λ], 100], λ], Filling -> Bottom]], {λ, {10, 20, 30}}], 
  {t, 0, 30}, PlotRange -> All]

Out[2]= [image]
```

``Button`` can be used to trigger any action:

```wl
In[3]:=
DiscretePlot[Evaluate@Table[With[{lambda = λ}, Button[PDF[
      PoissonDistribution[lambda], t], 
  Speak[PoissonDistribution[lambda]]]], {λ, {10, 20, 30}}], 
  {t, 0, 30}, PlotRange -> All]

Out[3]= [image]
```

---

Use ``ScalingFunctions`` to scale the axes:

```wl
In[1]:= DiscretePlot[LCM[x], {x, 1, 100, 5}, ExtentSize -> Full, ScalingFunctions -> "Log"]

Out[1]= [image]
```

#### Labeling and Legending (8)

Label functions:

```wl
In[1]:= DiscretePlot[{Labeled[Prime[n], "primes"], Labeled[n Log[n], "estimate"]}, {n, 250}]

Out[1]= [image]
```

---

Label individual points:

```wl
In[1]:= DiscretePlot[Labeled[Prime[t], Prime[t]], {t, 20}]

Out[1]= [image]
```

---

Use callouts:

```wl
In[1]:= DiscretePlot[Callout[Prime[t], Prime[t]], {t, 20}]

Out[1]= [image]
```

---

Apply callouts to extended regions:

```wl
In[1]:= DiscretePlot[Callout[Prime[t], Prime[t]], {t, 20}, ExtentSize -> Full]

Out[1]= [image]
```

---

Use ``Legended`` to provide a legend for a specific dataset:

```wl
In[1]:=
upper = Prime[n];
lower = n Log[n];

In[2]:= DiscretePlot[{lower, Legended[Mean[{lower, upper}], "average"], upper}, {n, 1, 200}]

Out[2]= [image]
```

Use ``Placed`` to change the legend location:

```wl
In[3]:= DiscretePlot[{lower, Legended[Mean[{lower, upper}], Placed["average", Below]], upper}, {n, 1, 200}]

Out[3]= [image]
```

Use ``Callout`` to label datasets:

```wl
In[4]:= DiscretePlot[{Callout[lower, "label", Automatic], Callout[upper, "label", Automatic]}, {n, 1, 100}, ExtentSize -> Full]

Out[4]= [image]
```

---

Use ``Callout`` to label elements:

```wl
In[1]:= DiscretePlot[{Callout[n Log[n], Round[n Log[n], 0.1]], Callout[Prime[n], Prime[n]]}, {n, 1, 10}, ExtentSize -> Full]

Out[1]= [image]
```

Use ``Callout`` to label elements even when they are joined:

```wl
In[2]:= DiscretePlot[{Callout[n Log[n], Round[n Log[n], 0.1]], Callout[Prime[n], Prime[n]]}, {n, 1, 10}, Joined -> True]

Out[2]= [image]
```

---

Specify a location for labels:

```wl
In[1]:= DiscretePlot[Prime[t], {t, 1, 20}, LabelingFunction -> Above]

Out[1]= [image]
```

---

Specify label names with ``LabelingFunction`` :

```wl
In[1]:= DiscretePlot[Prime[t], {t, 1, 20}, LabelingFunction -> (Last@#1 &)]

Out[1]= [image]
```

#### Styling and Appearance (7)

Use an explicit list of styles for the plots:

```wl
In[1]:= DiscretePlot[{Sin[t], Cos[t], Sin[Pi + t]}, {t, 0, 2 * Pi, Pi / 12}, PlotStyle -> {Red, Green, Blue}]

Out[1]= [image]
```

---

``Style`` can be used to override styles:

```wl
In[1]:= DiscretePlot[{Sin[t], Style[Cos[t], Red], Sin[Pi + t]}, {t, 0, 2 * Pi, Pi / 12}, PlotStyle -> Gray]

Out[1]= [image]
```

---

Use any graphic for ``PlotMarkers``:

```wl
In[1]:= DiscretePlot[PDF[BinomialDistribution[10, .5], t], {t, 0, 10}, PlotMarkers -> {{Graphics3D[Sphere[], Boxed -> False], 0.15}}]

Out[1]= [image]
```

---

Use any gradient or indexed color schemes from ``ColorData``:

```wl
In[1]:= DiscretePlot[{Sin[t], Cos[t], Sin[Pi + t]}, {t, 0, 2 * Pi, Pi / 12}, ColorFunction -> Function[{x, y}, ColorData["NeonColors"][y]]]

Out[1]= [image]
```

---

Use ``ExtentSize`` to associate a region with a point:

```wl
In[1]:= Table[DiscretePlot[PDF[BinomialDistribution[10, .5], t], {t, 0, 10}, ExtentSize -> s, PlotMarkers -> Point, PlotLabel -> s], {s, {Left, Full, Right, Scaled[0.5]}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Show extent markers:

```wl
In[1]:= DiscretePlot[PDF[BinomialDistribution[10, .5], t], {t, 0, 10}, ExtentSize -> Full, ExtentMarkers -> {"Filled", "Empty"}, ColorFunction -> "Rainbow"]

Out[1]= [image]
```

---

Use a theme with a frame and grid lines:

```wl
In[1]:= DiscretePlot[PDF[BinomialDistribution[10, .5], t], {t, 0, 10}, PlotTheme -> "Detailed"]

Out[1]= [image]
```

### Options (80)

#### AspectRatio (4)

By default, ``DiscretePlot`` uses a fixed height to width ratio for the plot:

```wl
In[1]:= DiscretePlot[5 Sin[ k^2 / 50], {k, -15, 15}]

Out[1]= [image]
```

---

Make the height the same as the width with ``AspectRatio -> 1`` :

```wl
In[1]:= DiscretePlot[5 Sin[ k^2 / 50], {k, -15, 15}, AspectRatio -> 1]

Out[1]= [image]
```

---

``AspectRatio -> Automatic`` determines the ratio from the plot ranges:

```wl
In[1]:= DiscretePlot[5 Sin[ k^2 / 50], {k, -15, 15}, AspectRatio -> Automatic]

Out[1]= [image]
```

---

``AspectRatio -> Full`` adjusts the height and width to tightly fit inside other constructs:

```wl
In[1]:= plot = DiscretePlot[Sin[ k^2 / 50], {k, -15, 15}, AspectRatio -> Full];

In[2]:= {Framed[Pane[plot, {100, 150}]], Framed[Pane[plot, {150, 150}]], Framed[Pane[plot, {150, 100}]]}

Out[2]= {[image], [image], [image]}
```

#### ColorFunction (6)

Color by scaled $x$ and $y$ coordinates, respectively:

```wl
In[1]:= Table[DiscretePlot[GCD[n, 60], {n, 59}, Evaluate[ColorFunction -> f]], {f, {Function[{x, y}, Hue[0.8x]], Function[{x, y}, Hue[0.8y]]}}]

Out[1]= {[image], [image]}
```

---

Color joined plots:

```wl
In[1]:= Table[DiscretePlot[GCD[n, 60], {n, 59}, Joined -> True, Evaluate[ColorFunction -> f]], {f, {Function[{x, y}, Hue[0.8x]], Function[{x, y}, Hue[0.8y]]}}]

Out[1]= {[image], [image]}
```

---

Color filling element functions:

```wl
In[1]:= Table[DiscretePlot[GCD[n, 24], {n, 23}, ExtentSize -> Full, Evaluate[ColorFunction -> f]], {f, {Function[{x, y}, Hue[0.8x]], Function[{x, y}, Hue[0.8y]]}}]

Out[1]= {[image], [image]}
```

---

Color by height with a named color scheme:

```wl
In[1]:= DiscretePlot[GCD[n, 24], {n, 23}, ExtentSize -> Full, ColorFunction -> "Rainbow"]

Out[1]= [image]
```

---

Identify where $\pi (n)$ jumps:

```wl
In[1]:= DiscretePlot[PrimePi[n], {n, 2, 25}, ExtentSize -> Full, ColorFunction -> Function[{x, y}, If[x == Prime[Round[y]], Red, Blue]], ColorFunctionScaling -> False]

Out[1]= [image]
```

---

``ColorFunction`` has higher priority than ``PlotStyle`` :

```wl
In[1]:= DiscretePlot[GCD[n, 60], {n, 59}, ColorFunction -> "Rainbow", PlotStyle -> Directive[Red, PointSize[Large]]]

Out[1]= [image]
```

#### ColorFunctionScaling (2)

No argument scaling on the left; automatic scaling on the right:

```wl
In[1]:= Table[DiscretePlot[PDF[PoissonDistribution[12], x], {x, 0, 50}, ColorFunction -> Hue, ColorFunctionScaling -> cf], {cf, {True, False}}]

Out[1]= [image]
```

---

Identify where $\pi (n)$ jumps:

```wl
In[1]:= DiscretePlot[PrimePi[n], {n, 2, 25}, ExtentSize -> Full, ColorFunction -> Function[{x, y}, If[x == Prime[Round[y]], Red, Blue]], ColorFunctionScaling -> False]

Out[1]= [image]
```

#### EvaluationMonitor (1)

Gather the plotted heights:

```wl
In[1]:= {plot, points} = Reap[DiscretePlot[Mod[Prime[n], n], {n, 200}, Joined -> False, EvaluationMonitor :> Sow[Mod[Prime[n], n]]]];
```

Show the plot and a histogram of the heights:

```wl
In[2]:= {plot, Histogram[points, {10}]}

Out[2]= {[image], [image]}
```

#### ExtentElementFunction (5)

Get a list of built-in settings for ``ExtentElementFunction`` :

```wl
In[1]:= ChartElementData["DiscretePlot"]

Out[1]= {"Arrow", "ArrowRectangle", "EdgeFadingRectangle", "FadingRectangle", "GlassRectangle", "GradientRectangle", "GradientScaleRectangle", "ObliqueRectangle", "Rectangle", "SegmentScaleRectangle"}
```

---

For detailed settings, use Palettes ▶ Chart Element Schemes :

```wl
In[1]:= Table[DiscretePlot[PDF[PoissonDistribution[12], n], {n, 25}, ExtentSize -> Full, ExtentElementFunction -> f], {f, {"ArrowRectangle", "ObliqueRectangle"}}]

Out[1]= {[image], [image]}

In[2]:= Table[DiscretePlot[PDF[PoissonDistribution[12], n], {n, 25}, ExtentSize -> Full, ExtentElementFunction -> f], {f, {"FadingRectangle", "GlassRectangle"}}]

Out[2]= [image]
```

---

This ``ChartElementFunction`` is appropriate to show the global scale:

```wl
In[1]:= Table[DiscretePlot[PDF[PoissonDistribution[12], n], {n, 25}, ExtentSize -> Full, ExtentElementFunction -> f], {f, {"GradientScaleRectangle", "SegmentScaleRectangle"}}]

Out[1]= [image]
```

---

Write a custom ``ExtentElementFunction`` :

```wl
In[1]:= f[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := {AbsoluteThickness[3], CapForm["Butt"], Line[{{xmin, ymin}, {xmax, ymax}}], AbsoluteDashing[{9}], AbsoluteThickness[2.5], CapForm["Butt"], White, Line[{{xmin, ymin}, {xmax, ymax}}]}

In[2]:= DiscretePlot[PDF[PoissonDistribution[12], n], {n, 25}, ExtentElementFunction -> f]

Out[2]= [image]

In[3]:= g[{{xmin_, xmax_}, {ymin_, ymax_}}, ___] := Rectangle[{xmin, ymin}, {xmax, ymax}, RoundingRadius -> Offset[5]]

In[4]:= DiscretePlot[PDF[PoissonDistribution[12], n], {n, 25}, ExtentSize -> Full, ExtentElementFunction -> g]

Out[4]= [image]
```

---

Built-in element functions may have options; use Palettes ▶ Chart Element Schemes to set them:

```wl
In[1]:= ChartElementData["GradientRectangle", "Options"]

Out[1]= {"ColorScheme" -> {RGBColor[0.674205, 0.423758, 0.242374], RGBColor[0.853407, 0.503288, 0.26041], RGBColor[0.8697087272727273, 0.582690909090909, 0.2751812727272727], RGBColor[0.8852926363636364, 0.6564491818181818, 0.28915563636363634], RGBColor[0 ... 615, 0.762081, 0.645243], RGBColor[0.762341, 0.748974, 0.784665], RGBColor[0.698177, 0.714595, 0.841627], RGBColor[0.7372037272727272, 0.7590425454545454, 0.9071053636363636], RGBColor[0.645624, 0.660807, 0.778286]}, "GradientOrigin" -> Automatic}

In[2]:= Table[DiscretePlot[PDF[PoissonDistribution[12], n], {n, 25}, ExtentSize -> Full, ExtentElementFunction -> ChartElementData["GradientRectangle", "ColorScheme" -> "DeepSeaColors", "GradientOrigin" -> dir]], {dir, {Left, Right, Top, Bottom}}]

Out[2]= [image]
```

#### ExtentMarkers (6)

Do not show the extent endpoints:

```wl
In[1]:= DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> Full, ExtentMarkers -> None]

Out[1]= [image]
```

---

Use points to show the extent endpoints:

```wl
In[1]:= DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> Full, ExtentMarkers -> "Point"]

Out[1]= [image]
```

---

Show $\lfloor n\rfloor$ with appropriate continuity markers:

```wl
In[1]:= DiscretePlot[Floor[n], {n, 0, 10}, ExtentSize -> Right, ExtentMarkers -> {"Filled", "Empty"}]

Out[1]= [image]
```

Show $\lceil n\rceil$ with appropriate continuity markers:

```wl
In[2]:= DiscretePlot[Ceiling[n], {n, 0, 10}, ExtentSize -> Left, ExtentMarkers -> {"Empty", "Filled"}]

Out[2]= [image]
```

---

Control the size of markers:

```wl
In[1]:= Table[DiscretePlot[Floor[n], {n, 10}, ExtentSize -> Right, ExtentMarkers -> {{"Filled", size}, {"Empty", size}}], {size, {Tiny, Small, Medium}}]

Out[1]= {[image], [image], [image]}
```

---

Use custom shapes for the markers:

```wl
In[1]:= DiscretePlot[Ceiling[n], {n, 10}, ExtentSize -> Left, ExtentMarkers -> {{Graphics3D[Sphere[], Boxed -> False], 0.15}, None}]

Out[1]= [image]
```

---

Markers use the settings for ``PlotStyle`` :

```wl
In[1]:= DiscretePlot[Ceiling[n], {n, 10}, ExtentSize -> {Full, None}, ExtentMarkers -> {"Filled", "Empty"}, PlotStyle -> Orange]

Out[1]= [image]
```

#### ExtentSize (6)

Show heights as points:

```wl
In[1]:= DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> None]

Out[1]= [image]
```

---

Draw full regions around the heights:

```wl
In[1]:= DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> Full]

Out[1]= [image]
```

With unevenly spaced points:

```wl
In[2]:= DiscretePlot[GCD[m, 24], {m, {1, 2, 3, 5, 8, 13}}, ExtentSize -> Full]

Out[2]= [image]
```

---

Use fixed-size regions:

```wl
In[1]:= DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> 0.5]

Out[1]= [image]
```

With unevenly spaced points:

```wl
In[2]:= DiscretePlot[GCD[m, 24], {m, {1, 2, 3, 5, 8, 13}}, ExtentSize -> 0.5]

Out[2]= [image]
```

---

Use sizes relative to the distance between points:

```wl
In[1]:= DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> Scaled[0.75]]

Out[1]= [image]
```

With unevenly spaced points:

```wl
In[2]:= DiscretePlot[GCD[m, 24], {m, {1, 2, 3, 5, 8, 13}}, ExtentSize -> Scaled[0.75]]

Out[2]= [image]
```

---

Use equally sized regions that do not overlap:

```wl
In[1]:= DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> All]

Out[1]= [image]
```

With unevenly spaced points:

```wl
In[2]:= DiscretePlot[GCD[m, 24], {m, {1, 2, 3, 5, 8, 13}}, ExtentSize -> All]

Out[2]= [image]
```

---

Control the placement of the region around the points:

```wl
In[1]:= Table[DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> es, PlotLabel -> es, PlotMarkers -> "Point"], {es, {{None, Full}, {Full, None}}}]

Out[1]= {[image], [image]}
```

#### Filling (6)

``DiscretePlot`` automatically fills to the axis:

```wl
In[1]:= Table[DiscretePlot[PrimePi[n], {n, 25}, Evaluate[opt]], {opt, {Joined -> False, Joined -> True, ExtentSize -> Full}}]

Out[1]= {[image], [image], [image]}
```

---

Turn off filling:

```wl
In[1]:= Table[DiscretePlot[PrimePi[n], {n, 25}, Filling -> None, Evaluate[opt]], {opt, {Joined -> False, Joined -> True, ExtentSize -> Full}}]

Out[1]= {[image], [image], [image]}
```

---

Use symbolic or explicit values:

```wl
In[1]:= Table[DiscretePlot[PrimePi[n], {n, 25}, Filling -> f, PlotLabel -> f], {f, {Axis, Top, Bottom, 5}}]

Out[1]= {[image], [image], [image], [image]}
```

With ``Joined -> True`` :

```wl
In[2]:= Table[DiscretePlot[PrimePi[n], {n, 25}, Filling -> f, PlotLabel -> f, Joined -> True], {f, {Axis, Top, Bottom, 5}}]

Out[2]= {[image], [image], [image], [image]}
```

With ``ExtentSize -> Full`` :

```wl
In[3]:= Table[DiscretePlot[PrimePi[n], {n, 25}, Filling -> f, PlotLabel -> f, ExtentSize -> Full], {f, {Axis, Top, Bottom, 5}}]

Out[3]= {[image], [image], [image], [image]}
```

---

Fill between curves 1 and 2:

```wl
In[1]:= Table[DiscretePlot[{PrimePi[n], n / Log[n]}, {n, 2, 25}, Filling -> {1 -> {2}}, Evaluate[opt]], {opt, {Joined -> False, Joined -> True, ExtentSize -> Full}}]

Out[1]= {[image], [image], [image]}
```

---

Fill between curves 1 and 2 with a specific style:

```wl
In[1]:= Table[DiscretePlot[{PrimePi[n], n / Log[n]}, {n, 2, 25}, Filling -> {1 -> {{2}, Gray}}, Evaluate[opt]], {opt, {Joined -> False, Joined -> True, ExtentSize -> Full}}]

Out[1]= {[image], [image], [image]}
```

---

Fill between curves 1 and 2; use red when 1 is below 2 and blue when 1 is above 2:

```wl
In[1]:= Table[DiscretePlot[{PrimePi[n], n / Log[n]}, {n, 2, 25}, Filling -> {1 -> {{2}, {Red, Blue}}}, Evaluate[opt]], {opt, {Joined -> False, Joined -> True, ExtentSize -> Full}}]

Out[1]= {[image], [image], [image]}
```

#### FillingStyle (4)

Use different fill colors:

```wl
In[1]:= Table[DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, FillingStyle -> c], {c, {Red, Green, Blue, Yellow}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Fill with opacity 0.5 orange:

```wl
In[1]:= DiscretePlot[Evaluate[Table[PDF[PoissonDistribution[k], x], {k, {8, 12, 16}}]], {x, 25}, ExtentSize -> Full, FillingStyle -> Directive[Opacity[0.5], Orange]]

Out[1]= [image]
```

---

Fill with red below the $x$ axis and blue above:

```wl
In[1]:= Table[DiscretePlot[Sin[x], {x, 0, 2Pi, Pi / 8}, FillingStyle -> {Red, Blue}, ExtentSize -> e], {e, {None, Full}}]

Out[1]= {[image], [image]}
```

---

Use a variable filling style obtained from a ``ColorFunction`` :

```wl
In[1]:= Table[DiscretePlot[Sin[x], {x, 0, 2Pi, Pi / 8}, ColorFunction -> Function[{x, y}, Hue[y]], FillingStyle -> Automatic, ExtentSize -> e], {e, {None, Full}}]

Out[1]= {[image], [image]}
```

#### Joined (3)

Plots are automatically joined when there are many points:

```wl
In[1]:= {DiscretePlot[PrimePi[n], {n, 50}], DiscretePlot[PrimePi[n], {n, 500}]}

Out[1]= {[image], [image]}
```

---

Join the points:

```wl
In[1]:= DiscretePlot[PrimePi[n], {n, 50}, Joined -> True]

Out[1]= [image]
```

---

Do not join the points:

```wl
In[1]:= DiscretePlot[PrimePi[n], {n, 500}, Joined -> False]

Out[1]= [image]
```

#### LabelingFunction (3)

Put labels above the points:

```wl
In[1]:= DiscretePlot[Prime[t], {t, 1, 10}, LabelingFunction -> Above]

Out[1]= [image]
```

Put them in a tooltip:

```wl
In[2]:= DiscretePlot[Prime[t], {t, 1, 10}, LabelingFunction -> Tooltip]

Out[2]= [image]
```

---

Use callouts to label the points:

```wl
In[1]:= DiscretePlot[Prime[t], {t, 1, 10}, LabelingFunction -> Callout[Automatic, Automatic]]

Out[1]= [image]
```

---

Label the points with their values:

```wl
In[1]:= DiscretePlot[Prime[t], {t, 1, 10}, LabelingFunction -> (#1&)]

Out[1]= [image]
```

#### LabelingSize (1)

Specify a maximum size for textual labels:

```wl
In[1]:= DiscretePlot[Labeled[Prime[n], IntegerName[n]], {n, 1, 20}, ImageSize -> Medium, LabelingSize -> 30]

Out[1]= [image]
```

Use the full label:

```wl
In[2]:= DiscretePlot[Labeled[Prime[n], IntegerName[n]], {n, 1, 20}, ImageSize -> Medium, LabelingSize -> Full]

Out[2]= [image]
```

#### PlotLabels (4)

Specify text to label sets of points:

```wl
In[1]:= DiscretePlot[{Sin[t], Cos[t]}, {t, 0, 2 Pi, 0.1}, PlotLabels -> {"sine", "cosine"}]

Out[1]= [image]
```

---

Place the labels above the points:

```wl
In[1]:= DiscretePlot[{Sin[t], Cos[t]}, {t, 0, 2 Pi, 0.1}, PlotLabels -> Placed[{"sine", "cosine"}, Above]]

Out[1]= [image]
```

---

Use callouts to identify the points:

```wl
In[1]:= DiscretePlot[{Sin[t], Cos[t]}, {t, 0, 2 Pi, 0.1}, PlotLabels -> {Callout["sin", {Scaled[0.25], Above}], Callout["cos", {Scaled[0.5], Below}]}]

Out[1]= [image]
```

---

Use ``None`` to not add a label:

```wl
In[1]:= DiscretePlot[{Sin[t], Cos[t]}, {t, 0, 2 Pi, 0.1}, PlotLabels -> {"sine", None}]

Out[1]= [image]
```

#### PlotLegends (6)

Generate a legend using labels:

```wl
In[1]:= DiscretePlot[{Log[x], Sqrt[x]}, {x, 0, 2, 0.1}, PlotLegends -> {"log", "sqrt"}]

Out[1]= [image]
```

---

Generate a legend using placeholders:

```wl
In[1]:= DiscretePlot[{Sin[x], Cos[x]}, {x, 0, 2π, π / 10}, PlotLegends -> Automatic]

Out[1]= [image]
```

---

Use ``PlotLegends -> "Expressions"`` to use the actual equations:

```wl
In[1]:= DiscretePlot[{Sin[x], Cos[x]}, {x, 0, 2π, π / 10}, PlotLegends -> "Expressions"]

Out[1]= [image]
```

---

``PlotLegends`` matches ``PlotStyle`` and ``PlotMarkers`` in the plot:

```wl
In[1]:= DiscretePlot[{Sin[x], Sin[2 x]}, {x, 0, 2π, 0.25}, PlotStyle -> {Blue, Red}, PlotLegends -> PointLegend["Expressions", LegendMarkers -> Automatic], PlotMarkers -> Automatic]

Out[1]= [image]
```

---

Use ``Placed`` to change legend position:

```wl
In[1]:= Table[DiscretePlot[{Sin[x ^ 2], Sin[x]}, {x, 0, π, 0.1}, PlotLegends -> Placed["Expressions", pos]], {pos, {Above, Below}}]

Out[1]= {[image], [image]}
```

---

Use ``PointLegend`` to change legend appearance:

```wl
In[1]:= DiscretePlot[{Sin[x], Cos[x]}, {x, 0, 10, 0.2}, PlotLegends -> PointLegend["Expressions", LegendFunction -> Panel, LegendLabel -> "label"]]

Out[1]= [image]
```

#### PlotMarkers (8)

``DiscretePlot`` normally uses distinct colors to distinguish different sets of data:

```wl
In[1]:= Table[DiscretePlot[{n, Sqrt[n], n^1 / 3}, {n, 10}, Evaluate[opt]], {opt, {Joined -> False, Joined -> True, ExtentSize -> Full}}]

Out[1]= {[image], [image], [image]}
```

---

Automatically use colors and shapes to distinguish sets of data:

```wl
In[1]:= Table[DiscretePlot[{n, Sqrt[n], n^1 / 3}, {n, 10}, PlotMarkers -> Automatic, Evaluate[opt]], {opt, {Joined -> False, Joined -> True, ExtentSize -> Full}}]

Out[1]= {[image], [image], [image]}
```

---

Markers are placed at the plot points regardless of the setting for ``ExtentSize`` :

```wl
In[1]:= Table[DiscretePlot[{n, Sqrt[n], n^1 / 3}, {n, 10}, PlotMarkers -> Automatic, ExtentSize -> es], {es, {None, Left, Right, Full}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Change the size of the default plot markers:

```wl
In[1]:= Table[DiscretePlot[{n, Sqrt[n], n^1 / 3}, {n, 10}, PlotMarkers -> {Automatic, s}], {s, {Tiny, Small, Medium, Large}}]

Out[1]= {[image], [image], [image], [image]}
```

---

Use arbitrary text for plot markers:

```wl
In[1]:= DiscretePlot[{n, Sqrt[n], n^1 / 3}, {n, 10}, PlotMarkers -> {"1", "2", "3"}]

Out[1]= [image]
```

---

Use explicit graphics for plot markers:

```wl
In[1]:= DiscretePlot[{n, Sqrt[n], n^1 / 3}, {n, 10}, PlotMarkers -> Table[{s, 0.05}, {s, {[image], [image], [image]}}]]

Out[1]= [image]
```

---

Use the same symbol for all the sets of data:

```wl
In[1]:= DiscretePlot[{n, Sqrt[n], n^1 / 3}, {n, 10}, PlotMarkers -> "●"]

Out[1]= [image]
```

---

Explicitly use a symbol and size:

```wl
In[1]:= Table[DiscretePlot[{n, Sqrt[n], n^1 / 3}, {n, 10}, PlotMarkers -> {"●", s}], {s, {4, 8, 12}}]

Out[1]= {[image], [image], [image]}
```

#### PlotStyle (4)

Use different style directives:

```wl
In[1]:= Table[DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, PlotStyle -> ps], {ps, {Orange, Thick, Dotted, Directive[Orange, Thick]}}]

Out[1]= {[image], [image], [image], [image]}

In[2]:= Table[DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, ExtentSize -> Full, PlotStyle -> ps], {ps, {Orange, Thick, Dotted, Directive[Orange, Thick]}}]

Out[2]= {[image], [image], [image], [image]}

In[3]:= Table[DiscretePlot[PDF[PoissonDistribution[12], x], {x, 25}, Joined -> True, PlotStyle -> ps], {ps, {Orange, Thick, Dotted, Directive[Orange, Thick]}}]

Out[3]= {[image], [image], [image], [image]}
```

---

By default, different styles are chosen for multiple curves and regions:

```wl
In[1]:= Table[DiscretePlot[Evaluate[Table[PDF[PoissonDistribution[k], x], {k, {8, 12, 16}}]], {x, 25}, Evaluate[opt]], {opt, {Joined -> False, ExtentSize -> Full, Joined -> True}}]

Out[1]= {[image], [image], [image]}
```

---

Explicitly specify the style for different curves and regions:

```wl
In[1]:= Table[DiscretePlot[Evaluate[Table[PDF[PoissonDistribution[k], x], {k, {8, 12, 16}}]], {x, 25}, Evaluate[opt], PlotStyle -> {Red, Blue, Orange}], {opt, {Joined -> False, ExtentSize -> Full, Joined -> True}}]

Out[1]= {[image], [image], [image]}
```

---

``PlotStyle`` can be combined with ``ColorFunction``:

```wl
In[1]:= Table[DiscretePlot[PDF[PoissonDistribution[16], x], {x, 25}, Evaluate[opt], PlotStyle -> Thick, ColorFunction -> "Rainbow"], {opt, {Joined -> False, ExtentSize -> Full, Joined -> True}}]

Out[1]= {[image], [image], [image]}
```

#### PlotTheme (1)

Use a theme with a frame and grid lines:

```wl
In[1]:= DiscretePlot[{n Log[n], Prime[n]}, {n, 1, 100}, PlotTheme -> "Detailed"]

Out[1]= [image]
```

Change the style for the grid lines:

```wl
In[2]:= DiscretePlot[{n Log[n], Prime[n]}, {n, 1, 100}, PlotTheme -> "Detailed", GridLinesStyle -> LightGray]

Out[2]= [image]
```

#### RegionFunction (1)

Draw over the region where $x\leq y$ :

```wl
In[1]:= Table[DiscretePlot[x + Sin[x], {x, 35}, Evaluate[opt], RegionFunction -> Function[{x, y}, x ≤ y]], {opt, {Joined -> False, ExtentSize -> Full, Joined -> True}}]

Out[1]= {[image], [image], [image]}
```

#### ScalingFunctions (7)

By default, plots have linear scales in each direction:

```wl
In[1]:= DiscretePlot[PrimePi[k], {k, 1, 50}]

Out[1]= [image]
```

---

Use a linear scale in the $y$ direction that shows smaller numbers at the top:

```wl
In[1]:= DiscretePlot[PrimePi[k], {k, 1, 50}, ScalingFunctions -> "Reverse"]

Out[1]= [image]
```

---

Use a log scale in the $x$ direction:

```wl
In[1]:= DiscretePlot[PrimePi[k], {k, 1, 50}, ScalingFunctions -> {"Log", None}]

Out[1]= [image]
```

---

Reverse the $x$ axis without changing the $y$ axis:

```wl
In[1]:= DiscretePlot[PrimePi[k], {k, 1, 50}, ScalingFunctions -> {"Reverse", None}]

Out[1]= [image]
```

---

Use different scales in the $x$ and $y$ directions:

```wl
In[1]:= DiscretePlot[PrimePi[k], {k, 1, 50}, ScalingFunctions -> {"Reverse", "Log"}]

Out[1]= [image]
```

---

Use a scale defined by a function and its inverse:

```wl
In[1]:= DiscretePlot[PrimePi[k], {k, 1, 50}, ScalingFunctions -> {None, {-Log[#]&, Exp[-#]&}}]

Out[1]= [image]
```

---

``PlotRange`` and ``AxesOrigin`` are automatically scaled:

```wl
In[1]:= DiscretePlot[PrimePi[k], {k, 1, 50}, ScalingFunctions -> "Log", PlotRange -> {1, 100}, AxesOrigin -> {Automatic, 10}]

Out[1]= [image]
```

#### WorkingPrecision (2)

Evaluate functions using machine-precision arithmetic:

```wl
In[1]:= DiscretePlot[CoshIntegral[j] - Log[j] + SinhIntegral[j], {j, -50, -1}, AxesOrigin -> {0, 0}]

Out[1]= [image]
```

---

Evaluate functions using arbitrary-precision arithmetic:

```wl
In[1]:= DiscretePlot[CoshIntegral[j] - Log[j] + SinhIntegral[j], {j, -50, -1}, AxesOrigin -> {0, 0}, WorkingPrecision -> 30]

Out[1]= [image]
```

### Applications (4)

Plot the PDF of the empirical distribution of univariate data:

```wl
In[1]:= data = RandomVariate[NormalDistribution[], 15];

In[2]:= dist = EmpiricalDistribution[data]

Out[2]=
DataDistribution["Empirical", {{0.06666666666666667, 0.06666666666666667, 0.06666666666666667, 
   0.06666666666666667, 0.06666666666666667, 0.06666666666666667, 0.06666666666666667, 
   0.06666666666666667, 0.06666666666666667, 0.06666666666666667 ... .08534349855520854, 0.20041281556776286, 0.3480732131903279, 0.36505139669002357, 
   0.3850593317400048, 0.39070864897567825, 0.47552158649162657, 0.5642353753751138, 
   0.7495384649044526, 0.8740018233630863, 0.9343685309186737}, False}, 1, 15]

In[3]:= DiscretePlot[PDF[dist, x], {x, DistributionDomain[dist]}]

Out[3]= [image]
```

The CDF is a piecewise constant function:

```wl
In[4]:= DiscretePlot[CDF[dist, x], {x, DistributionDomain[dist]}, ExtentSize -> Left]

Out[4]= [image]
```

---

Visualize the PDF and CDF for a discrete distribution:

```wl
In[1]:= Show[DiscretePlot[PDF[BenfordDistribution[10], x], {x, 1, 13}, PlotMarkers -> {"Point", Large}], DiscretePlot[CDF[BenfordDistribution[10], x], {x, 1, 13}, ExtentSize -> Right, Filling -> 0], PlotRange -> All]

Out[1]= [image]
```

---

Show Riemann sum approximations to the area under a curve:

```wl
In[1]:= plot = Plot[Sin[x], {x, 0, 2Pi}, PlotStyle -> Thick];

In[2]:= Table[Show[plot, DiscretePlot[Sin[x], {x, 0, 2Pi, Pi / 8}, ExtentSize -> s, PlotLabel -> s]], {s, {Full, Left, Right}}]

Out[2]= {[image], [image], [image]}
```

---

Plot how many primes are below a number:

```wl
In[1]:= DiscretePlot[PrimePi[p], {p, Prime[Range[20]]}, ExtentSize -> Right, PlotMarkers -> Point, AxesOrigin -> {0, 0}]

Out[1]= [image]
```

### Properties & Relations (4)

``Plot`` generates continuous curves:

```wl
In[1]:= {Plot[PrimePi[x], {x, 0, 15}], DiscretePlot[PrimePi[x], {x, 0, 15}]}

Out[1]= {[image], [image]}
```

---

Use ``ListPlot`` to plot lists of values:

```wl
In[1]:= {ListPlot[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}], DiscretePlot[x, {x, 10}]}

Out[1]= {[image], [image]}
```

---

Use ``BarChart`` to show bars for lists of values:

```wl
In[1]:= {BarChart[Range[10]], DiscretePlot[x, {x, 10}, ExtentSize -> Full]}

Out[1]= {[image], [image]}
```

---

Use ``DiscretePlot3D`` to plot functions of two discrete variables:

```wl
In[1]:= DiscretePlot3D[PDF[MultivariatePoissonDistribution[4, {1, 2}], {x, y}], {x, 0, 10}, {y, 0, 10}, ExtentSize -> Scaled[0.5]]

Out[1]= [image]
```

## See Also

* [`ListPlot`](https://reference.wolfram.com/language/ref/ListPlot.en.md)
* [`ListLinePlot`](https://reference.wolfram.com/language/ref/ListLinePlot.en.md)
* [`ListLogPlot`](https://reference.wolfram.com/language/ref/ListLogPlot.en.md)
* [`DateListPlot`](https://reference.wolfram.com/language/ref/DateListPlot.en.md)
* [`ListStepPlot`](https://reference.wolfram.com/language/ref/ListStepPlot.en.md)
* [`Plot`](https://reference.wolfram.com/language/ref/Plot.en.md)
* [`Table`](https://reference.wolfram.com/language/ref/Table.en.md)

## Related Guides

* [Function Visualization](https://reference.wolfram.com/language/guide/FunctionVisualization.en.md)
* [Discrete Calculus](https://reference.wolfram.com/language/guide/DiscreteCalculus.en.md)
* [Data Visualization](https://reference.wolfram.com/language/guide/DataVisualization.en.md)
* [Nonparametric Statistical Distributions](https://reference.wolfram.com/language/guide/NonparametricStatisticalDistributions.en.md)
* [Statistical Visualization](https://reference.wolfram.com/language/guide/StatisticalVisualization.en.md)

## History

* [Introduced in 2008 (7.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn70.en.md) \| [Updated in 2010 (8.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn80.en.md) ▪ [2012 (9.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn90.en.md) ▪ [2014 (10.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn100.en.md) ▪ [2019 (12.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn120.en.md)