Skip to content

Commit

Permalink
Bring back images directory, needed by README
Browse files Browse the repository at this point in the history
  • Loading branch information
has2k1 committed Feb 27, 2024
1 parent a63cad3 commit 3402616
Show file tree
Hide file tree
Showing 15 changed files with 105 additions and 4 deletions.
7 changes: 3 additions & 4 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,17 @@ clean: ## Remove build artefacts
rm -f objects.txt
rm -f objects.inv

deps: ## Install build dependencies
cd ..; make doc-deps

readme-images:
cd images; python readme_images.py

download_qrenderer_style: ## Download qrenderer.scss
@if [ ! -f $(QRENDERER_STYLE_FILE) ]; then \
echo "Downloading $(QRENDERER_STYLE_FILE)"; \
wget $(QRENDERER_STYLE_URL) -O $(QRENDERER_STYLE_FILE); \
fi

deps: download_qrenderer_style ## Install build dependencies
cd ..; make doc-deps

interlinks: ## Gather interlinks
quartodoc interlinks

Expand Down
Binary file added doc/images/favicon.ico
Binary file not shown.
Binary file added doc/images/logo-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/logo-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/logo-540.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/logo-small.pdf
Binary file not shown.
Binary file added doc/images/logo.pdf
Binary file not shown.
69 changes: 69 additions & 0 deletions doc/images/logo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import numpy as np
import pandas as pd

from plotnine import (
aes,
annotate,
geom_bar,
geom_line,
geom_point,
ggplot,
scale_color_gradientn,
scale_fill_gradientn,
theme,
theme_void,
)

n = 99

x = np.linspace(0, 1, n)
y = np.exp(-7 * (x - 0.5) ** 2)

data = pd.DataFrame({"x": x, "y": y})

bcolor = "#9e2f68"
bcolor_lighter = "#f4d8e6"
bcolor_darker = "#631d41"

gradient = (
(0.99, 0.88, 0.87),
(0.98, 0.62, 0.71),
(0.86, 0.20, 0.59),
bcolor,
bcolor,
bcolor_darker,
bcolor_darker,
)

data1 = data[: n // 3 : 9]
data2 = data[n // 3 : 2 * n // 3]
data3 = data[2 * n // 3 :: 12]

p = (
ggplot(mapping=aes("x", "y", color="y", fill="y"))
+ annotate(
geom="label",
x=0.260,
y=0.493,
family="Helvetica",
label="pl tnine",
label_size=1.5,
label_padding=0.1,
size=24,
fill=bcolor_lighter,
color=bcolor,
)
+ geom_point(data=data1, size=8, stroke=0, show_legend=False)
+ geom_line(data=data2, size=2, color=bcolor_darker, show_legend=False)
+ geom_bar(aes("x+.06"), data3, stat="identity", size=0, show_legend=False)
+ scale_color_gradientn(colors=gradient)
+ scale_fill_gradientn(colors=gradient)
+ theme_void()
+ theme(figure_size=(3.6, 3.6))
)

p.save("logo.pdf")

# Remove the project name
p.layers = p.layers.__class__(p.layers[1:])
p.save("logo-small.pdf")
Binary file added doc/images/readme-image-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/readme-image-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/readme-image-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/readme-image-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/readme-image-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/readme-image-5alt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions doc/images/readme_images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from plotnine import (
aes,
facet_wrap,
geom_point,
ggplot,
stat_smooth,
theme,
theme_tufte,
theme_xkcd,
)
from plotnine.data import mtcars

p1 = (
ggplot(mtcars, aes("wt", "mpg"))
+ geom_point()
+ theme(figure_size=(6, 4), dpi=300)
)
p1.save("readme-image-1.png")

p2 = p1 + aes(color="factor(gear)")
p2.save("readme-image-2.png")

p3 = p2 + stat_smooth(method="lm")
p3.save("readme-image-3.png")

p4 = p3 + facet_wrap("gear")
p4.save("readme-image-4.png")

p5 = p4 + theme_xkcd()
p5.save("readme-image-5.png")

p5alt = p4 + theme_tufte()
p5alt.save("readme-image-5alt.png")

0 comments on commit 3402616

Please sign in to comment.