Skip to content

Commit

Permalink
add four-vs-of-data.typ converted from Tikz version and new pie-physi…
Browse files Browse the repository at this point in the history
…cs-chemistry-ml.typ and PDF/PNG/SVG assets

- add '*.pyc' to .gitignore
- update readme.md to reflect new diagram count (115 to 116) and add pie chart to table
- fix relative import of pdf_to_svg_png_compressed from renamed convert_assets.py module
  • Loading branch information
janosh committed Jan 17, 2025
1 parent 109cf2c commit f53d773
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 45 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__latexindent_temp.tex
*.pyc
99 changes: 99 additions & 0 deletions assets/four-vs-of-data/four-vs-of-data.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#import "@preview/cetz:0.3.1": canvas, draw
#import "@preview/cetz-plot:0.1.0": chart

#set page(width: auto, height: auto, margin: 8pt)

#canvas({
import draw: *

let radius = 3
let arrow-radius = radius * 1.15 // Slightly larger for arrows
// Data structure for 8 slices (4 main + 4 darker sub-slices)
let data = (
// Veracity (orange, top right)
("veracity-main", 75, "Veracity", rgb("#FFA500").lighten(80%)),
("veracity-sub", 15, "", rgb("#FFA500").lighten(60%)),
// Volume (blue, top left)
("volume-main", 75, "Volume", rgb("#0000FF").lighten(80%)),
("volume-sub", 15, "", rgb("#0000FF").lighten(60%)),
// Velocity (green, bottom left)
("velocity-main", 75, "Velocity", rgb("#00FF00").lighten(80%)),
("velocity-sub", 15, "", rgb("#00FF00").lighten(60%)),
// Variety (yellow, bottom right)
("variety-main", 75, "Variety", rgb("#FFFF00").lighten(80%)),
("variety-sub", 15, "", rgb("#FFFF00").lighten(60%)),
)
// Draw main pie chart
chart.piechart(
data,
value-key: 1,
label-key: 2,
radius: radius,
slice-style: data.map(itm => itm.at(3)),
stroke: black + .8pt,
inner-label: (
content: (value, label) => text(weight: "regular")[#label],
radius: 120%,
),
outer-label: (
content: (),
),
legend: (label: ()),
)
let arrow-style = (
stroke: black + .8pt,
mark: (end: "stealth", fill: black, offset: 5pt, scale: .75),
)
// Draw curved arrows using arc
// Veracity arrow (top right, 0-90°)
arc(
(arrow-radius, 0),
start: 0deg,
stop: 90deg,
radius: arrow-radius,
..arrow-style,
name: "veracity",
)
content("veracity.5%", text(size: .8em)[high variance], anchor: "south-west", padding: 3pt)
content("veracity.95%", text(size: .8em)[reference data], anchor: "south-west", padding: 3pt)
// Volume arrow (top left, 90-180°)
arc(
(0, arrow-radius),
start: 90deg,
stop: 180deg,
radius: arrow-radius,
..arrow-style,
name: "volume",
)
content("volume.5%", text(size: .8em)[kilobytes], anchor: "south-east")
content("volume.95%", text(size: .8em)[terabytes], anchor: "south-east", padding: 3pt)
// Velocity arrow (bottom left, 180-270°)
arc(
(-arrow-radius, 0),
start: 180deg,
stop: 270deg,
radius: arrow-radius,
..arrow-style,
name: "velocity",
)
content("velocity.5%", text(size: .8em)[static], anchor: "east", padding: 3pt)
content("velocity.95%", text(size: .8em)[dynamic], anchor: "north-east", padding: 3pt)
// Variety arrow (bottom right, 270-360°)
arc(
(0, -arrow-radius),
start: 270deg,
stop: 360deg,
radius: arrow-radius,
..arrow-style,
name: "variety",
)
content("variety.start", text(size: .8em)[clustered], anchor: "north-west", padding: 3pt)
content("variety.95%", text(size: .8em)[heterogeneous], anchor: "north-west", padding: 3pt)
})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions assets/pie-physics-chemistry-ml/pie-physics-chemistry-ml.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions assets/pie-physics-chemistry-ml/pie-physics-chemistry-ml.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#import "@preview/cetz:0.3.1": canvas
#import "@preview/cetz-plot:0.1.0": chart

#set page(width: auto, height: auto, margin: 0pt)

#canvas({
// Data for pie chart (equal thirds)
let data = (
("physics", 1, "Ψ", rgb("#4a90e2")),
("chemistry", 1, "ΔG", rgb("#50c878")),
("ml", 1, "", rgb("#ff7f50")),
)
// Draw pie chart
chart.piechart(
data,
value-key: 1,
label-key: 2,
radius: 3,
slice-style: data.map(itm => itm.at(-1)),
stroke: white + .2pt,
inner-label: (content: (value, label) => [#text(label, size: 4em)], radius: 120%),
outer-label: (content: ()), // hide outer labels
legend: (label: ()), // hide legend
)
})
Loading

0 comments on commit f53d773

Please sign in to comment.