WOLFRAM

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

Examples

open allclose all

Basic Examples  (4)Summary of the most common use cases

Plot a sequence:

Out[1]=1
Out[2]=2

Plot several sequences:

Out[2]=2

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

Out[1]=1

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

Out[2]=2

Use legends to identify functions:

Out[2]=2

Scope  (19)Survey of the scope of standard use cases

Data and Wrappers  (4)

Plot multiple functions:

Out[1]=1

Use wrappers on functions or sets of functions:

Out[1]=1

Wrappers can be nested:

Out[2]=2

Override the default tooltips:

Out[1]=1

Use PopupWindow to provide additional drilldown information:

Out[2]=2

Button can be used to trigger any action:

Out[3]=3

Use ScalingFunctions to scale the axes:

Out[1]=1

Labeling and Legending  (8)

Label functions:

Out[1]=1

Label individual points:

Out[1]=1

Use callouts:

Out[1]=1

Apply callouts to extended regions:

Out[1]=1

Use Legended to provide a legend for a specific dataset:

Out[2]=2

Use Placed to change the legend location:

Out[3]=3

Use Callout to label datasets:

Out[4]=4

Use Callout to label elements:

Out[1]=1

Use Callout to label elements even when they are joined:

Out[2]=2

Specify a location for labels:

Out[1]=1

Specify label names with LabelingFunction:

Out[1]=1

Styling and Appearance  (7)

Use an explicit list of styles for the plots:

Out[1]=1

Style can be used to override styles:

Out[1]=1

Use any graphic for PlotMarkers:

Out[1]=1

Use any gradient or indexed color schemes from ColorData:

Out[1]=1

Use ExtentSize to associate a region with a point:

Out[1]=1

Show extent markers:

Out[1]=1

Use a theme with a frame and grid lines:

Out[1]=1

Options  (80)Common values & functionality for each option

AspectRatio  (4)

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

Out[2]=2

Make the height the same as the width with AspectRatio1:

Out[1]=1

AspectRatioAutomatic determines the ratio from the plot ranges:

Out[1]=1

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

Out[2]=2

ColorFunction  (6)

Color by scaled and coordinates, respectively:

Out[1]=1

Color joined plots:

Out[1]=1

Color filling element functions:

Out[1]=1

Color by height with a named color scheme:

Out[1]=1

Identify where TemplateBox[{n}, PrimePi] jumps:

Out[1]=1

ColorFunction has higher priority than PlotStyle:

Out[1]=1

ColorFunctionScaling  (2)

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

Out[1]=1

Identify where TemplateBox[{n}, PrimePi] jumps:

Out[1]=1

EvaluationMonitor  (1)

Gather the plotted heights:

Show the plot and a histogram of the heights:

Out[2]=2

ExtentElementFunction  (5)

Get a list of built-in settings for ExtentElementFunction:

Out[1]=1

For detailed settings, use Palettes Chart Element Schemes:

Out[1]=1
Out[2]=2

This ChartElementFunction is appropriate to show the global scale:

Out[1]=1

Write a custom ExtentElementFunction:

Out[2]=2
Out[4]=4

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

Out[1]=1
Out[2]=2

ExtentMarkers  (6)

Do not show the extent endpoints:

Out[1]=1

Use points to show the extent endpoints:

Out[1]=1

Show TemplateBox[{n}, Floor] with appropriate continuity markers:

Out[1]=1

Show TemplateBox[{n}, Ceiling] with appropriate continuity markers:

Out[2]=2

Control the size of markers:

Out[1]=1

Use custom shapes for the markers:

Out[1]=1

Markers use the settings for PlotStyle:

Out[1]=1

ExtentSize  (6)

Show heights as points:

Out[1]=1

Draw full regions around the heights:

Out[1]=1

With unevenly spaced points:

Out[2]=2

Use fixed-size regions:

Out[1]=1

With unevenly spaced points:

Out[2]=2

Use sizes relative to the distance between points:

Out[1]=1

With unevenly spaced points:

Out[2]=2

Use equally sized regions that do not overlap:

Out[1]=1

With unevenly spaced points:

Out[2]=2

Control the placement of the region around the points:

Out[1]=1

Filling  (6)

DiscretePlot automatically fills to the axis:

Out[1]=1

Turn off filling:

Out[1]=1

Use symbolic or explicit values:

Out[1]=1

With Joined->True:

Out[2]=2

With ExtentSize->Full:

Out[3]=3

Fill between curves 1 and 2:

Out[1]=1

Fill between curves 1 and 2 with a specific style:

Out[1]=1

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

Out[1]=1

FillingStyle  (4)

Use different fill colors:

Out[1]=1

Fill with opacity 0.5 orange:

Out[1]=1

Fill with red below the axis and blue above:

Out[1]=1

Use a variable filling style obtained from a ColorFunction:

Out[1]=1

Joined  (3)

Plots are automatically joined when there are many points:

Out[1]=1

Join the points:

Out[1]=1

Do not join the points:

Out[1]=1

LabelingFunction  (3)

Put labels above the points:

Out[2]=2

Put them in a tooltip:

Out[1]=1

Use callouts to label the points:

Out[1]=1

Label the points with their values:

Out[1]=1

LabelingSize  (1)

Specify a maximum size for textual labels:

Out[1]=1

Use the full label:

Out[2]=2

PlotLabels  (4)

Specify text to label sets of points:

Out[1]=1

Place the labels above the points:

Out[1]=1

Use callouts to identify the points:

Out[1]=1

Use None to not add a label:

Out[1]=1

PlotLegends  (6)

Generate a legend using labels:

Out[1]=1

Generate a legend using placeholders:

Out[1]=1

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

Out[1]=1

PlotLegends matches PlotStyle and PlotMarkers in the plot:

Out[1]=1

Use Placed to change legend position:

Out[1]=1

Use PointLegend to change legend appearance:

Out[1]=1

PlotMarkers  (8)

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

Out[1]=1

Automatically use colors and shapes to distinguish sets of data:

Out[1]=1

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

Out[1]=1

Change the size of the default plot markers:

Out[1]=1

Use arbitrary text for plot markers:

Out[1]=1

Use explicit graphics for plot markers:

Out[1]=1

Use the same symbol for all the sets of data:

Out[1]=1

Explicitly use a symbol and size:

Out[1]=1

PlotStyle  (4)

Use different style directives:

Out[1]=1
Out[2]=2
Out[3]=3

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

Out[1]=1

Explicitly specify the style for different curves and regions:

Out[1]=1

PlotStyle can be combined with ColorFunction:

Out[1]=1

PlotTheme  (1)

Use a theme with a frame and grid lines:

Out[1]=1

Change the style for the grid lines:

Out[2]=2

RegionFunction  (1)

Draw over the region where :

Out[1]=1

ScalingFunctions  (7)

By default, plots have linear scales in each direction:

Out[1]=1

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

Out[1]=1

Use a log scale in the direction:

Out[1]=1

Reverse the axis without changing the axis:

Out[1]=1

Use different scales in the and directions:

Out[1]=1

Use a scale defined by a function and its inverse:

Out[1]=1

PlotRange and AxesOrigin are automatically scaled:

Out[1]=1

WorkingPrecision  (2)

Evaluate functions using machine-precision arithmetic:

Out[1]=1

Evaluate functions using arbitrary-precision arithmetic:

Out[1]=1

Applications  (4)Sample problems that can be solved with this function

Plot the PDF of the empirical distribution of univariate data:

Out[2]=2
Out[3]=3

The CDF is a piecewise constant function:

Out[4]=4

Visualize the PDF and CDF for a discrete distribution:

Out[1]=1

Show Riemann sum approximations to the area under a curve:

Out[2]=2

Plot how many primes are below a number:

Out[1]=1

Properties & Relations  (4)Properties of the function, and connections to other functions

Plot generates continuous curves:

Out[1]=1

Use ListPlot to plot lists of values:

Out[1]=1

Use BarChart to show bars for lists of values:

Out[1]=1

Use DiscretePlot3D to plot functions of two discrete variables:

Out[1]=1
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).

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 ]}

@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 ]}

@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 ]}