diff --git a/.gitignore b/.gitignore index 9731a94..004bb7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ *.jl.cov *.jl.*.cov *.jl.mem -/Manifest.toml -img/demofigure/*.png -img/demoscatter/*.png \ No newline at end of file +/Manifest.toml \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index 44652c1..f66b822 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -58,6 +58,7 @@ makedocs(; "BBC" => "themes/bbc.md", "API" => "api.md" ], + warnonly = true, ) deploydocs(; diff --git a/docs/src/themes/bbc.md b/docs/src/themes/bbc.md index 97a35c6..0816edc 100644 --- a/docs/src/themes/bbc.md +++ b/docs/src/themes/bbc.md @@ -20,4 +20,8 @@ MakieThemes.demoscatter(theme_bbc()) BBC theme ``` -The `finalize_plot` functionality in `bbplot` is planned for the near future, so stay tuned! \ No newline at end of file +The `finalize_plot` functionality in `bbplot` is planned for the near future, so stay tuned! + +```@docs +theme_bbc +``` \ No newline at end of file diff --git a/ggthemr.md b/ggthemr.md index be1e158..ef016c0 100644 --- a/ggthemr.md +++ b/ggthemr.md @@ -4,68 +4,68 @@ This emulates the themes from [the R gghthemr library](https://github.com/cttobi ### flat -flat +flat ### dust -dust +dust ### fresh -fresh +fresh ### carrot -carrot +carrot ### flat_dark -carrot +carrot ### sky -sky +sky ### copper -copper +copper ### light -light +light ### pale -pale +pale ### solarized -solarized +solarized ### sea -sea +sea ### chalk -chalk +chalk ### greyscale -greyscale +greyscale ### earth -earth +earth ### lilac -lilac +lilac ### grass -grass +grass ### grape -grape +grape diff --git a/img/demofigure/bbc.png b/img/demofigure/bbc.png new file mode 100644 index 0000000..68f888d Binary files /dev/null and b/img/demofigure/bbc.png differ diff --git a/img/demofigure/carrot.png b/img/demofigure/carrot.png new file mode 100644 index 0000000..94c54cf Binary files /dev/null and b/img/demofigure/carrot.png differ diff --git a/img/demofigure/chalk.png b/img/demofigure/chalk.png new file mode 100644 index 0000000..ccd4cc0 Binary files /dev/null and b/img/demofigure/chalk.png differ diff --git a/img/demofigure/copper.png b/img/demofigure/copper.png new file mode 100644 index 0000000..fa52259 Binary files /dev/null and b/img/demofigure/copper.png differ diff --git a/img/demofigure/default.png b/img/demofigure/default.png new file mode 100644 index 0000000..6679f57 Binary files /dev/null and b/img/demofigure/default.png differ diff --git a/img/demofigure/dust.png b/img/demofigure/dust.png new file mode 100644 index 0000000..0e37c1f Binary files /dev/null and b/img/demofigure/dust.png differ diff --git a/img/demofigure/earth.png b/img/demofigure/earth.png new file mode 100644 index 0000000..c8f2ea5 Binary files /dev/null and b/img/demofigure/earth.png differ diff --git a/img/demofigure/flat.png b/img/demofigure/flat.png new file mode 100644 index 0000000..469ca6d Binary files /dev/null and b/img/demofigure/flat.png differ diff --git a/img/demofigure/flat_dark.png b/img/demofigure/flat_dark.png new file mode 100644 index 0000000..c3158a7 Binary files /dev/null and b/img/demofigure/flat_dark.png differ diff --git a/img/demofigure/fresh.png b/img/demofigure/fresh.png new file mode 100644 index 0000000..91b1bcd Binary files /dev/null and b/img/demofigure/fresh.png differ diff --git a/img/demofigure/grape.png b/img/demofigure/grape.png new file mode 100644 index 0000000..f7bf598 Binary files /dev/null and b/img/demofigure/grape.png differ diff --git a/img/demofigure/grass.png b/img/demofigure/grass.png new file mode 100644 index 0000000..7a00775 Binary files /dev/null and b/img/demofigure/grass.png differ diff --git a/img/demofigure/greyscale.png b/img/demofigure/greyscale.png new file mode 100644 index 0000000..e31fdc2 Binary files /dev/null and b/img/demofigure/greyscale.png differ diff --git a/img/demofigure/light.png b/img/demofigure/light.png new file mode 100644 index 0000000..e235d80 Binary files /dev/null and b/img/demofigure/light.png differ diff --git a/img/demofigure/lilac.png b/img/demofigure/lilac.png new file mode 100644 index 0000000..bcd55f1 Binary files /dev/null and b/img/demofigure/lilac.png differ diff --git a/img/demofigure/pale.png b/img/demofigure/pale.png new file mode 100644 index 0000000..778c437 Binary files /dev/null and b/img/demofigure/pale.png differ diff --git a/img/demofigure/sea.png b/img/demofigure/sea.png new file mode 100644 index 0000000..5a6bd1a Binary files /dev/null and b/img/demofigure/sea.png differ diff --git a/img/demofigure/sky.png b/img/demofigure/sky.png new file mode 100644 index 0000000..c7c4a33 Binary files /dev/null and b/img/demofigure/sky.png differ diff --git a/img/demofigure/solarized.png b/img/demofigure/solarized.png new file mode 100644 index 0000000..b600e36 Binary files /dev/null and b/img/demofigure/solarized.png differ diff --git a/img/demoscatter/bbc.png b/img/demoscatter/bbc.png new file mode 100644 index 0000000..fe3d600 Binary files /dev/null and b/img/demoscatter/bbc.png differ diff --git a/img/demoscatter/carrot.png b/img/demoscatter/carrot.png new file mode 100644 index 0000000..6a1b600 Binary files /dev/null and b/img/demoscatter/carrot.png differ diff --git a/img/demoscatter/chalk.png b/img/demoscatter/chalk.png new file mode 100644 index 0000000..1f04fbb Binary files /dev/null and b/img/demoscatter/chalk.png differ diff --git a/img/demoscatter/copper.png b/img/demoscatter/copper.png new file mode 100644 index 0000000..02e26f7 Binary files /dev/null and b/img/demoscatter/copper.png differ diff --git a/img/demoscatter/default.png b/img/demoscatter/default.png new file mode 100644 index 0000000..fa6aeb7 Binary files /dev/null and b/img/demoscatter/default.png differ diff --git a/img/demoscatter/dust.png b/img/demoscatter/dust.png new file mode 100644 index 0000000..55ea894 Binary files /dev/null and b/img/demoscatter/dust.png differ diff --git a/img/demoscatter/earth.png b/img/demoscatter/earth.png new file mode 100644 index 0000000..f872bea Binary files /dev/null and b/img/demoscatter/earth.png differ diff --git a/img/demoscatter/flat.png b/img/demoscatter/flat.png new file mode 100644 index 0000000..e1bae79 Binary files /dev/null and b/img/demoscatter/flat.png differ diff --git a/img/demoscatter/flat_dark.png b/img/demoscatter/flat_dark.png new file mode 100644 index 0000000..6282bf1 Binary files /dev/null and b/img/demoscatter/flat_dark.png differ diff --git a/img/demoscatter/fresh.png b/img/demoscatter/fresh.png new file mode 100644 index 0000000..ad3c834 Binary files /dev/null and b/img/demoscatter/fresh.png differ diff --git a/img/demoscatter/grape.png b/img/demoscatter/grape.png new file mode 100644 index 0000000..e27895f Binary files /dev/null and b/img/demoscatter/grape.png differ diff --git a/img/demoscatter/grass.png b/img/demoscatter/grass.png new file mode 100644 index 0000000..93bb920 Binary files /dev/null and b/img/demoscatter/grass.png differ diff --git a/img/demoscatter/greyscale.png b/img/demoscatter/greyscale.png new file mode 100644 index 0000000..bf8df1c Binary files /dev/null and b/img/demoscatter/greyscale.png differ diff --git a/img/demoscatter/light.png b/img/demoscatter/light.png new file mode 100644 index 0000000..540f6d7 Binary files /dev/null and b/img/demoscatter/light.png differ diff --git a/img/demoscatter/lilac.png b/img/demoscatter/lilac.png new file mode 100644 index 0000000..a4f37ea Binary files /dev/null and b/img/demoscatter/lilac.png differ diff --git a/img/demoscatter/pale.png b/img/demoscatter/pale.png new file mode 100644 index 0000000..288b410 Binary files /dev/null and b/img/demoscatter/pale.png differ diff --git a/img/demoscatter/sea.png b/img/demoscatter/sea.png new file mode 100644 index 0000000..6c3b2e9 Binary files /dev/null and b/img/demoscatter/sea.png differ diff --git a/img/demoscatter/sky.png b/img/demoscatter/sky.png new file mode 100644 index 0000000..6dfcce8 Binary files /dev/null and b/img/demoscatter/sky.png differ diff --git a/img/demoscatter/solarized.png b/img/demoscatter/solarized.png new file mode 100644 index 0000000..7653019 Binary files /dev/null and b/img/demoscatter/solarized.png differ diff --git a/img/ggthemr_full_fresh.png b/img/ggthemr_full_fresh.png index 3b5b7c5..9647257 100644 Binary files a/img/ggthemr_full_fresh.png and b/img/ggthemr_full_fresh.png differ diff --git a/src/BBC.jl b/src/BBC.jl index 84bee70..a52c6e0 100644 --- a/src/BBC.jl +++ b/src/BBC.jl @@ -14,15 +14,15 @@ const bbc_yellow = Makie.to_color(colorant"#FAAB18") function style_bbc(spinewidth = 1.5, gridwidth = 1.5) return Attributes( - fontsize = 18, - textsize = 18, + # fontsize = 15, + # textsize = 15, Axis = ( - titlesize = 28, + titlesize = 20, titlefont = :bold, - titlegap = 9f0, + titlegap = 4f0, titlealign = :left, - subtitlesize = 22, - subtitlegap = 9f0, + # subtitlesize = 14, + subtitlegap = 6f0, subtitlealign = :left, topspinevisible = false, rightspinevisible = false, @@ -33,8 +33,8 @@ function style_bbc(spinewidth = 1.5, gridwidth = 1.5) yticksvisible = false, xticklabelsvisible = false, yticklabelsvisible = true, - xticklabelsize = 18, - yticklabelsize = 18, + # xticklabelsize = 14, + # yticklabelsize = 14, xminorgridvisible = false, yminorgridvisible = false, xgridvisible = false, @@ -43,15 +43,16 @@ function style_bbc(spinewidth = 1.5, gridwidth = 1.5) ygridwidth = gridwidth, ), Axis3 = ( - titlesize = 28, + titlesize = 20, titlefont = :bold, - titlegap = 9f0, - subtitlesize = 22, - subtitlegap = 9f0, + titlegap = 6f0, + # subtitlesize = 14, + subtitlegap = 6f0, ), Legend = ( framevisible = false, - labelsize = 18, + rowgap = 0, + # labelsize = 14, ), # once Makie can support multiple faces in one font file, # uncomment the following: diff --git a/src/GGThemr.jl b/src/GGThemr.jl index a8fb2d9..440d891 100644 --- a/src/GGThemr.jl +++ b/src/GGThemr.jl @@ -5,11 +5,12 @@ using Makie, Colors export theme_ggthemr, ggthemr, style_ggthemr, color_ggthemr, ggthemr_colorthemes +const ColorTheme = Dict{Symbol, Dict{Symbol, Any}}() ggthemr_colorthemes() = collect(keys(ColorTheme)) -function style_ggthemr(basewidth = 2, spinewidth = basewidth * 0.75) +function style_ggthemr(basewidth = 1.25, spinewidth = basewidth * 0.75) return Attributes( linewidth = basewidth, @@ -30,6 +31,8 @@ function style_ggthemr(basewidth = 2, spinewidth = basewidth * 0.75) ygridwidth = basewidth, xgridstyle = :dash, ygridstyle = :dash, + xticksize = 2.5, + yticksize = 2.5, ), Axis3 = Attributes( @@ -42,13 +45,18 @@ function style_ggthemr(basewidth = 2, spinewidth = basewidth * 0.75) xgridstyle = :dash, ygridstyle = :dash, zgridstyle = :dash, + xlabeloffset = 30, + ylabeloffset = 30, + zlabeloffset = 30, ), Legend = Attributes( backgroundcolor = :transparent, framevisible = false, + rowgap = 0, + titlegap = 0, ), Scatter = Attributes( - markersize = 15, + markersize = 10, strokewidth = 0, ), ) @@ -113,10 +121,27 @@ function theme_ggthemr(theme::Symbol) merge(style_ggthemr(), color_ggthemr(theme)) end -ggthemr(theme) = theme_ggthemr(theme) +""" + ggthemr(theme::Symbol) -const ColorTheme = Dict{Symbol, Dict{Symbol, Any}}() +Return a Makie theme based on the `theme` from the `ggthemr` package. + +To view a sample image, you can use `MakieThemes.demofigure(ggthemr(theme))`. +Available themes are: + +$(join(map(x -> "`:$(string(x))`", ggthemr_colorthemes()), ", ", " and ")). + +## Usage: +```julia +Makie.set_theme!(ggthemr(:fresh)) +# or +Makie.with_theme(ggthemr(:fresh)) do + # your plotting code here +end +``` +""" +ggthemr(theme) = theme_ggthemr(theme) ColorTheme[:fresh] = Dict( :background => "#ffffff", diff --git a/src/MakieThemes.jl b/src/MakieThemes.jl index d4f98e5..8e9436d 100644 --- a/src/MakieThemes.jl +++ b/src/MakieThemes.jl @@ -26,7 +26,7 @@ function demofigure(theme::Attributes = Makie.current_default_theme()) f = Makie.Figure() ax = Makie.Axis(f[1, 1], title = "Measurements", - subtitle = "Example-5000 oscilloscope at 3 Hz", + subtitle = "Ex-9000 oscilloscope at 3 Hz", xlabel = "time (s)", ylabel = "amplitude")