Skip to content

Commit

Permalink
Fix themes for new Makie resolution (#28)
Browse files Browse the repository at this point in the history
* Fix themes for new Makie resolution

* don't be evil
  • Loading branch information
asinghvi17 authored Feb 6, 2024
1 parent 3d6b390 commit 2ad534a
Show file tree
Hide file tree
Showing 46 changed files with 68 additions and 39 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
/Manifest.toml
img/demofigure/*.png
img/demoscatter/*.png
/Manifest.toml
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ makedocs(;
"BBC" => "themes/bbc.md",
"API" => "api.md"
],
warnonly = true,
)

deploydocs(;
Expand Down
6 changes: 5 additions & 1 deletion docs/src/themes/bbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ MakieThemes.demoscatter(theme_bbc())
<img src="../../assets/img/demoscatter/bbc.png" alt="BBC theme" width="900"/>
```

The `finalize_plot` functionality in `bbplot` is planned for the near future, so stay tuned!
The `finalize_plot` functionality in `bbplot` is planned for the near future, so stay tuned!

```@docs
theme_bbc
```
34 changes: 17 additions & 17 deletions ggthemr.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,68 +4,68 @@ This emulates the themes from [the R gghthemr library](https://github.com/cttobi

### flat

<img src="img/flat.png" alt="flat" width="400"/>
<img src="img/demofigure/flat.png" alt="flat" width="400"/>

### dust

<img src="img/dust.png" alt="dust" width="400"/>
<img src="img/demofigure/dust.png" alt="dust" width="400"/>

### fresh

<img src="img/fresh.png" alt="fresh" width="400"/>
<img src="img/demofigure/fresh.png" alt="fresh" width="400"/>

### carrot

<img src="img/carrot.png" alt="carrot" width="400"/>
<img src="img/demofigure/carrot.png" alt="carrot" width="400"/>

### flat_dark

<img src="img/flat_dark.png" alt="carrot" width="400"/>
<img src="img/demofigure/flat_dark.png" alt="carrot" width="400"/>

### sky

<img src="img/sky.png" alt="sky" width="400"/>
<img src="img/demofigure/sky.png" alt="sky" width="400"/>

### copper

<img src="img/copper.png" alt="copper" width="400"/>
<img src="img/demofigure/copper.png" alt="copper" width="400"/>

### light

<img src="img/light.png" alt="light" width="400"/>
<img src="img/demofigure/light.png" alt="light" width="400"/>

### pale

<img src="img/pale.png" alt="pale" width="400"/>
<img src="img/demofigure/pale.png" alt="pale" width="400"/>

### solarized

<img src="img/solarized.png" alt="solarized" width="400"/>
<img src="img/demofigure/solarized.png" alt="solarized" width="400"/>

### sea

<img src="img/sea.png" alt="sea" width="400"/>
<img src="img/demofigure/sea.png" alt="sea" width="400"/>

### chalk

<img src="img/chalk.png" alt="chalk" width="400"/>
<img src="img/demofigure/chalk.png" alt="chalk" width="400"/>

### greyscale

<img src="img/greyscale.png" alt="greyscale" width="400"/>
<img src="img/demofigure/greyscale.png" alt="greyscale" width="400"/>

### earth

<img src="img/earth.png" alt="earth" width="400"/>
<img src="img/demofigure/earth.png" alt="earth" width="400"/>

### lilac

<img src="img/lilac.png" alt="lilac" width="400"/>
<img src="img/demofigure/lilac.png" alt="lilac" width="400"/>

### grass

<img src="img/grass.png" alt="grass" width="400"/>
<img src="img/demofigure/grass.png" alt="grass" width="400"/>

### grape

<img src="img/grape.png" alt="grape" width="400"/>
<img src="img/demofigure/grape.png" alt="grape" width="400"/>
Binary file added img/demofigure/bbc.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 img/demofigure/carrot.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 img/demofigure/chalk.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 img/demofigure/copper.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 img/demofigure/default.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 img/demofigure/dust.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 img/demofigure/earth.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 img/demofigure/flat.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 img/demofigure/flat_dark.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 img/demofigure/fresh.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 img/demofigure/grape.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 img/demofigure/grass.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 img/demofigure/greyscale.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 img/demofigure/light.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 img/demofigure/lilac.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 img/demofigure/pale.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 img/demofigure/sea.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 img/demofigure/sky.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 img/demofigure/solarized.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 img/demoscatter/bbc.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 img/demoscatter/carrot.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 img/demoscatter/chalk.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 img/demoscatter/copper.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 img/demoscatter/default.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 img/demoscatter/dust.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 img/demoscatter/earth.png
Binary file added img/demoscatter/flat.png
Binary file added img/demoscatter/flat_dark.png
Binary file added img/demoscatter/fresh.png
Binary file added img/demoscatter/grape.png
Binary file added img/demoscatter/grass.png
Binary file added img/demoscatter/greyscale.png
Binary file added img/demoscatter/light.png
Binary file added img/demoscatter/lilac.png
Binary file added img/demoscatter/pale.png
Binary file added img/demoscatter/sea.png
Binary file added img/demoscatter/sky.png
Binary file added img/demoscatter/solarized.png
Binary file modified img/ggthemr_full_fresh.png
27 changes: 14 additions & 13 deletions src/BBC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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:
Expand Down
33 changes: 29 additions & 4 deletions src/GGThemr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand All @@ -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(
Expand All @@ -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,
),
)
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/MakieThemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

2 comments on commit 2ad534a

@asinghvi17
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/100245

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" 2ad534a0e98fa9ce1563c45eb4ffa6f1dfe13e90
git push origin v0.1.1

Please sign in to comment.