Plot
A Swiss Knife for displaying y[x] curves
Plot[expr_, {variable, min, max, step}, opts__]has HoldFirst attribute. See the list of supported options (opts) down below.
Options
PlotStyle
Works as in Mathematica, i.e. per element in expr array, supports color, opacity and etc
Plot[Table[x^y, {y, 6}]//Evaluate, {x, 0,1}, PlotStyle->Table[Blend[{Red, Blue}, i/6], {i, 6}]]AxesLabel
Place labels on your axes
Plot[Sinc[x], {x, 0, 10}, AxesLabel -> {"x", "Sinc[x]"}]Labels accepts only strings or numbers unlike Mathematica, where you can put everything.
Since it is translated into Text, one can use sort of TeX math input
Plot[PDF[NormalDistribution[0, 1], x], {x, -10, 10}, AxesLabel -> {"wavenumber (cm^{-1})", "absorption \\alpha"}, PlotRange->Full]It also supports absolute positioning using offset
Plot[PDF[NormalDistribution[0, 1], x], {x, -10, 10}, AxesLabel -> {"wavenumber (cm^{-1})", {"absorption \\alpha", {112,0}}}, PlotRange->Full]Ticks
Customize ticks by providing an array of numbers for both axes
Plot[x, {x, 0, 1}, Ticks->{{0, 0.5, 1}, {}}]Or by providing as pairs {Number, String} one can specify the displayed text
Plot[x, {x, 0, 1}, Ticks->{{{0, "Zero"}, {0.5, "Half"}, {1,"One"}}, {}}]Frame
Turns plot into the journals-like styled graph. In general it has much more options to customize the look
Plot[x, {x, 0, 1}, Frame->True]FrameTicks
The same as Ticks, but for this regime.
FrameLabel
The same as AxesLabel
Plot[x, {x, 0, 1}, Frame->True, FrameLabel->{
"x-axis",
"y-axis"
}]one can specify an absolute offset for a label by wrapping it into a list
Plot[x, {x, 0, 1}, Frame->True, FrameLabel->{
"x-axis",
{"y-axis", {0,50}}
}]FrameStyle
Affects the style of FrameLabels. Use Directive for changing the style
Plot[x, {x, 0, 1}, Frame->True, FrameLabel->{"x-axis", "y-axis"}, FrameStyle->Directive[FontSize->16]]FrameTicksStyle
Affects the style of FrameTicks
Plot[x, {x, 0, 1}, Frame->True, FrameLabel->{"x-axis", "y-axis"}, FrameTicksStyle->Directive[FontSize->16]]TickLabels
Since Plot options are hardcoded in WL core, we cannot add new options, however using trick with Insert any values can be provided to the resulting Graphics expression
To remove unnecessary ticks, use
Plot[x, {x, 0, 1}, Frame->True];
Insert[%, "TickLabels"->{{True, False}, {True, False}}, {2,-1}]ClippingStyle
Show the clipped regions like the rest of the curve and colored
Plot[Sin[x]/x^2, {x, -10, 10}, ClippingStyle -> Red]Filling
Fill the area under, over of between curves
Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, 10}, Filling -> Axis]Possible options will be
BottomTop{1 -> {2}}from curve 1 to 2
Baseline
Align graphs by the axis in each plot:
{Plot[Im[Zeta[1/2 + I t]], {t, -20, 20}, BaselinePosition -> Axis],
Plot[Re[Zeta[1/2 + I t]], {t, -20, 20}, BaselinePosition -> Axis]} // RowEpilog
Puts any graphics object on top of the data plotted
Plot[Sin[x], {x, 0, 2 Pi}, Epilog -> {PointSize[0.04], Point[{0, 0}], Point[{Pi, 0}], Point[{2 Pi, 0}]}]It opens up many possibilities, since it provides low-level access to the Graphics canvas.
Prolog
The same as Epilog, but acts before plotting the data.
ExclusionsStyle
Use red lines to indicate the vertical asymptotes
Plot[Tan[x], {x, 0, 10}, Exclusions -> {Cos[x] == 0},
ExclusionsStyle -> Red]ImageSize
A common option for any graphics
ImageSize -> Widthor
ImageSize -> {Width, Height}It uses pixels as units
MaxReqursion
Affects the accuracy of the plot when it comes to the sudden changes of a sampled function
Plot[Sin[1/x], {x, 0.001, 0.1}, MaxRecursion->1]The lowest values is 0
Mesh
Shows sampling points
Plot[Sin[1/x], {x, 0.001, 0.1}, Mesh -> All]PeformanceGoal
Affects the number of sampling points to reduce the load
"Speed""Quality"
PlotPoints
Change the initial sampling points
- a number
PlotLegends
Accepts Automatic, "Expressions" or List of expressions to show or explicit legend function, i.e. SwatchLegend, LineLegend or PointLegend
Plot[{Sin[x], Cos[x]}, {x, 0, 5},
PlotLegends -> {"Sin", "Cos"}]Plot[{Sin[x], Cos[x]}, {x, 0, 5},
PlotLegends -> {Sin, Cos}]Plot[{Sin[x], Cos[x]}, {x, 0, 5},
PlotLegends -> SwatchLegend["Expressions"]]Plot[{Sin[x], Cos[x]}, {x, 0, 5},
PlotLegends -> SwatchLegend[Automatic, {Sin, Cos}]]or
legend = PointLegend[{Red, Green, Blue}, {"red", "green", "blue"}];
Plot[{x, (*SpB[*)Power[x(*|*),(*|*)2](*]SpB*), (*SpB[*)Power[x(*|*),(*|*)3](*]SpB*)}, {x,0,3}, PlotStyle->{(*VB[*)(RGBColor[1, 0, 0])(*,*)(*"1:eJxTTMoPSmNiYGAo5gUSYZmp5S6pyflFiSX5RcEsQBHn4PCQNGaQPAeQCHJ3cs7PyS8qYgCDD/ZQBgMDnAEA4iUPRg=="*)(*]VB*), (*VB[*)(RGBColor[0, 1, 0])(*,*)(*"1:eJxTTMoPSmNiYGAo5gUSYZmp5S6pyflFiSX5RcEsQBHn4PCQNGaQPAeQCHJ3cs7PyS8qYoACKOODPVwEANd+D0Y="*)(*]VB*), (*VB[*)(RGBColor[0, 0, 1])(*,*)(*"1:eJxTTMoPSmNiYGAo5gUSYZmp5S6pyflFiSX5RcEsQBHn4PCQNGaQPAeQCHJ3cs7PyS8qYoACdMYHewDM1w9G"*)(*]VB*)}, PlotLegends->legend] Legend placement
Use Placed to adjust the position of your legend, i.e.
Plot[
{x,x^2}, {x,0,1},
PlotLegends->Placed[SwatchLegend[Automatic], {0.2,0.2}]
]PlotRange
Change the lot range to show the whole area
Plot[Sqrt[x], {x, -5, 5}, PlotRange -> Full]Or a custom range
Plot[Sqrt[x], {x, -5, 5}, PlotRange -> {{-5,5}, {0,1}}]RegionFunction
Show the specific area only
Plot[Sin[x], {x, 0, 8 Pi}, RegionFunction -> Function[{x, y}, Abs[y] > 0.5]]Axes
Show or hide axes of the plot
Plot[Sinc[x], {x, 0, 10}, Axes -> False]Interactivity
Consider to use ManipulatePlot for manipulating parameters of a function in real time