Skip to main content

Data Visualization

A standard set of function inherited from Wolfram Standard Library. Most examples were adapted from the official pages of Wolfram Language Documentation Center. The algorithms and implementations of those functions are the intellectual property of Wolfram Research. WLJS Team only reimplemented underlying low-level primitives such as Line, Point, Polygon, and etc.

Download original notebook

Plot

The most basic option for plotting analythical functions

Plot[(*FB[*)((1)(*,*)/(*,*)(x))(*]FB*), {x,0,1}]
(*VB[*)(FrontEndRef["ff324093-aadd-4bcc-8004-4cc459036013"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKp6UZG5kYWBrrJiampOiaJCUn61oYGJjomiQnm5haGhibGRgaAwCJ2RVf"*)(*]VB*)

Axes and Styling

This is quite limited, but can work well in most cases

Plot[(*FB[*)((1)(*,*)/(*,*)(x))(*]FB*), {x,0,1}, 
  PlotStyle->Red, 
  Frame->True, 
  FrameLabel->{"x-axis", "y-axis"}, 
  FrameStyle->Directive[FontSize->14], 
  FrameTicksStyle->Directive[FontSize->14],
  Epilog->{Cyan, Line[{{-10,10}, {10,10}}]}
]
(*VB[*)(FrontEndRef["3b2d8cd0-48d4-4987-97a5-11c47f9e0924"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKGycZpVgkpxjomlikmOiaWFqY61qaJ5rqGhomm5inWaYaWBqZAACAEBUm"*)(*]VB*)

Fill between two curves

Plot[{Sin[x] + x/2, Sin[x] + x}, {x, 0, 10}, Filling -> {1 -> {2}}]
(*VB[*)(FrontEndRef["8d891115-58ee-47f7-a4a5-f97e41a9db8a"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKW6RYWBoaGprqmlqkpuqamKeZ6yaaJJrqplmap5oYJlqmJFkkAgB9iBW7"*)(*]VB*)

Plot multiple filled curves

Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, 10}, 
 Filling -> Axis]
(*VB[*)(FrontEndRef["c7d8775d-91a5-4dec-86a2-c7aaea90d885"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKJ5unWJibm6boWhommuqapKQm61qYJRrpJpsnJqYmWhqkWFiYAgCLsBYV"*)(*]VB*)

Parameteric plots

Accepts function, which returns pair {x,y}\{x,y\}

ParametricPlot[{Sin[3t], Cos[3t]} (*SpB[*)Power[E(*|*),(*|*)-t](*]SpB*), {t, 0, Pi}] 
(*VB[*)(FrontEndRef["c73f4896-9651-4143-863e-5c5c16b7f55c"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKJ5sbp5lYWJrpWpqZGuqaGJoY61qYGafqmiabJhuaJZmnmZomAwBzART7"*)(*]VB*)

Date plots

Treats the series of points with values yi at a sequence of dates

{DateObject[{2022, 12}], DateObject[{2023, 12}], Now}
{(*VB[*)(DateObject[{2022,12},"Month"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwSSxJ9U/KSk0uCUnNLcgB8oK5gMJKLqnJCkYGRkZKAKJzDjo="*)(*]VB*),(*VB[*)(DateObject[{2023,12},"Month"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwSSxJ9U/KSk0uCUnNLcgB8oK5gMJKLqnJCkYGRsZKAKJ1Djs="*)(*]VB*),(*VB[*)(DateObject[{2024,9,4,11,24,1.504609`6.9299986441629},"Instant","Gregorian",2.`])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwSSxJ9U/KSk0uCUnNLcgB8oIlgcJK4akpCiYKwakFCkYGRiYKhoZWRiZWBoZKAJrpEbg="*)(*]VB*)}
DateListPlot[Transpose[{%, {1,2,3}}]]
(*VB[*)(FrontEndRef["e71c7d28-59fd-4eb8-8e63-2b40985ebd3f"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKp5obJpunGFnomlqmpeiapCZZ6FqkmhnrGiWZGFhamKYmpRinAQCIaxXr"*)(*]VB*)

Example data

DateListPlot[FinancialData["IBM", "Jan. 1, 2004"]]
(*VB[*)(FrontEndRef["f6aadbd2-fa86-407e-a3ad-d6f364c855c9"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKp5klJqYkpRjppiVamOmaGJin6iYaJ6boppilGZuZJFuYmiZbAgCbaRZp"*)(*]VB*)

List plots

Plot an array of numbers or a time-series

ListLinePlot[{1, 1, 2, 3, 5, 8}, Filling -> Axis]
(*VB[*)(FrontEndRef["f3abfcf7-eec7-4c94-97e9-c917ed92357c"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKpxknJqUlp5nrpqYmm+uaJFua6Fqap1rqJlsamqemWBoZm5onAwCcshZV"*)(*]VB*)

Plot multiple traces

ListLinePlot[Table[Accumulate[RandomReal[{-1, 1}, 250]], {3}], 
 Filling -> Axis, PlotLegends -> {"one", "two", "three"}]
(*VB[*)(FrontEndRef["aabbffff-d64b-46f5-9778-a5cb89b81894"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKJyYmJaUBgW6KmUmSrolZmqmupbm5hW6iaXKShWWShaGFpQkAoVgWUQ=="*)(*]VB*)

Plot points

ListPlot[
 RandomVariate[BinormalDistribution[{4, 4}, {1, 1}, 0.5], 750]]
(*VB[*)(FrontEndRef["3fb5720e-a7ed-4de2-a6fd-941b90271c1c"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKG6clmZobGaTqJpqnpuiapKQa6SaapaXoWpoYJlkaGJkbJhsmAwCOhhX8"*)(*]VB*)

Plot several data as lists with legend

ListPlot[
 Table[{k, 
   PDF[BinomialDistribution[50, p], k]}, {p, {0.3, 0.5, 0.8}}, {k, 0, 
   50}], Filling -> Axis, PlotLegends -> {0.3, 0.5, 0.8}]
(*VB[*)(FrontEndRef["d40e0030-9a33-4062-b559-75e09c3a2f8f"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKp5gYpBoYGBvoWiYaG+uaGJgZ6SaZmlrqmpumGlgmGycapVmkAQBzWRUL"*)(*]VB*)

Plot a curve that corresponds to a smooth path through the specified points

ListCurvePathPlot[RandomReal[{0, 10}, {2000, 2}]]
(*VB[*)(FrontEndRef["fe16c661-ba28-4465-8de9-2405379cc4f8"])(*,*)(*"1:eJxTTMoPSmNkYGAoZgESHvk5KRCeEJBwK8rPK3HNS3GtSE0uLUlMykkNVgEKp6UamiWbmRnqJiUaWeiamJiZ6lqkpFrqGpkYmBqbWyYnm6RZAACBJxVV"*)(*]VB*)