Skip to content

Commit

Permalink
enhance cleanup of tmp files - format (#5022)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg authored Nov 12, 2024
1 parent 9e88053 commit b1ea6c8
Show file tree
Hide file tree
Showing 41 changed files with 498 additions and 406 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/format_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,22 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
- name: Install dependencies
- name: format Julia files
run: |
using Pkg
Pkg.add("JuliaFormatter")
shell: julia --color=yes {0}

- name: Format Julia files
run: |
using JuliaFormatter
format(["RecipesBase", "RecipesPipeline", "PlotsBase", "src", "test", "GraphRecipes", "StatsPlots"])
shell: julia --color=yes --compile=min -O0 {0}

- name: suggester / JuliaFormatter
if: success() && github.ref == 'refs/heads/master'
julia --color=yes --compile=min -O0 -e '
using Pkg; Pkg.add("JuliaFormatter")
using JuliaFormatter
format(["RecipesBase", "RecipesPipeline", "PlotsBase", "src", "test", "GraphRecipes", "StatsPlots", "PlotThemes"])
'
- name: suggester
if: success() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/v2' )
uses: reviewdog/action-suggester@v1
with:
tool_name: JuliaFormatter
fail_on_error: true

# reviewdog/action-suggester not using `cleanup` flag?
- name: Cleanup
- name: cleanup
if: success() || failure()
run: |
git checkout -- .
Expand Down
19 changes: 6 additions & 13 deletions PlotThemes/src/PlotThemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ using PlotUtils

export add_theme, theme_palette, PlotTheme

_255_to_1(c::Symbol, colors) = RGBA(map(x-> x/255,colors[c])...)
RGB255(r,g,b) = RGB(r/255, g/255, b/255)
_255_to_1(c::Symbol, colors) = RGBA(map(x -> x / 255, colors[c])...)
RGB255(r, g, b) = RGB(r / 255, g / 255, b / 255)

function expand_palette(bg, cs; kwargs...)
colors = palette(cs).colors.colors
c = convert.(RGBA, distinguishable_colors(20, vcat(bg, colors); kwargs...))[2:end]
return palette(c)
end

const KW = Dict{Symbol, Any}
const KW = Dict{Symbol,Any}

struct PlotTheme
defaults::KW
Expand All @@ -33,7 +33,6 @@ function theme_palette(s::Symbol)
end
end


# add themes
include("dark.jl")
include("ggplot2.jl")
Expand All @@ -50,8 +49,7 @@ include("dao.jl")
include("dracula.jl")
include("rose_pine.jl")


const _themes = Dict{Symbol, PlotTheme}([
const _themes = Dict{Symbol,PlotTheme}([
:default => PlotTheme(),
:dao => _dao,
:dark => _dark,
Expand All @@ -72,14 +70,9 @@ const _themes = Dict{Symbol, PlotTheme}([
:orange => _orange,
:dracula => _dracula,
:rose_pine => _rose_pine,
:rose_pine_dawn => _rose_pine_dawn

:rose_pine_dawn => _rose_pine_dawn,
])


function add_theme(s::Symbol, thm::PlotTheme)
_themes[s] = thm
end

add_theme(s::Symbol, thm::PlotTheme) = _themes[s] = thm

end # module
37 changes: 21 additions & 16 deletions PlotThemes/src/boxed.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
const _boxed = PlotTheme(Dict([
:minorticks => true,
:grid => false,
:frame => :box,
:guidefontvalign => :top,
:guidefonthalign => :right,
:foreground_color_legend => nothing,
:legendfontsize => 9,
:legend => :topright,
:xlim => (:auto,:auto),
:ylim => (:auto,:auto),
:label => "",
:palette => expand_palette(colorant"white", [RGB(0,0,0); wong_palette];
lchoices = [57],
cchoices = [100])
]))
const _boxed = PlotTheme(
Dict([
:minorticks => true,
:grid => false,
:frame => :box,
:guidefontvalign => :top,
:guidefonthalign => :right,
:foreground_color_legend => nothing,
:legendfontsize => 9,
:legend => :topright,
:xlim => (:auto, :auto),
:ylim => (:auto, :auto),
:label => "",
:palette => expand_palette(
colorant"white",
[RGB(0, 0, 0); wong_palette];
lchoices = [57],
cchoices = [100],
),
]),
)
40 changes: 21 additions & 19 deletions PlotThemes/src/dao.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,27 @@ const dao_palette = [
colorant"#707070",
colorant"#21ab74",
colorant"#ba3030",
colorant"#9467bd"
colorant"#9467bd",
]

const _dao = PlotTheme(Dict([
:background => :white,
:framestyle => :box,
:grid => true,
:gridalpha => 0.4,
:linewidth => 1.4,
:markerstrokewidth => 0,
:fontfamily => "Computer Modern",
:colorgradient => :magma,
:guidefontsize => 12,
:titlefontsize => 12,
:tickfontsize => 8,
:palette => dao_palette,
:minorgrid => true,
:minorticks => 5,
:gridlinewidth => 0.7,
:minorgridalpha => 0.06,
:legend => :outertopright])
const _dao = PlotTheme(
Dict([
:background => :white,
:framestyle => :box,
:grid => true,
:gridalpha => 0.4,
:linewidth => 1.4,
:markerstrokewidth => 0,
:fontfamily => "Computer Modern",
:colorgradient => :magma,
:guidefontsize => 12,
:titlefontsize => 12,
:tickfontsize => 8,
:palette => dao_palette,
:minorgrid => true,
:minorticks => 5,
:gridlinewidth => 0.7,
:minorgridalpha => 0.06,
:legend => :outertopright,
]),
)
29 changes: 16 additions & 13 deletions PlotThemes/src/dark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,23 @@ const dark_palette = [
colorant"#FE4365", # red
colorant"#eca25c", # orange
colorant"#3f9778", # green
colorant"#005D7F" # blue
colorant"#005D7F", # blue
]
const dark_bg = colorant"#363D46"

const _dark = PlotTheme(Dict([
:bg => dark_bg,
:bginside => colorant"#30343B",
:fg => colorant"#ADB2B7",
:fgtext => colorant"#FFFFFF",
:fgguide => colorant"#FFFFFF",
:fglegend => colorant"#FFFFFF",
:legendfontcolor => colorant"#FFFFFF",
:legendtitlefontcolor => colorant"#FFFFFF",
:titlefontcolor => colorant"#FFFFFF",
:palette => expand_palette(dark_bg, dark_palette; lchoices = [57], cchoices = [100]),
:colorgradient => :fire])
const _dark = PlotTheme(
Dict([
:bg => dark_bg,
:bginside => colorant"#30343B",
:fg => colorant"#ADB2B7",
:fgtext => colorant"#FFFFFF",
:fgguide => colorant"#FFFFFF",
:fglegend => colorant"#FFFFFF",
:legendfontcolor => colorant"#FFFFFF",
:legendtitlefontcolor => colorant"#FFFFFF",
:titlefontcolor => colorant"#FFFFFF",
:palette =>
expand_palette(dark_bg, dark_palette; lchoices = [57], cchoices = [100]),
:colorgradient => :fire,
]),
)
26 changes: 14 additions & 12 deletions PlotThemes/src/dracula.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ const dracula_palette = [
const dracula_bg = colorant"#282a36"
const dracula_fg = colorant"#f8f8f2"

const _dracula = PlotTheme(Dict([
:bg => dracula_bg,
:bginside => colorant"#30343B",
:fg => dracula_fg,
:fgtext => dracula_fg,
:fgguide => dracula_fg,
:fglegend => dracula_fg,
:legendfontcolor => dracula_fg,
:legendtitlefontcolor => dracula_fg,
:titlefontcolor => dracula_fg,
:palette => expand_palette(dracula_bg, dracula_palette),
:colorgradient => :viridis])
const _dracula = PlotTheme(
Dict([
:bg => dracula_bg,
:bginside => colorant"#30343B",
:fg => dracula_fg,
:fgtext => dracula_fg,
:fgguide => dracula_fg,
:fglegend => dracula_fg,
:legendfontcolor => dracula_fg,
:legendtitlefontcolor => dracula_fg,
:titlefontcolor => dracula_fg,
:palette => expand_palette(dracula_bg, dracula_palette),
:colorgradient => :viridis,
]),
)
67 changes: 34 additions & 33 deletions PlotThemes/src/ggplot2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,40 @@
const _ggplot_colors = Dict(
:gray92 => RGB(fill(0.92, 3)...),
:gray20 => RGB(fill(0.2, 3)...),
:gray30 => RGB(fill(0.3, 3)...)
)

:gray30 => RGB(fill(0.3, 3)...),
)

const _ggplot2 = PlotTheme(Dict([
## Background etc
:bg => :white,
:bginside => _ggplot_colors[:gray92],
:bglegend => _ggplot_colors[:gray92],
:fglegend => :white,
:fgguide => :black,
:widen=>true,
## Axes / Ticks
#framestyle => :grid,
#foreground_color_tick => _ggplot_colors[:gray20], # tick color not yet implemented
:foreground_color_axis => _ggplot_colors[:gray20], # tick color
:tick_direction=>:out,
:foreground_color_border =>:white, # axis color
:foreground_color_text => _ggplot_colors[:gray30], # tick labels
:gridlinewidth => 1,
#tick label size => *0.8,
### Grid
:foreground_color_grid => :white,
:gridalpha => 1,
### Minor Grid
:minorgrid => true,
:minorgridalpha => 1,
:minorgridlinewidth=>0.5, # * 0.5
:foreground_color_minor_grid=>:white,
#foreground_color_minortick=>:white, ## not yet implemented
:minorticks => 2,
## Lines and markers
:markerstrokealpha => 0,
:markerstrokewidth => 0 ])
const _ggplot2 = PlotTheme(
Dict([
## Background etc
:bg => :white,
:bginside => _ggplot_colors[:gray92],
:bglegend => _ggplot_colors[:gray92],
:fglegend => :white,
:fgguide => :black,
:widen => true,
## Axes / Ticks
#framestyle => :grid,
#foreground_color_tick => _ggplot_colors[:gray20], # tick color not yet implemented
:foreground_color_axis => _ggplot_colors[:gray20], # tick color
:tick_direction => :out,
:foreground_color_border => :white, # axis color
:foreground_color_text => _ggplot_colors[:gray30], # tick labels
:gridlinewidth => 1,
#tick label size => *0.8,
### Grid
:foreground_color_grid => :white,
:gridalpha => 1,
### Minor Grid
:minorgrid => true,
:minorgridalpha => 1,
:minorgridlinewidth => 0.5, # * 0.5
:foreground_color_minor_grid => :white,
#foreground_color_minortick=>:white, ## not yet implemented
:minorticks => 2,
## Lines and markers
:markerstrokealpha => 0,
:markerstrokewidth => 0,
]),
#showaxis=> :false
)
Loading

0 comments on commit b1ea6c8

Please sign in to comment.