PlotHighlighting

PlotHighlighting

is an option to Plot, ListPlot and related visualization functions that specifies how points and curves should be highlighted.

Details

  • PlotHighlighting adds highlighting to plot elements to aid the understanding of plots.
  • Interactive highlighting that depends on the cursor positions is useful for exploring features in a plot, while static highlighting features at specific locations are useful for explaining features to others.
  • Possible highlighting effects for PlotHighlighting include:
  • Automaticautomatically highlight plot elements
    Allhighlight plot elements
    Nonedo not highlight plot elements
    styleuse color, thickness, etc. to style elements
    effectuse a given effect to highlight plot elements
    Placed[effect,pos]statically highlight the plot at a given position
    {effect1,..}use multiple forms of highlighting
  • PlotHighlightingAutomatic highlights plot elements unless there are already elements like tooltips, labels, callouts or other interactive behaviors that would interfere.
  • PlotHighlightingAll highlights plot elements even in the presence of other elements.
  • Possible highlighting effects effect can be:
  • "name"use a named highlighting effect
    {comp1,comp2,}combine components compi into a single effect
    {comp,<|param1val1|>|use component comp with parametrized settings
  • Position specifications pos vary by function. Common forms of positions include:
  • x, {x}effect at {x,y} with y chosen automatically
    {x,y}effect at {x,y}
    {pos1,pos2,}multiple positions posi
  • Common highlighting effects include:
  • stylehighlight the indicated curve
    "Ball"highlight the indicated point in a curve
    "Dropline"highlight the indicated point in a curve with droplines to the axes
    "XSlice"highlight all points along a vertical slice
    "YSlice"highlight all points along a horizontal slice
  • The highlighting specification {comp1,comp2,} uses the individual component effects compi to construct an overall effect.
  • The compi can be a named string "comp" or a named string combined with an association of parameters {"comp",<|"param1"value1,|>}.
  • Point-based effect components comp include:
  • "IndicatedPoint"label the cursor position
    "NearestPoint"draw a ball at the point closest to the cursor
    "XNearestPoint"draw a ball at the point or points closest to the cursor in the x direction
    "YNearestPoint"draw a ball at the point or points closest to the cursor in the y direction
  • The above component effects all take the param "Style".
  • Components comp that draw reference lines include:
  • "Crosshairs"free-form cross hairs following the cursor
    "XYDroplines"droplines from the cursor to the axes or frames
    "XLine"vertical line spanning the graphic
    "YLine"horizontal line spanning the graphic
    "XDropline"vertical droplines from the cursor to the axes or frames
    "YDropline"horizontal droplines from the cursor to the axes or frames
  • The above component effects all take the param "Style".
  • Label-based effect components include:
  • "XYLabel"label the cursor position
    "XLabel"label the x coordinate of the cursor position
    "YLabel"label the y coordinate of the cursor position
    "XYAxisLabels"label the coordinates along the axes or frame
    "XAxisLabel"label the x coordinate along the axis or frame
    "YAxisLabel"label the y coordinate along the axis or frame
  • The label component effects all take the same parameters as Callout:
  • AppearanceAutomaticoverall style of the callout
    BackgroundAutomaticstyle of the label background
    CalloutMarkerNonemarker to use for the anchor position apos
    CalloutStyleAutomaticstyle to use for strokes and knockouts
    FrameAutomaticframe of the label box
    FrameMarginsAutomaticmargins to leave inside the frame
    LabelStyle{}style to use for the label
    LeaderSizeAutomaticlength and angle to use for the leader
    RoundingRadius0radius for rounded corners
  • Applicable highlighting effects vary by function and environment and are documented for each function.

Examples

open allclose all

Basic Examples  (5)

Mouse over a curve to show coordinates and a marker point with the default Automatic highlighting:

Mouse over a curve to have it highlight with the given style:

Mouse over a curve to show the coordinates and droplines to the axes:

Use Placed to add static highlights to the curves at the position :

Use PlotHighlightingNone to disable all highlighting effects:

Scope  (19)

Named Effects  (6)

Use the "Ball" effect to show a point labeled with the coordinates:

Place a fixed highlight at :

Use the "Dropline" effect to show a point labeled with the coordinates and droplines to the axes:

Place a fixed highlight at and :

Use the "XSlice" effect to show a vertical line and labels:

Place a fixed highlight at and :

Use the "YSlice" effect to show a horizontal line and labels:

The default highlighting effects are also disabled when other labels are present:

PlotHighlightingAll will include the default highlighting, but may interfere with other elements:

Highlighted[,None] can be used to remove highlighting from specific elements:

Component Effects  (13)

"IndicatedPoint" shows a point when the mouse position is close to a plot element:

Use a red point for the highlight:

"NearestPoint" always selects a point, regardless of distance:

Use a red point for the highlight:

"XNearestPoint" shows all the points that share the same value as the mouse position:

Use a red point for the highlight:

"YNearestPoint" shows all the points that share the same value as the mouse position:

Use a red point for the highlight:

"Crosshairs" draws vertical and horizontal infinite lines at the mouse position:

Use orange dotted lines:

"XYDropline" draws droplines to the axes:

Use thick red lines:

"XLine" and "YLine" draw vertical and horizontal lines across the plot:

"XDropline" and "YDropline" draw vertical and horizontal lines across the plot:

"XYLabel" labels the plot elements with the coordinates:

"XYAxisLabel" labels the axes with the coordinates of the mouse position:

"XLabel" shows the coordinate corresponding to the mouse position or indicated value:

"YLabel" shows the coordinate corresponding to the mouse position or indicated value:

Label effects take Callout options as styling parameters:

Create a custom effect by combining different components:

Style the different elements in the effect:

Use the effect as a static highlight:

Wolfram Research (2023), PlotHighlighting, Wolfram Language function, https://reference.wolfram.com/language/ref/PlotHighlighting.html.

Text

Wolfram Research (2023), PlotHighlighting, Wolfram Language function, https://reference.wolfram.com/language/ref/PlotHighlighting.html.

CMS

Wolfram Language. 2023. "PlotHighlighting." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PlotHighlighting.html.

APA

Wolfram Language. (2023). PlotHighlighting. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PlotHighlighting.html

BibTeX

@misc{reference.wolfram_2024_plothighlighting, author="Wolfram Research", title="{PlotHighlighting}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/PlotHighlighting.html}", note=[Accessed: 05-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_plothighlighting, organization={Wolfram Research}, title={PlotHighlighting}, year={2023}, url={https://reference.wolfram.com/language/ref/PlotHighlighting.html}, note=[Accessed: 05-December-2024 ]}