Visualization Updates

Brett Champion
Wolfram Research

#WolframTechConf

Overview

V14.2/V14.3

Dark Mode

Fit Plots

Tabular Visualization

Labeling

PlotInteractivity

New Functions

⚠️ Future ⚠️

PlotGrid

PlotStyle

Dark Mode

For a detailed explanation of dark mode, please see Noah Hardwicke's talk ↗️

LightDarkSwitched can be used as styles throughout the system:

Plot[{Sin[x Log[x]],Cos[x Log[x]]},{x,0,6},PlotStyle->{LightDarkSwitched[Blue,Cyan],LightDarkSwitched[Orange,Red]}]

LightDarkSwitched is not ColorQ, and can’t be used within functions like Blend:

ColorQ[LightDarkSwitched[Blue,Cyan]]

Blend[{LightDarkSwitched[Blue,Cyan],LightDarkSwitched[Orange,Red]}]

You can usually pull the LightDarkSwitched out further to have it apply:

DensityPlot[Sin[x]Cos[y],{x,0,10},{y,0,10},ColorFunction->Function[{f}, LightDarkSwitched[Blend[{Blue,Cyan},f],Blend[{Red,Yellow},f]]]]

Tabular Visualization

Visualization functions use a Rule (->) syntax to extract columns from Tabular data:

ResourceData["Sample Tabular Data: Diamonds"]

SmoothHistogram[ResourceData["Sample Tabular Data: Diamonds"]->"carat"]

Specify the x and y coordinates in ListPlot:

ListPlot[ResourceData["Sample Tabular Data: Diamonds"]->{"carat","price"}]

Geo visualization functions work with appropriately typed columns:

Tabular[trees,ImageSize->{All,100}]

GeoListPlot[trees->"position"]

GeoHistogram[trees->"position"]

⚠️ Time & Event Series ⚠️

Time and event series can be plotted per component using similar syntaxes:

browsers=TimeSeries[];

ListLinePlot[browsers->{"Firefox","Chrome"}]

Plotting Fitted Models

For more detailed information, please see Nirmal Malapaka's talk ↗️

ListFitPlot is a new function that combines plotting points and a fit of those points:

cars=Tabular[ResourceData["Sample Tabular Data: Car Models"],ImageSize->{All, 100}]

ListFitPlot[cars->{"displacement","horsepower"}]

The option PlotFit determines the model used for fitting:

ListFitPlot[cars->{"displacement","horsepower"},PlotFit->"Linear"]

The option PlotFitElements controls the display of the model:

ListFitPlot[cars->{"displacement","horsepower"},PlotFitElements->{"DataPoints","BandCurves"}]

Wider Support for Around

Plot and Plot3D can now use Around to show confidence bands:

Plot[Around[x^2,x],{x,0,10}]

Plot3D[Around[x+y,x y],{x,0,5},{y,0,5}]

IntervalMarkersStyle controls the appearance of the bands:

Plot[Around[x^2,x],{x,0,10},IntervalMarkersStyle->StandardYellow]

Plot3D[Around[x+y,x y],{x,0,5},{y,0,5},IntervalMarkersStyle-><|"Mesh"->None|>]

Labeling

Labels are positioned automatically, avoiding collisions:

ListPlot[]

LabelingTarget is a new option to control automatic labeling in plots. Show the quarter of the labels that are easiest to read:

ListPlot[,LabelingTarget->0.25]

Only allow label positions that are orthogonal to the points:

ListPlot[,LabelingTarget-><|"AllowedLabelingPositions"->"Sides"|>]

Allow labels to be clipped by the edges of the plot:

ListPlot[,LabelingTarget-><|"AllowLabelClipping"->True|>]

PlotInteractivity

The new option PlotInteractivity disables any interactive behaviors

{Plot[Sin[x],{x,0,10}],Plot[Sin[x],{x,0,10},PlotInteractivity->False]}

{BarChart[{3,6,4,1,2,5}],BarChart[{3,6,4,1,2,5},PlotInteractivity->False]}

Use $PlotInteractivity to set things in a session or across multiple plots:

Block[{$PlotInteractivity=False},Show[
Plot[Evaluate[Table[Normal[Series[Sin[x],{x,0,n}]],{n,1,13,2}]],{x,-8,8},PlotRange->2,AspectRatio->Automatic],
Plot[Sin[x],{x,-8,8},PlotStyle->Black]
]]

New Functions

Surface Plots

SurfaceContourPlot3D and SurfaceDensityPlot3D plot functions over regions:

spoon=;

PDE code

vars={{u[x,y,z],v[x,y,z],w[x,y,z]},{x,y,z}};
pars=<|"Material"->LinguisticAssistant|>;

displacement=NDSolveValue[{SolidMechanicsPDEComponent[vars,pars]==SolidBoundaryLoadValue[x>=1/10,vars,pars,<|"Force"->{0,0,(Quantity[-100, "N", newtons, "Newtons"])}|>],
SolidFixedCondition[x<=-1/10,vars,pars]},{u,v,w},{x,y,z}∈spoon];

strains=SolidMechanicsStrain[vars,pars,displacement];

stresses=SolidMechanicsStress[vars,pars,strains];

vonMisesStress=VonMisesStress[vars,pars,stresses];

SurfaceContourPlot3D[vonMisesStress,{x,y,z}∈spoon]

SurfaceDensityPlot3D[vonMisesStress,{x,y,z}∈spoon]

SmoothDateHistogram

SmoothDateHistogram is a new function for smoothed plotting of date distributions

SmoothDateHistogram[EntityValue[(EntityClass["communication spacecraft", EntityClass["Satellite","CommunicationMission"], "EntityClass[\"Satellite\", \"CommunicationMission\"]", "satellites"]),"LaunchDate"]]

Using longer bandwidths creates fewer bumps:

SmoothDateHistogram[EntityValue[(EntityClass["communication spacecraft", EntityClass["Satellite","CommunicationMission"], "EntityClass[\"Satellite\", \"CommunicationMission\"]", "satellites"]),"LaunchDate"],=[5 years]]

SmoothDateHistogram[EntityValue[(EntityClass["communication spacecraft", EntityClass["Satellite","CommunicationMission"], "EntityClass[\"Satellite\", \"CommunicationMission\"]", "satellites"]),"LaunchDate"],=[6 months]]

⚠️ PlotGrid ⚠️

PlotGrid is a new function that will simplify creating grids of plots with shared scales:

plots=Table[Histogram[RandomVariate[NormalDistribution[i,j],500],{1}],{i,3},{j,3}]

Every row will have the same y range, and every column the same x range:

PlotGrid[plots,All,]

Determine the plot ranges on per-row and per-column bases:

PlotGrid[plots,Automatic,]

All rows have the same y range, but each plot has its own x range:

PlotGrid[plots,"Rows",]

⚠️ PlotStyle ⚠️

The charting functions are updated to take the PlotStyle option

BarChart[{{1,2,3},{4,5,6}},PlotStyle->{StandardBlue,StandardCyan}]

PlotStyle is also extended to take an association form that allows more flexibility in specifying the styles by naming what parts of the plot should be styled.

BarChart[{{1,2,3},{4,5,6}},PlotStyle-><|"Groups"->{StandardBlue,StandardCyan}|>]

“Elements” applies to the lowest level of data:

BarChart[{{1,2,3},{4,5,6}},PlotStyle-><|"Elements"->{StandardBlue,StandardCyan,StandardYellow}|>]

“Base” applies to all the visual elements:

BarChart[{{1,2,3},{4,5,6}},PlotStyle-><|"Groups"->{StandardBlue,StandardCyan},"Base"->EdgeForm[AbsoluteThickness[3]]|>]

Change the pointsize for all the points in one place:

ListPlot[{,},PlotStyle-><|"Lists"->{StandardPurple,StandardCyan},"Base"->AbsolutePointSize[7]|>]

Plot[{Sin[x],Cos[x]},{x,0,10},PlotStyle-><|"Functions"->{StandardPurple,StandardYellow}|>]

Initialization

trees=ConstructColumns[ResourceData["Sample Tabular Data: NYC Trees"],{"tree_id","health","spc_common","created_at","tree_dbh","x_sp","y_sp","position"->Function[GeoPosition[{#latitude,#longitude}]]}]