-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring back images directory, needed by README
- Loading branch information
Showing
15 changed files
with
105 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |