DiscretePlot
✖
DiscretePlot
Details and Options




- DiscretePlot is typically used to visualize sequences.
- 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: [List of all options]
-
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
,
.
- 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.
- 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.
-
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

List of all options




Examples
open allclose allBasic Examples (4)Summary of the most common use cases

https://wolfram.com/xid/0tzxz1j2-k3j031


https://wolfram.com/xid/0tzxz1j2-chmh54


https://wolfram.com/xid/0tzxz1j2-gc6m59

https://wolfram.com/xid/0tzxz1j2-oo29l

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

https://wolfram.com/xid/0tzxz1j2-l88b6

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

https://wolfram.com/xid/0tzxz1j2-3d9mex

Use legends to identify functions:

https://wolfram.com/xid/0tzxz1j2-x2k3z8

https://wolfram.com/xid/0tzxz1j2-lue5dw

Scope (19)Survey of the scope of standard use cases
Data and Wrappers (4)

https://wolfram.com/xid/0tzxz1j2-fu5ydu

Use wrappers on functions or sets of functions:

https://wolfram.com/xid/0tzxz1j2-fv6xu4


https://wolfram.com/xid/0tzxz1j2-iazdoz

Override the default tooltips:

https://wolfram.com/xid/0tzxz1j2-dw7akx

Use PopupWindow to provide additional drilldown information:

https://wolfram.com/xid/0tzxz1j2-damue8

Button can be used to trigger any action:

https://wolfram.com/xid/0tzxz1j2-b8fpl2

Use ScalingFunctions to scale the axes:

https://wolfram.com/xid/0tzxz1j2-lcz5ah

Labeling and Legending (8)

https://wolfram.com/xid/0tzxz1j2-l0rdcm


https://wolfram.com/xid/0tzxz1j2-80qv0n


https://wolfram.com/xid/0tzxz1j2-eyx6fl

Apply callouts to extended regions:

https://wolfram.com/xid/0tzxz1j2-nc9c31

Use Legended to provide a legend for a specific dataset:

https://wolfram.com/xid/0tzxz1j2-zll5xl

https://wolfram.com/xid/0tzxz1j2-y61tvi

Use Placed to change the legend location:

https://wolfram.com/xid/0tzxz1j2-cmgg34

Use Callout to label datasets:

https://wolfram.com/xid/0tzxz1j2-xegotn

Use Callout to label elements:

https://wolfram.com/xid/0tzxz1j2-ir7w1z

Use Callout to label elements even when they are joined:

https://wolfram.com/xid/0tzxz1j2-gkst2n

Specify a location for labels:

https://wolfram.com/xid/0tzxz1j2-elltnt

Specify label names with LabelingFunction:

https://wolfram.com/xid/0tzxz1j2-hvlgel

Styling and Appearance (7)
Use an explicit list of styles for the plots:

https://wolfram.com/xid/0tzxz1j2-50o6wo

Style can be used to override styles:

https://wolfram.com/xid/0tzxz1j2-o2q0l

Use any graphic for PlotMarkers:

https://wolfram.com/xid/0tzxz1j2-lx8b8

Use any gradient or indexed color schemes from ColorData:

https://wolfram.com/xid/0tzxz1j2-gp1e

Use ExtentSize to associate a region with a point:

https://wolfram.com/xid/0tzxz1j2-mjo7nq


https://wolfram.com/xid/0tzxz1j2-dwho3y

Use a theme with a frame and grid lines:

https://wolfram.com/xid/0tzxz1j2-53dkv5

Options (80)Common values & functionality for each option
AspectRatio (4)
By default, DiscretePlot uses a fixed height to width ratio for the plot:

https://wolfram.com/xid/0tzxz1j2-ikwh4

Make the height the same as the width with AspectRatio1:

https://wolfram.com/xid/0tzxz1j2-e7dv5a

AspectRatioAutomatic determines the ratio from the plot ranges:

https://wolfram.com/xid/0tzxz1j2-dsvryu

AspectRatioFull adjusts the height and width to tightly fit inside other constructs:

https://wolfram.com/xid/0tzxz1j2-dieuf5

https://wolfram.com/xid/0tzxz1j2-d85h4j

ColorFunction (6)
Color by scaled and
coordinates, respectively:

https://wolfram.com/xid/0tzxz1j2-hq20wq


https://wolfram.com/xid/0tzxz1j2-bymca0

Color filling element functions:

https://wolfram.com/xid/0tzxz1j2-dz2vyz

Color by height with a named color scheme:

https://wolfram.com/xid/0tzxz1j2-jfhjda


https://wolfram.com/xid/0tzxz1j2-f973p5

ColorFunction has higher priority than PlotStyle:

https://wolfram.com/xid/0tzxz1j2-6nax88

ColorFunctionScaling (2)
EvaluationMonitor (1)
ExtentElementFunction (5)
Get a list of built-in settings for ExtentElementFunction:

https://wolfram.com/xid/0tzxz1j2-iuo5q3

For detailed settings, use Palettes ▶ Chart Element Schemes:

https://wolfram.com/xid/0tzxz1j2-enr6pq


https://wolfram.com/xid/0tzxz1j2-xnv5t

This ChartElementFunction is appropriate to show the global scale:

https://wolfram.com/xid/0tzxz1j2-cxoj1e

Write a custom ExtentElementFunction:

https://wolfram.com/xid/0tzxz1j2-f8fo72

https://wolfram.com/xid/0tzxz1j2-iwghyt


https://wolfram.com/xid/0tzxz1j2-dh5in

https://wolfram.com/xid/0tzxz1j2-irvh9i

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

https://wolfram.com/xid/0tzxz1j2-fjaidg


https://wolfram.com/xid/0tzxz1j2-eqia3q

ExtentMarkers (6)
Do not show the extent endpoints:

https://wolfram.com/xid/0tzxz1j2-2s1sh2

Use points to show the extent endpoints:

https://wolfram.com/xid/0tzxz1j2-z68117

Show with appropriate continuity markers:

https://wolfram.com/xid/0tzxz1j2-5mowwx

Show with appropriate continuity markers:

https://wolfram.com/xid/0tzxz1j2-l953fl


https://wolfram.com/xid/0tzxz1j2-6t64gs

Use custom shapes for the markers:

https://wolfram.com/xid/0tzxz1j2-0yldrp

Markers use the settings for PlotStyle:

https://wolfram.com/xid/0tzxz1j2-gk9eza

ExtentSize (6)

https://wolfram.com/xid/0tzxz1j2-60myuf

Draw full regions around the heights:

https://wolfram.com/xid/0tzxz1j2-spvk85


https://wolfram.com/xid/0tzxz1j2-feft18


https://wolfram.com/xid/0tzxz1j2-4mol01


https://wolfram.com/xid/0tzxz1j2-u2zlbf

Use sizes relative to the distance between points:

https://wolfram.com/xid/0tzxz1j2-kaihqz


https://wolfram.com/xid/0tzxz1j2-cbr560

Use equally sized regions that do not overlap:

https://wolfram.com/xid/0tzxz1j2-j339pu


https://wolfram.com/xid/0tzxz1j2-9ku5ev

Control the placement of the region around the points:

https://wolfram.com/xid/0tzxz1j2-7s6y29

Filling (6)
DiscretePlot automatically fills to the axis:

https://wolfram.com/xid/0tzxz1j2-p96nf4


https://wolfram.com/xid/0tzxz1j2-d56vyr

Use symbolic or explicit values:

https://wolfram.com/xid/0tzxz1j2-tomir


https://wolfram.com/xid/0tzxz1j2-5szsa7

With ExtentSize->Full:

https://wolfram.com/xid/0tzxz1j2-czjrwd


https://wolfram.com/xid/0tzxz1j2-eopj75

Fill between curves 1 and 2 with a specific style:

https://wolfram.com/xid/0tzxz1j2-2l4k0b

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

https://wolfram.com/xid/0tzxz1j2-rhhymq

FillingStyle (4)

https://wolfram.com/xid/0tzxz1j2-jxi


https://wolfram.com/xid/0tzxz1j2-enq

Fill with red below the axis and blue above:

https://wolfram.com/xid/0tzxz1j2-yuyy95

Use a variable filling style obtained from a ColorFunction:

https://wolfram.com/xid/0tzxz1j2-x70

Joined (3)
LabelingFunction (3)

https://wolfram.com/xid/0tzxz1j2-k2w4me


https://wolfram.com/xid/0tzxz1j2-3eegn8

Use callouts to label the points:

https://wolfram.com/xid/0tzxz1j2-z650tp

Label the points with their values:

https://wolfram.com/xid/0tzxz1j2-gchuny

LabelingSize (1)
PlotLabels (4)
Specify text to label sets of points:

https://wolfram.com/xid/0tzxz1j2-g5bmk1

Place the labels above the points:

https://wolfram.com/xid/0tzxz1j2-z8x1di

Use callouts to identify the points:

https://wolfram.com/xid/0tzxz1j2-k9gawc

Use None to not add a label:

https://wolfram.com/xid/0tzxz1j2-hoxc0y

PlotLegends (6)
Generate a legend using labels:

https://wolfram.com/xid/0tzxz1j2-3432kf

Generate a legend using placeholders:

https://wolfram.com/xid/0tzxz1j2-njlw8z

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

https://wolfram.com/xid/0tzxz1j2-kl4dzw

PlotLegends matches PlotStyle and PlotMarkers in the plot:

https://wolfram.com/xid/0tzxz1j2-qutyyy

Use Placed to change legend position:

https://wolfram.com/xid/0tzxz1j2-lqpkhh

Use PointLegend to change legend appearance:

https://wolfram.com/xid/0tzxz1j2-fubzx

PlotMarkers (8)
DiscretePlot normally uses distinct colors to distinguish different sets of data:

https://wolfram.com/xid/0tzxz1j2-i62p2n

Automatically use colors and shapes to distinguish sets of data:

https://wolfram.com/xid/0tzxz1j2-vkpu6e

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

https://wolfram.com/xid/0tzxz1j2-za2xdi

Change the size of the default plot markers:

https://wolfram.com/xid/0tzxz1j2-k10ac4

Use arbitrary text for plot markers:

https://wolfram.com/xid/0tzxz1j2-p3t9gr

Use explicit graphics for plot markers:

https://wolfram.com/xid/0tzxz1j2-y8k2jx

Use the same symbol for all the sets of data:

https://wolfram.com/xid/0tzxz1j2-h8ur89

Explicitly use a symbol and size:

https://wolfram.com/xid/0tzxz1j2-wltx3b

PlotStyle (4)
Use different style directives:

https://wolfram.com/xid/0tzxz1j2-zvlxc


https://wolfram.com/xid/0tzxz1j2-yomood


https://wolfram.com/xid/0tzxz1j2-pocux3

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

https://wolfram.com/xid/0tzxz1j2-9cw0ex

Explicitly specify the style for different curves and regions:

https://wolfram.com/xid/0tzxz1j2-cmuk29

PlotStyle can be combined with ColorFunction:

https://wolfram.com/xid/0tzxz1j2-iyq0pp

PlotTheme (1)
RegionFunction (1)
ScalingFunctions (7)
By default, plots have linear scales in each direction:

https://wolfram.com/xid/0tzxz1j2-s1th8c

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

https://wolfram.com/xid/0tzxz1j2-8ukzpu

Use a log scale in the direction:

https://wolfram.com/xid/0tzxz1j2-yuq0eb

Reverse the axis without changing the
axis:

https://wolfram.com/xid/0tzxz1j2-9fbjwx

Use different scales in the and
directions:

https://wolfram.com/xid/0tzxz1j2-kb70jn

Use a scale defined by a function and its inverse:

https://wolfram.com/xid/0tzxz1j2-la5w7q

PlotRange and AxesOrigin are automatically scaled:

https://wolfram.com/xid/0tzxz1j2-gycwmk

Applications (4)Sample problems that can be solved with this function
Plot the PDF of the empirical distribution of univariate data:

https://wolfram.com/xid/0tzxz1j2-wexzi7

https://wolfram.com/xid/0tzxz1j2-srz527


https://wolfram.com/xid/0tzxz1j2-ywev4t

The CDF is a piecewise constant function:

https://wolfram.com/xid/0tzxz1j2-gsyujo

Visualize the PDF and CDF for a discrete distribution:

https://wolfram.com/xid/0tzxz1j2-qjlwic

Show Riemann sum approximations to the area under a curve:

https://wolfram.com/xid/0tzxz1j2-n53ad5

https://wolfram.com/xid/0tzxz1j2-2l7rdl

Plot how many primes are below a number:

https://wolfram.com/xid/0tzxz1j2-jbfx57

Properties & Relations (4)Properties of the function, and connections to other functions
Plot generates continuous curves:

https://wolfram.com/xid/0tzxz1j2-nhtb7l

Use ListPlot to plot lists of values:

https://wolfram.com/xid/0tzxz1j2-bktwii

Use BarChart to show bars for lists of values:

https://wolfram.com/xid/0tzxz1j2-h6yve0

Use DiscretePlot3D to plot functions of two discrete variables:

https://wolfram.com/xid/0tzxz1j2-ex5xhu

Wolfram Research (2008), DiscretePlot, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscretePlot.html (updated 2019).
Text
Wolfram Research (2008), DiscretePlot, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscretePlot.html (updated 2019).
Wolfram Research (2008), DiscretePlot, Wolfram Language function, https://reference.wolfram.com/language/ref/DiscretePlot.html (updated 2019).
CMS
Wolfram Language. 2008. "DiscretePlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/DiscretePlot.html.
Wolfram Language. 2008. "DiscretePlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/DiscretePlot.html.
APA
Wolfram Language. (2008). DiscretePlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiscretePlot.html
Wolfram Language. (2008). DiscretePlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DiscretePlot.html
BibTeX
@misc{reference.wolfram_2025_discreteplot, author="Wolfram Research", title="{DiscretePlot}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/DiscretePlot.html}", note=[Accessed: 19-June-2025
]}
BibLaTeX
@online{reference.wolfram_2025_discreteplot, organization={Wolfram Research}, title={DiscretePlot}, year={2019}, url={https://reference.wolfram.com/language/ref/DiscretePlot.html}, note=[Accessed: 19-June-2025
]}