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

Examples

open allclose all

Basic Examples  (4)

Plot a sequence:

Plot several sequences:

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

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

Use legends to identify functions:

Scope  (19)

Data and Wrappers  (4)

Plot multiple functions:

Use wrappers on functions or sets of functions:

Wrappers can be nested:

Override the default tooltips:

Use PopupWindow to provide additional drilldown information:

Button can be used to trigger any action:

Use ScalingFunctions to scale the axes:

Labeling and Legending  (8)

Label functions:

Label individual points:

Use callouts:

Apply callouts to extended regions:

Use Legended to provide a legend for a specific dataset:

Use Placed to change the legend location:

Use Callout to label datasets:

Use Callout to label elements:

Use Callout to label elements even when they are joined:

Specify a location for labels:

Specify label names with LabelingFunction:

Styling and Appearance  (7)

Use an explicit list of styles for the plots:

Style can be used to override styles:

Use any graphic for PlotMarkers:

Use any gradient or indexed color schemes from ColorData:

Use ExtentSize to associate a region with a point:

Show extent markers:

Use a theme with a frame and grid lines:

Options  (80)

AspectRatio  (4)

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

Make the height the same as the width with AspectRatio1:

AspectRatioAutomatic determines the ratio from the plot ranges:

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

ColorFunction  (6)

Color by scaled and coordinates, respectively:

Color joined plots:

Color filling element functions:

Color by height with a named color scheme:

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

ColorFunction has higher priority than PlotStyle:

ColorFunctionScaling  (2)

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

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

EvaluationMonitor  (1)

Gather the plotted heights:

Show the plot and a histogram of the heights:

ExtentElementFunction  (5)

Get a list of built-in settings for ExtentElementFunction:

For detailed settings, use Palettes Chart Element Schemes:

This ChartElementFunction is appropriate to show the global scale:

Write a custom ExtentElementFunction:

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

ExtentMarkers  (6)

Do not show the extent endpoints:

Use points to show the extent endpoints:

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

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

Control the size of markers:

Use custom shapes for the markers:

Markers use the settings for PlotStyle:

ExtentSize  (6)

Show heights as points:

Draw full regions around the heights:

With unevenly spaced points:

Use fixed-size regions:

With unevenly spaced points:

Use sizes relative to the distance between points:

With unevenly spaced points:

Use equally sized regions that do not overlap:

With unevenly spaced points:

Control the placement of the region around the points:

Filling  (6)

DiscretePlot automatically fills to the axis:

Turn off filling:

Use symbolic or explicit values:

With Joined->True:

With ExtentSize->Full:

Fill between curves 1 and 2:

Fill between curves 1 and 2 with a specific style:

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

FillingStyle  (4)

Use different fill colors:

Fill with opacity 0.5 orange:

Fill with red below the axis and blue above:

Use a variable filling style obtained from a ColorFunction:

Joined  (3)

Plots are automatically joined when there are many points:

Join the points:

Do not join the points:

LabelingFunction  (3)

Put labels above the points:

Put them in a tooltip:

Use callouts to label the points:

Label the points with their values:

LabelingSize  (1)

Specify a maximum size for textual labels:

Use the full label:

PlotLabels  (4)

Specify text to label sets of points:

Place the labels above the points:

Use callouts to identify the points:

Use None to not add a label:

PlotLegends  (6)

Generate a legend using labels:

Generate a legend using placeholders:

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

PlotLegends matches PlotStyle and PlotMarkers in the plot:

Use Placed to change legend position:

Use PointLegend to change legend appearance:

PlotMarkers  (8)

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

Automatically use colors and shapes to distinguish sets of data:

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

Change the size of the default plot markers:

Use arbitrary text for plot markers:

Use explicit graphics for plot markers:

Use the same symbol for all the sets of data:

Explicitly use a symbol and size:

PlotStyle  (4)

Use different style directives:

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

Explicitly specify the style for different curves and regions:

PlotStyle can be combined with ColorFunction:

PlotTheme  (1)

Use a theme with a frame and grid lines:

Change the style for the grid lines:

RegionFunction  (1)

Draw over the region where :

ScalingFunctions  (7)

By default, plots have linear scales in each direction:

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

Use a log scale in the direction:

Reverse the axis without changing the axis:

Use different scales in the and directions:

Use a scale defined by a function and its inverse:

PlotRange and AxesOrigin are automatically scaled:

WorkingPrecision  (2)

Evaluate functions using machine-precision arithmetic:

Evaluate functions using arbitrary-precision arithmetic:

Applications  (4)

Plot the PDF of the empirical distribution of univariate data:

The CDF is a piecewise constant function:

Visualize the PDF and CDF for a discrete distribution:

Show Riemann sum approximations to the area under a curve:

Plot how many primes are below a number:

Properties & Relations  (4)

Plot generates continuous curves:

Use ListPlot to plot lists of values:

Use BarChart to show bars for lists of values:

Use DiscretePlot3D to plot functions of two discrete variables:

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).

CMS

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

BibTeX

@misc{reference.wolfram_2024_discreteplot, author="Wolfram Research", title="{DiscretePlot}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/DiscretePlot.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_discreteplot, organization={Wolfram Research}, title={DiscretePlot}, year={2019}, url={https://reference.wolfram.com/language/ref/DiscretePlot.html}, note=[Accessed: 18-November-2024 ]}