Skip to content

Commit

Permalink
add codespell action and correct spelling errors (#5011)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg authored Nov 1, 2024
1 parent bb14fd5 commit 8119dac
Show file tree
Hide file tree
Showing 28 changed files with 73 additions and 60 deletions.
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: benchmarks
on:
workflow_dispatch:
pull_request:
branches: [master]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: codespell

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
ignore_words_list: nd,nax,linez,ist
only_warn: 0
12 changes: 6 additions & 6 deletions GraphRecipes/src/graph_layouts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function shell_graph(
kw...,
)
@assert dim == 2
positions = NetworkLayout.shell(adjmat; nlist = nlist)
positions = NetworkLayout.shell(adjmat; nlist)

([p[1] for p positions], [p[2] for p positions], nothing)
end
Expand Down Expand Up @@ -234,16 +234,16 @@ function by_axis_local_stress_graph(
for k 1:maxiter
for p free_dims
for i 1:n
numer, denom = 0.0, 0.0
num, den = 0.0, 0.0
for j 1:n
i == j && continue
numer +=
num +=
w[i, j] *
(X[p][j] + dist[i, j] * (X[p][i] - X[p][j]) / norm_ij(X, i, j))
denom += w[i, j]
den += w[i, j]
end
if denom != 0
X[p][i] = numer / denom
if den != 0
X[p][i] = num / den
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import GR # loads backend code
- stephist logscale improvements
## 0.25.2
- improvements to handle missings
- improvements to handle `missing`s
- pyplot: allow setting the color gradient for z values
- document :colorbar_entry
- limit number of automatic bins
Expand Down Expand Up @@ -162,7 +162,7 @@ import GR # loads backend code
- implement guide position in gr, pyplot and pgfplots
- inspectdr fixes
- default appveyor
- rudimentary missings support
- rudimentary `missing`s support
- deprecation fixes for PGFPlots
## 0.20.0
Expand Down Expand Up @@ -568,7 +568,7 @@ Many updates, min julia 1.0
- GR:
- manually draw 2D axes... fixes several issues and missing features
- fontsize fix
- PGFPlots: pass axis syle
- PGFPlots: pass axis style
#### 0.8.0
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/ext/GRExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2187,7 +2187,7 @@ function gr_z_normalized_log_scaled(scale, z, clims)
any(x -> !isfinite(x), loglims) && throw(
DomainError(
loglims,
"Non-finite value in colorbar limits. Please provide explicits limits via `clims`.",
"Non-finite value in colorbar limits. Please provide explicit limits via `clims`.",
),
)
z_log, get_z_normalized.(z_log, loglims...)
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/ext/GastonExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ function gaston_parse_axes_attrs(
# guide labels
guide_font = guidefont(axis)
if letter :y && dims == 2
# vertical by default (consistency witht other backends)
# vertical by default (consistency with other backends)
guide_font = font(guide_font; rotation = guide_font.rotation + 90)
end
push!(
Expand Down
4 changes: 2 additions & 2 deletions PlotsBase/src/Commons/attrs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -957,13 +957,13 @@ end
@attributes function process_font_attr!(plotattributes::AKW, fontname::Symbol, arg)
T = typeof(arg)
if fontname in (:legend_font,)
# TODO: this is neccessary while old and new font names coexist and should be standard after the transition
# TODO: this is necessary while old and new font names coexist and should be standard after the transition
fontname = Symbol(fontname, :_)
end
if T <: PlotsBase.Font
Symbol(fontname, :family) --> arg.family

# TODO: this is neccessary in the transition from old fontsize to new font_pointsize and should be removed when it is completed
# TODO: this is necessary in the transition from old fontsize to new font_pointsize and should be removed when it is completed
if in(Symbol(fontname, :size), _all_attrs)
Symbol(fontname, :size) --> arg.pointsize
else
Expand Down
4 changes: 2 additions & 2 deletions PlotsBase/src/arg_desc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ const _arg_desc = KW(
:foreground_color_title => (ColorType, "Color of subplot title (`:match` matches :foreground_color_subplot`)."),
:color_palette => (Union{AVec{ColorType},Symbol}, "Iterable (cycle through) or color gradient (generate list from gradient) or `:auto` (generate a color list using `Colors.distiguishable_colors` and custom seed colors chosen to contrast with the background). The color palette is a color list from which series colors are automatically chosen."),
:legend_position => (Union{Bool,NTuple{2,Real},Symbol}, """
Show the legend ? Can also be a (x,y) tuple or Symbol (legend position) or angle (angle,inout) tuple. Bottom left corner of legend is placed at (x,y).
Show the legend ? Can also be a (x,y) tuple or Symbol (legend position) or angle (angle,in-out) tuple. Bottom left corner of legend is placed at (x,y).
Choose from (`:none`, `:best`, `:inline`, `:inside`, `:legend`) or any valid combination of `:(outer ?)(top/bottom ?)(right/left ?)`, i.e.: `:top`, `:topright`, `:outerleft`, `:outerbottomright` ... (note: only some may be supported in each backend)."""),
:legend_column => (Integer, "Number of columns in the legend. `-1` stands for maximum number of colums (horizontal legend)."),
:legend_column => (Integer, "Number of columns in the legend. `-1` stands for maximum number of columns (horizontal legend)."),
:legend_title_font => (Font, "Font of the legend title."),
:legend_font_family => (Union{AStr,Symbol}, "Font family of legend entries."),
:legend_font_pointsize => (Integer, "Font pointsize of legend entries."),
Expand Down
4 changes: 2 additions & 2 deletions PlotsBase/src/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ const _examples = PlotExample[
"Custom Markers",
"""A `PlotsBase.Shape` is a light wrapper around vertices of a polygon. For supported
backends, pass arbitrary polygons as the marker shapes. Note: The center is (0,0) and
the size is expected to be rougly the area of the unit circle.
the size is expected to be roughly the area of the unit circle.
""",
quote
verts = [
Expand Down Expand Up @@ -1308,7 +1308,7 @@ _backend_skips = Dict(
31, # animations - needs github.com/mbaz/Gaston.jl/pull/178
49, # TODO: support polar
60, # :perspective projection unsupported
63, # FXIME: twin axes misalignement
63, # FXIME: twin axes misalignment
],
)
_backend_skips[:plotly] = _backend_skips[:plotlyjs]
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/src/layouts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function build_layout(layout::GridLayout, n::Integer, plts::AVec{Plot})
merge!(spmap, m)
i += length(sps)
elseif isa(l, Subplot) && empty
error("Subplot exists. Cannot re-use existing layout. Please make a new one.")
error("Subplot exists. Cannot reuse existing layout. Please make a new one.")
end
i n && break # only add n subplots
end
Expand Down
12 changes: 6 additions & 6 deletions PlotsBase/src/plotly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ function plotly_layout(plt::Plot)

for sp plt.subplots
spidx = multiple_subplots ? sp[:subplot_index] : ""
x_idx, y_idx = multiple_subplots ? plotly_link_indicies(plt, sp) : ("", "")
x_idx, y_idx = multiple_subplots ? plotly_link_indices(plt, sp) : ("", "")

# add an annotation for the title
if sp[:title] != ""
Expand Down Expand Up @@ -646,8 +646,8 @@ get_plotly_marker(k, def) = get(
def,
)

# find indicies of axes to which the subplot links to
function plotly_link_indicies(plt::Plot, sp::Subplot)
# find indices of axes to which the subplot links to
function plotly_link_indices(plt::Plot, sp::Subplot)
if plt[:link] in (:x, :y, :both)
x_idx = sp[:xaxis].sps[1][:subplot_index]
y_idx = sp[:yaxis].sps[1][:subplot_index]
Expand All @@ -657,7 +657,7 @@ function plotly_link_indicies(plt::Plot, sp::Subplot)
x_idx, y_idx
end

# the Shape contructor will automatically close the shape. since we need it closed,
# the Shape constructor will automatically close the shape. since we need it closed,
# we split by NaNs and then construct/destruct the shapes to get the closed coords
function plotly_close_shapes(x, y)
xs, ys = nansplit(x), nansplit(y)
Expand Down Expand Up @@ -735,7 +735,7 @@ function plotly_series(plt::Plot, series::Series)
plotattributes_out[:zaxis] = "z$spidx"
plotattributes_out[:scene] = "scene$spidx"
else
x_idx, y_idx = length(plt.subplots) > 1 ? plotly_link_indicies(plt, sp) : ("", "")
x_idx, y_idx = length(plt.subplots) > 1 ? plotly_link_indices(plt, sp) : ("", "")
plotattributes_out[:xaxis] = "x$(x_idx)"
plotattributes_out[:yaxis] = "y$(y_idx)"
end
Expand Down Expand Up @@ -940,7 +940,7 @@ function plotly_series_shapes(plt::Plot, series::Series, clims)
# x, y = series[:x], series[:y]

# these are the axes that the series should be mapped to
x_idx, y_idx = plotly_link_indicies(plt, series[:subplot])
x_idx, y_idx = plotly_link_indices(plt, series[:subplot])
plotattributes_base = KW(
:xaxis => "x$(x_idx)",
:yaxis => "y$(y_idx)",
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/src/recipes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ end
# Error Bars

Commons.@attributes function error_style!(plotattributes::AKW)
# errorbar color should soley determined by markerstrokecolor
# errorbar color should solely determined by markerstrokecolor
haskey(plotattributes, :marker_z) &&
RecipesPipeline.reset_kw!(plotattributes, :marker_z)
haskey(plotattributes, :line_z) && RecipesPipeline.reset_kw!(plotattributes, :line_z)
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/src/shorthands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ for letter ∈ ("x", "y", "z")
$($letter)error(x, y [, z]; $($letter)error = vals)
$($letter)error!(x, y [, z]; $($letter)error = vals)
Create or add a series of $($letter)errorbars at the positions defined by `x`, `y` and `z` with the lenghts defined in `vals`.
Create or add a series of $($letter)errorbars at the positions defined by `x`, `y` and `z` with the lengths defined in `vals`.
Markerstrokecolor will color the whole errorbars if not specified otherwise.
"""
Expand Down
8 changes: 4 additions & 4 deletions PlotsBase/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function heatmap_edges(
)
nx, ny = length(x), length(y)
# ismidpoints = z_size == (ny, nx) # This fails some tests, but would actually be
# the correct check, since (4, 3) != (3, 4) and a missleading plot is produced.
# the correct check, since (4, 3) != (3, 4) and a misleading plot is produced.
ismidpoints = prod(z_size) == (ny * nx)
isedges = z_size == (ny - 1, nx - 1)
(ismidpoints || isedges) ||
Expand Down Expand Up @@ -696,7 +696,7 @@ __straightline_data(xl, yl, x, y, exp_fact) =
___straightline_data(xl, yl, x, y, exp_fact)
else
k, r = divrem(n, 3)
@assert r == 0 "Misformed data. `straightline_data` either accepts vectors of length 2 or 3k. The provided series has length $n"
@assert r == 0 "Malformed data. `straightline_data` either accepts vectors of length 2 or 3k. The provided series has length $n"
xdata, ydata = fill(NaN, n), fill(NaN, n)
for i 1:k
inds = (3i - 2):(3i - 1)
Expand Down Expand Up @@ -883,8 +883,8 @@ end
# Function barrier because lims are type-unstable
function _guess_best_legend_position(xl, yl, plt, weight = 100)
scale = (maximum(xl) - minimum(xl), maximum(yl) - minimum(yl))
u = zeros(4) # faster than tuple
# Quadrants where the points will be tested
u = zeros(4) # faster than tuple
# quadrants where the points will be tested
quadrants = (
((0.00, 0.25), (0.00, 0.25)), # bottomleft
((0.75, 1.00), (0.00, 0.25)), # bottomright
Expand Down
2 changes: 1 addition & 1 deletion PlotsBase/test/test_misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ with(:gr) do
p4 = [0.5, 0.5, 1.0]
pts = [p0, p1, p2, p3, p4]
x, y, z = broadcast(i -> getindex.(pts, i), (1, 2, 3))
# [x[i],y[i],z[i]] is the i-th vertix of the mesh
# [x[i],y[i],z[i]] is the i-th vertex of the mesh
mesh3d(
x,
y,
Expand Down
4 changes: 2 additions & 2 deletions PlotsBase/test/test_pgfplotsx.jl
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,8 @@ with(:pgfplotsx) do
@testset "Latexify - LaTeXStrings" begin
@test PlotsBase.pgfx_sanitize_string("A string, with 2 punctuation chars.") ==
"A string, with 2 punctuation chars."
@test PlotsBase.pgfx_sanitize_string("Interpolação polinomial") ==
raw"Interpola$\textnormal{\c{c}}$$\tilde{a}$o polinomial"
@test PlotsBase.pgfx_sanitize_string("Interpolação polynomial") ==
raw"Interpola$\textnormal{\c{c}}$$\tilde{a}$o polynomial"
@test PlotsBase.pgfx_sanitize_string("∫∞ ∂x") == raw"$\int$$\infty$ $\partial$x"

# special LaTeX characters
Expand Down
2 changes: 1 addition & 1 deletion RecipesPipeline/src/user_recipe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Wrap input arguments in a `RecipeData' vector and recursively apply user recipes and type
recipes on the first element. Prepend the returned `RecipeData` vector. If an element with
empy `args` is returned pop it from the vector, finish up, and it to vector of `Dict`s with
empty `args` is returned pop it from the vector, finish up, and it to vector of `Dict`s with
processed series. When all arguments are processed return the series `Dict`.
"""
function _process_userrecipes!(plt, plotattributes, args)
Expand Down
8 changes: 4 additions & 4 deletions StatsPlots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,11 @@ The `group` syntax is also possible in combination with `groupedbar`:

```julia
ctg = repeat(["Category 1", "Category 2"], inner = 5)
nam = repeat("G" .* string.(1:5), outer = 2)
name = repeat("G" .* string.(1:5), outer = 2)

groupedbar(nam, rand(5, 2), group = ctg, xlabel = "Groups", ylabel = "Scores",
title = "Scores by group and category", bar_width = 0.67,
lw = 0, framestyle = :box)
groupedbar(name, rand(5, 2), group = ctg, xlabel = "Groups", ylabel = "Scores",
title = "Scores by group and category", bar_width = 0.67,
lw = 0, framestyle = :box)
```

![](https://user-images.githubusercontent.com/6645258/32116755-b7018f02-bb2a-11e7-82c7-ca471ecaeecf.png)
Expand Down
19 changes: 7 additions & 12 deletions StatsPlots/src/hist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ PlotsBase.wand_edges(x::AbstractVector, args...) = (binwidth = wand_bins(x, args
(minimum(x) - binwidth):binwidth:(maximum(x) + binwidth))

"Returns optimal histogram bin widths in accordance to Wand (1995)'s criterion'"
function wand_bins(x, scalest = :minim, gridsize = 401, range_x = extrema(x), trun = true)
function wand_bins(x, scalest = :minim, gridsize = 401, range_x = extrema(x), t_run = true)
n = length(x)
minx, maxx = range_x
gpoints = range(minx, stop = maxx, length = gridsize)
gcounts = linbin(x, gpoints, trun = trun)
gcounts = linbin(x, gpoints; t_run)

scalest = if scalest === :stdev
sqrt(var(x))
Expand All @@ -156,7 +156,7 @@ function wand_bins(x, scalest = :minim, gridsize = 401, range_x = extrema(x), tr
sb = (maxx - mean(x)) / scalest

gpoints = range(sa, stop = sb, length = gridsize)
gcounts = linbin(sx, gpoints, trun = trun)
gcounts = linbin(sx, gpoints; t_run)

hpi = begin
alpha = ((2 / (11 * n))^(1 / 13)) * sqrt(2)
Expand All @@ -175,7 +175,7 @@ function wand_bins(x, scalest = :minim, gridsize = 401, range_x = extrema(x), tr
scalest * hpi
end

function linbin(X, gpoints; trun = true)
function linbin(X, gpoints; t_run = true)
n, M = length(X), length(gpoints)

a, b = gpoints[1], gpoints[M]
Expand All @@ -192,14 +192,9 @@ function linbin(X, gpoints; trun = true)
gcnts[li + 1] += rem
end

if !trun
if lt < 1
gcnts[1] += 1
end

if li >= M
gcnts[M] += 1
end
if !t_run
lt < 1 && (gcnts[1] += 1)
li M && (gcnts[M] += 1)
end
end
gcnts
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ function generate_graph_attr_markdown()
"Font size for the node labels and the edge labels.",
"Shape of the nodes, choose from `:hexagon`, `:circle`, `:ellipse`, `:rect` or `:rectangle`.",
"The size of nodes in the plot coordinates. Note that if `names` is not empty, then nodes will be scaled to fit the labels inside them.",
"The color of the nodes. If `nodecolor` is an integer, then it will be taken from the current color pallette. Otherwise, the user can pass any color that would be recognised by the Plots `color` attribute.",
"The color of the nodes. If `nodecolor` is an integer, then it will be taken from the current color palette. Otherwise, the user can pass any color that would be recognised by the Plots `color` attribute.",
"The coordinates of the nodes.",
"The method that GraphRecipes uses to produce an optimal layout, choose from `:spectral`, `:sfdp`, `:circular`, `:shell`, `:stress`, `:spring`, `:tree`, `:buchheim`, `:arcdiagram` or `:chorddiagram`. See [NetworkLayout](https://github.com/JuliaGraphs/NetworkLayout.jl) for further details.",
"A layout algorithm that can be passed in by the user.",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/GraphRecipes/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GraphRecipes can be installed with the package manager:
```

## Usage
The main user interface is through the fuction `graphplot`:
The main user interface is through the function `graphplot`:
```@example graphintro
using GraphRecipes, Plots
Expand Down
2 changes: 1 addition & 1 deletion docs/src/RecipesBase/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ seriespie(rand(4, 2), layout = 2)
## Remarks

Plot recipes and series recipes are actually very similar.
In fact, a pie recipe could be also implemented as a plot recipe by acessing the data through `plotattributes`.
In fact, a pie recipe could be also implemented as a plot recipe by accessing the data through `plotattributes`.

```@example types
@recipe function f(::Type{Val{:plotpie}}, plt::AbstractPlot)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ plotattr(:Subplot)
plotattr(:Axis)
```

Once you acquire the list of attributes, you can either use the aliases of a specific attribute or investigate a specific attribut to print that attribute's aliases and its description.
Once you acquire the list of attributes, you can either use the aliases of a specific attribute or investigate a specific attribute to print that attribute's aliases and its description.

```@repl attr
# Specific Attribute Example
Expand Down
4 changes: 2 additions & 2 deletions docs/src/backends.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ Pros:
- Drag & drop &Delta;-markers (measure/display &Delta;x, &Delta;y & slope).
- Designed with larger datasets in mind.
- Responsive even with moderate (>200k points) datasets.
- Confirmed to handle 2GB datsets with reasonable speed on older desktop running Windows 7 (drag+pan of data area highly discouraged).
- Confirmed to handle 2GB datasets with reasonable speed on older desktop running Windows 7 (drag+pan of data area highly discouraged).

Cons:

Expand Down Expand Up @@ -509,7 +509,7 @@ Primary author: Tim Holy

### [Qwt](https://github.com/tbreloff/Qwt.jl)

My package which wraps PyQwt. Similar to PyPlot, it uses PyCall to convert calls to python. Though Qwt.jl was the "first draft" of Plots, the functionality is superceded by other backends, and it's not worth my time to maintain.
My package which wraps PyQwt. Similar to PyPlot, it uses PyCall to convert calls to python. Though Qwt.jl was the "first draft" of Plots, the functionality is supersded by other backends, and it's not worth my time to maintain.

Primary author: Thomas Breloff

Expand Down
Loading

0 comments on commit 8119dac

Please sign in to comment.