Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various ticks fixes (precision, log scale) #124

Merged
merged 9 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
always_for_in = true
import_to_using = false
align_pair_arrow = true
align_assignment = true
align_conditional = true
always_use_return = false
conditional_to_if = false
whitespace_in_kwargs = true
remove_extra_newlines = true
whitespace_ops_in_indices = true
short_to_long_function_def = false
annotate_untyped_fields_with_any = false
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ jobs:
fail-fast: false
matrix:
version:
- '1.0'
- '1'
- 'nightly'
- '1.6' # LTS
- '1.7' # latest stable
os:
- ubuntu-latest
- windows-latest
- macos-latest
arch:
- x64
- x86
# - x86
include:
- version: 'nightly'
os: ubuntu-latest

steps:

Expand All @@ -55,7 +57,7 @@ jobs:

# Run tests
- name: Run Graphical test
run: julia --project -e 'using Pkg; Pkg.test(coverage=true);'
run: julia --project -e 'using Pkg; Pkg.test(coverage=true)'

# - name: Codecov
# uses: julia-actions/julia-uploadcodecov@latest
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/format_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: format-pr

on:
schedule:
- cron: '0 0 * * SUN'

jobs:
build:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; pkg"add JuliaFormatter"'
julia -e 'using JuliaFormatter; [format(["src", "test"]) for _ in 1:2]'
git diff --exit-code

- name: Create Pull Request
if: ${{ failure() }}
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Format .jl files [skip ci]"
title: 'Automatic JuliaFormatter.jl run'
branch: auto-juliaformatter-pr
delete-branch: true
labels: formatting, automated pr, no changelog

- name: Check outputs
if: ${{ failure() }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "PlotUtils"
uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043"
version = "1.0.15"
version = "1.1.0"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Expand All @@ -15,7 +15,7 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
ColorSchemes = "3.8"
Colors = "0.12"
Reexport = "0.2, 1.0"
julia = "1"
julia = "1.6"

[extras]
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Expand Down
3 changes: 0 additions & 3 deletions REQUIRE

This file was deleted.

43 changes: 0 additions & 43 deletions appveyor.yml

This file was deleted.

17 changes: 4 additions & 13 deletions src/color_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ const _lightness_darkbg = [80.0]
const _lightness_lightbg = [60.0]
const _lch_c_const = [60]

function adjust_lch(color, l, c)
lch = convert(LCHab, color)
convert(RGBA{Float64}, LCHab(l, c, lch.h))
end
adjust_lch(color, l, c) = convert(RGBA{Float64}, LCHab(l, c, convert(LCHab, color).h))

function lightness_from_background(bgcolor)
bglight = convert(LCHab, bgcolor).l
Expand Down Expand Up @@ -82,9 +79,7 @@ function darken(c, v=0.1)
b = max(0, min(rgba.b - v, 1))
RGBA(r,g,b,rgba.alpha)
end
function lighten(c, v=0.3)
darken(c, -v)
end
lighten(c, v=0.3) = darken(c, -v)

# borrowed from http://stackoverflow.com/a/1855903:
lightness_level(c::Colorant) = 0.299 * red(c) + 0.587 * green(c) + 0.114 * blue(c)
Expand All @@ -93,16 +88,12 @@ isdark(c::Colorant) = lightness_level(c) < 0.5
islight(c::Colorant) = !isdark(c)


function Base.convert(::Type{RGB}, h::Unsigned)
mask = 0x0000FF
RGB([(x & mask) / 0xFF for x in (h >> 16, h >> 8, h)]...)
end
Base.convert(::Type{RGB}, h::Unsigned) = RGB([(x & 0x0000FF) / 0xFF for x in (h >> 16, h >> 8, h)]...)

make255(x) = round(Int, 255 * x)

function rgb_string(c::Colorant)
rgb_string(c::Colorant) =
@sprintf("rgb(%d, %d, %d)", make255(red(c)), make255(green(c)), make255(blue(c)))
end

function rgba_string(c::Colorant)
@sprintf(
Expand Down
Loading