Dive into Visualization
Author
Brett Champion
Title
Dive into Visualization
Description
Livestream notebook
Category
Essays, Posts & Presentations
Keywords
Visualization
URL
http://www.notebookarchive.org/2022-08-bj4ve9s/
DOI
https://notebookarchive.org/2022-08-bj4ve9s
Date Added
2022-08-25
Date Last Modified
2022-08-25
File Size
0.68 megabytes
Supplements
Rights
Redistribution rights reserved
Download
Open in Wolfram Cloud
Dive into Visualization
Dive into Visualization
Brett Champion
Topics
Scaling Functions
Scaling Functions
TernaryListPlot
TernaryListPlot
DropShadowing
DropShadowing
Scaling Functions: Background
Scaling Functions: Background
The most common nonlinear scale for plots is probably the “log” scale which shows order of magnitude changes as constant visual differences. It’s so important, that we have several named visualization functions that automatically use log scales:
In[]:=
{LogPlot[Gamma[x],{x,0,10},Frame->True],LogLinearPlot[x,{x,0.001,100},Frame->True]}
Out[]=
,
Scaling Functions: Background
Scaling Functions: Background
Eventually we started adding a ScalingFunctions option to visualization functions for two reasons. The first reason is that adding named functions scales poorly, and we would end up with things like LogLinearLogPlot3D. The second reason is to allow more possible scaling functions, beyond just log and linear scales.
In[]:=
{Plot[x,{x,0,10},ScalingFunctions->"Reverse",Frame->True],Plot[x,{x,0,10},ScalingFunctions->"Reciprocal",Frame->True]}
Out[]=
,
Scaling Functions: Background
Scaling Functions: Background
There are two parts to how scaling functions work: the visual transformation of the geometry, and the corrected display of tick labels so the plot can be easily read.
In[]:=
{Plot[Sin[x]+x^2,{x,0,10},ScalingFunctions->"Log",Frame->True],Plot[Log[Sin[x]+x^2],{x,0,10},Frame->True]}
Out[]=
,
Until recently, the named scaling functions were implemented using continuous mappings from the reals to the reals. “Log” via , “Reverse” via , and “Reciprocal” via .
log(x)
-x
1
x
Scaling Functions: Roll Out
Scaling Functions: Roll Out
Over the past few years the number of functions supporting the ScalingFunctions option has greatly increased, to about 80% of all visualization functions:
In[]:=
WolframLanguageData["ScalingFunctions","SymbolsUsingAsOption"]
Out[]=
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
AbsArgPlot
AngularGauge
AxisObject
BarChart
BarChart3D
BarLegend
BodePlot
BoxWhiskerChart
BubbleChart
BubbleChart3D
BulletGauge
CandlestickChart
ClockGauge
ComplexListPlot
ComplexPlot
ComplexPlot3D
ContourPlot
ContourPlot3D
CumulativeFeatureImpactPlot
DateHistogram
DateListLogPlot
DateListPlot
DateListStepPlot
DateScale
DensityHistogram
DensityPlot
DensityPlot3D
DiscretePlot
DiscretePlot3D
DistributionChart
FeatureImpactPlot
FeatureSpacePlot
FeatureSpacePlot3D
FeatureValueDependencyPlot
FeatureValueImpactPlot
GeoContourPlot
GeoDensityPlot
GeoGraphValuePlot
Histogram
Histogram3D
HorizontalGauge
ImageHistogram
ImageWaveformPlot
InteractiveTradingChart
KagiChart
LineBreakChart
ListContourPlot
ListContourPlot3D
ListCurvePathPlot
ListDensityPlot
ListDensityPlot3D
ListLinePlot
ListLinePlot3D
ListLogLinearPlot
ListLogLogPlot
ListLogPlot
ListPlot
ListPlot3D
ListPointPlot3D
ListPolarPlot
ListSliceContourPlot3D
ListSliceDensityPlot3D
ListSliceVectorPlot3D
ListStepPlot
ListStreamDensityPlot
ListStreamPlot
ListStreamPlot3D
ListSurfacePlot3D
ListVectorDensityPlot
ListVectorPlot
ListVectorPlot3D
LogLinearPlot
LogLogPlot
LogPlot
NicholsPlot
PairedBarChart
PairedHistogram
PairedSmoothHistogram
ParallelAxisPlot
ParametricPlot
ParametricPlot3D
Periodogram
Plot
Plot3D
PointFigureChart
PointValuePlot
PolarPlot
ProbabilityPlot
ProbabilityScalePlot
QuantilePlot
RadialAxisPlot
RectangleChart
RectangleChart3D
RegionPlot
RegionPlot3D
ReImPlot
RenkoChart
SingularValuePlot
SliceContourPlot3D
SliceDensityPlot3D
SliceVectorPlot3D
SmoothDensityHistogram
SmoothHistogram
SmoothHistogram3D
SphericalPlot3D
StackedDateListPlot
StackedListPlot
StreamDensityPlot
StreamPlot
StreamPlot3D
SystemModelPlot
ThermometerGauge
TradingChart
VectorDensityPlot
VectorPlot
VectorPlot3D
VerticalGauge
WordCloud
Scaling Functions: New Built-in Scales
Scaling Functions: New Built-in Scales
Simultaneous to the roll-out of scaling functions, we have also been expanding the set of built-in scaling functions.
“SignedLog”, log-like scale allowing zero and negative numbers
In[]:=
Plot[x,{x,-100,100},ScalingFunctions->"SignedLog",Frame->True]
Out[]=
“Infinite”, compacted scale allowing ±∞
In[]:=
Plot[x,{x,-∞,∞},Frame->True]
Out[]=
In[]:=
Plot[x,{x,-∞,∞},ScalingFunctions->"Infinite",Frame->True]
Out[]=
Scaling Functions: Date Scales
Scaling Functions: Date Scales
Data visualization functions are able to directly plot dated values via scaling functions. In the following example we pass ListLinePlot dates and times as the x and y values, and show the sunrise and sunset times for Champaign, IL over the course of a year. (For simplicity it’s ignoring Daylight Saving Time.)
Daylight Example
Daylight Example
In[]:=
Shortrise=Table{date,TimeObject[Sunrise[Here,date]]},date,DateRange,
Sat 1 Jan 2022
Sat 31 Dec 2022
Out[]//Short=
,,363,,
Sat 1 Jan 2022
Minute: 08:15GMT-5
Sat 31 Dec 2022
M…: 08:151
In[]:=
Shortset=Table{date,TimeObject[Sunset[Here,date]]},date,DateRange,
Sat 1 Jan 2022
Sat 31 Dec 2022
Out[]//Short=
,,363,,
Sat 1 Jan 2022
Minute: 17:38GMT-5
Sat 31 Dec 2022
M…: 17:371
In[]:=
ListLinePlot[{rise,set},ScalingFunctions->{"Date","Date"},Frame->True]
Out[]=
Scaling Functions: Categorical Scales
Scaling Functions: Categorical Scales
Scaling functions have recently been extended to work with two classes of categorical data: nominal and ordinal.
Nominal data is the most general, and is essentially just a collection of named categories. Examples include people’s names, cities, types of pet, etc...
Ordinal data is similar, but has some concept of ordering between the categories. Examples include things like letter grades in a class, satisfaction levels in a survey, tornado strengths, etc...
Apple Prices Example
Apple Prices Example
In[]:=
BubbleChart
,ScalingFunctions->{NominalScale[Automatic],OrdinalScale[{"125s","113s","100s","88s","80s","72s","64s","56s"}],None},
{{Apple type, size, price}, …} |
Out[]=
State Bond Rating Example
State Bond Rating Example
In[]:=
ListPlot
,ScalingFunctionsNominalScale[Automatic,RotateLabelTrue],OrdinalScale
,GridLinesAll,ColorFunctionColorData[{"Rainbow","Reverse"}]
S&P state ratings 2021 |
S&PBondRatings |
Out[]=
TernaryListPlot
TernaryListPlot
Typically used for mixtures, ternary plots are a way of visualizing data that consists of three components {u,v,w} as 2D points inside a triangle.
TernaryListPlot: Reading Fractions
TernaryListPlot: Reading Fractions
Interpreting ternary plots can take a bit of practice. In the picture below the colored bands each represent a fixed fraction of component A in the data. The green points, for example, represent all the points where 30% of the mixture is from component A. Where the points are on the right edge of the triangle, component B makes up the remaining 70%. Along the bottom edge, component C does, and the interior corresponds to points with everything in between.
In[]:=
TernaryListPlot[Table[{i,r,100-i-r},{i,10,90,10},{r,0,100-i}],PlotLegendsQuantity[Range[10,90,10],"Percent"],FrameLabel{"A","B","C"},GridLines->Automatic,GridLinesStyle->Black]
Out[]=
|
TernaryListPlot: Reading Fractions
TernaryListPlot: Reading Fractions
There are also lines corresponding to fixed ratios between components. In the picture below the colored bands each represent a fixed ratio of component B to component C. The yellow points, for example, represent all the points where the ratio is 4:1.
In[]:=
TernaryListPlotTable[{i,r(100-i)/(r+1),(100-i)/(r+1)},{r,{10,4,2,1,1/2,1/4,1/10}},{i,0,100}],
Out[]=
|
TernaryListPlot: Applications
TernaryListPlot: Applications
Geology
Geology
Plot a soil texture triangle with shaded regions:
In[]:=
TernaryListPlot
,FrameLabel->{"Sand","Silt","Clay"},Prolog->DirectiveOpacity[0.5],,Polygon[{{0.2,0.6,0.2},{0.2,0.2,0.6},{0.6,0.2,0.2}}],
Soil Data |
Out[]=
Nutrition
Nutrition
Show the fractions of fat, carbohydrates and proteins in a variety of foods:
In[]:=
TernaryListPlotTooltip[{##2},#]&@@@
,FrameLabel->{"Fat","Carbs","Protein"},PlotStyle->PointSize[.015]
foods |
Out[]=
Energy
Energy
Show the sources of electricity for countries around the world:
In[]:=
TernaryListPlotMapThreadTooltip[#1,#2]&,EntityValueEntityList
,{"ElectricityConventionalThermal","ElectricityNuclear","ElectricityTotalRenewables"},EntityList
,FrameLabel->{"Fossil fuels","Nuclear","Renewables"},PlotStyle->Red
world | GEOGRAPHIC REGION |
countries
world | GEOGRAPHIC REGION |
countries
Out[]=
DropShadowing
DropShadowing
DropShadowing is a new 2D style directive that draws graphics elements with a drop shadow:
In[]:=
Graphics[{Red,DropShadowing[{20,-20}],Disk[]}]
Out[]=
DropShadowing: Plot Styles
DropShadowing: Plot Styles
DropShadowing can be used pretty much anywhere styles can be used, say to draw attention to a particular element:
In[]:=
Plot[{2Sin[x]+x,2Cos[x]+x},{x,0,15},PlotStyleDropShadowing[]]
Out[]=
In[]:=
PieChart[{3,8,4,5},ChartStyle->DropShadowing[{8,-8}]]
Out[]=
Cite this as: Brett Champion, "Dive into Visualization" from the Notebook Archive (2022), https://notebookarchive.org/2022-08-bj4ve9s
Download