Skip to content

Commit

Permalink
fix GraphRecipes and StatsPlots
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Nov 13, 2024
1 parent ef50737 commit b02abd6
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 38 deletions.
8 changes: 5 additions & 3 deletions GraphRecipes/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "GraphRecipes"
uuid = "bd48cda9-67a9-57be-86fa-5b3c104eda73"
version = "1.0"
version = "1.0.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand All @@ -12,6 +12,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a"
PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043"
PlotsBase = "c52230a3-c5da-43a3-9e85-260fcdfdc737"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Expand All @@ -29,17 +30,18 @@ Statistics = "1"
julia = "1.10"

[extras]
GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
Gtk = "4c0ca9eb-093a-5379-98c5-f87ac0bbbf44"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PlotsBase = "c52230a3-c5da-43a3-9e85-260fcdfdc737"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92"

[targets]
test = ["Gtk", "ImageMagick", "LinearAlgebra", "Logging", "Markdown", "Plots", "Random", "SparseArrays", "StableRNGs", "Test", "VisualRegressionTests"]
test = ["Gtk", "GR", "ImageMagick", "LinearAlgebra", "Logging", "Markdown", "PlotsBase", "Random", "SparseArrays", "StableRNGs", "Test", "VisualRegressionTests"]
4 changes: 3 additions & 1 deletion GraphRecipes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ For a given graph, there are many legitimate ways to display and visualize the g
## An example
```julia
using GraphRecipes
using Plots
using PlotsBase

import GR; gr()

g = [0 1 1;
1 0 1;
Expand Down
2 changes: 1 addition & 1 deletion GraphRecipes/src/graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ more details.
end

@series begin
@debug num_edges_nodes := (length(edges_list[1]), length(node_vec_vec_xy)) # for debugging / tests
# @debug num_edges_nodes := (length(edges_list[1]), length(node_vec_vec_xy)) # for debugging / tests

seriestype := if method in (:tree, :buchheim, :chorddiagram)
:curves
Expand Down
8 changes: 4 additions & 4 deletions GraphRecipes/src/trees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Wrap a tree-like object for plotting. Uses `AbstractTrees.children()` to recursi
```julia
using AbstractTrees, GraphRecipes
AbstractTrees.children(d::Dict) = [p for p in d]
AbstractTrees.children(p::Pair) = AbstractTrees.children(p[2])
function AbstractTrees.printnode(io::IO, p::Pair)
str = isempty(AbstractTrees.children(p[2])) ? string(p[1], ": ", p[2]) : string(p[1], ": ")
@eval AbstractTrees children(d::AnstractDict) = [p for p in d]
@eval AbstractTrees children(p::Pair) = AbstractTrees.children(p[2])
@eval AbstractTrees function printnode(io::IO, p::Pair)
str = isempty(children(p[2])) ? string(p[1], ": ", p[2]) : string(p[1], ": ")
print(io, str)
end
Expand Down
14 changes: 5 additions & 9 deletions GraphRecipes/test/functions.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using Plots
using StableRNGs
using GraphRecipes
using GraphRecipes.Colors
using GraphRecipes.AbstractTrees

function random_labelled_graph()
n = 15
rng = StableRNG(1)
Expand Down Expand Up @@ -172,11 +168,11 @@ julia_type_tree() = plot(
rng = StableRNG(1),
)

AbstractTrees.children(d::Dict) = [p for p d]
AbstractTrees.children(p::Pair) = AbstractTrees.children(p[2])
function AbstractTrees.printnode(io::IO, p::Pair)
@eval AbstractTrees children(d::AbstractDict) = [p for p d]
@eval AbstractTrees children(p::Pair) = AbstractTrees.children(p[2])
@eval AbstractTrees function printnode(io::IO, p::Pair)
str =
isempty(AbstractTrees.children(p[2])) ? string(p[1], ": ", p[2]) :
isempty(children(p[2])) ? string(p[1], ": ", p[2]) :
string(p[1], ": ")
print(io, str)
end
Expand Down
3 changes: 1 addition & 2 deletions GraphRecipes/test/parse_readme.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Markdown
using GraphRecipes
using Plots
using Markdown

cd(@__DIR__)

Expand Down
1 change: 0 additions & 1 deletion GraphRecipes/test/pkg_deps.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

module PkgDeps

using GraphRecipes
Expand Down
8 changes: 5 additions & 3 deletions GraphRecipes/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
using VisualRegressionTests
using AbstractTrees
using LinearAlgebra
using Logging
using GraphRecipes.AbstractTrees
using GraphRecipes.Colors
using GraphRecipes
using SparseArrays
using ImageMagick
using StableRNGs
using PlotsBase
using Logging
using Graphs
using Plots
using Test
using Gtk # for popup

import Plots: PlotsBase
import GR; gr()

isci() = get(ENV, "CI", "false") == "true"
itol(tol = nothing) = something(tol, isci() ? 1e-3 : 1e-5)
Expand Down
9 changes: 5 additions & 4 deletions StatsPlots/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "StatsPlots"
uuid = "f3b207a7-027a-5e70-b257-86293d7955fd"
version = "1.0"
version = "1.0.0"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand All @@ -13,7 +13,7 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MultivariateStats = "6f286f6a-111f-5878-ab1e-185364afe411"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
Observables = "510215fc-4207-5dde-b226-833fc4488ee2"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PlotsBase = "c52230a3-c5da-43a3-9e85-260fcdfdc737"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
RecipesPipeline = "01d81517-befc-4cb6-b9ec-a95719d0359c"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Expand All @@ -32,7 +32,6 @@ KernelDensity = "0.6"
MultivariateStats = "0.10"
NaNMath = "1"
Observables = "0.5"
Plots = "2"
RecipesBase = "1"
RecipesPipeline = "1"
Reexport = "1"
Expand All @@ -43,9 +42,11 @@ Widgets = "0.6"
julia = "1.10"

[extras]
GR = "28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71"
NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
PlotsBase = "c52230a3-c5da-43a3-9e85-260fcdfdc737"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "NaNMath", "StableRNGs"]
test = ["NaNMath", "GR", "PlotsBase", "StableRNGs", "Test"]
4 changes: 2 additions & 2 deletions StatsPlots/src/StatsPlots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import RecipesBase: recipetype
import Tables
import TableOperations
using RecipesPipeline
@reexport using Plots
import Plots.PlotsBase.Commons: _cycle
@reexport using PlotsBase
import PlotsBase.Commons: _cycle
using StatsBase
using Distributions
using LinearAlgebra: eigen, diagm
Expand Down
2 changes: 1 addition & 1 deletion StatsPlots/src/boxplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ notch_width(q2, q4, N) = 1.58 * (q4 - q2) / sqrt(N)
[getindex(x, plotattributes[:series_plotindex])]
end
end
xsegs, ysegs = Plots.PlotsBase.Segments(), Plots.PlotsBase.Segments()
xsegs, ysegs = PlotsBase.Segments(), PlotsBase.Segments()
texts = String[]
glabels = sort(collect(unique(x)))
warning = false
Expand Down
6 changes: 3 additions & 3 deletions StatsPlots/src/violin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ get_quantiles(n::Int) = range(0, 1, length = n + 2)[2:(end - 1)]
[getindex(x, plotattributes[:series_plotindex])]
end
end
xsegs, ysegs = Plots.PlotsBase.Segments(), Plots.PlotsBase.Segments()
qxsegs, qysegs = Plots.PlotsBase.Segments(), Plots.PlotsBase.Segments()
mxsegs, mysegs = Plots.PlotsBase.Segments(), Plots.PlotsBase.Segments()
xsegs, ysegs = PlotsBase.Segments(), PlotsBase.Segments()
qxsegs, qysegs = PlotsBase.Segments(), PlotsBase.Segments()
mxsegs, mysegs = PlotsBase.Segments(), PlotsBase.Segments()
glabels = sort(collect(unique(x)))
bw = plotattributes[:bar_width]
bw == nothing && (bw = 0.8)
Expand Down
8 changes: 4 additions & 4 deletions StatsPlots/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ using Distributions
using StatsPlots
using StableRNGs
using Clustering
using PlotsBase
using NaNMath
using Plots
using Test

import Plots: PlotsBase
import GR; gr()

@testset "Grouped histogram" begin
rng = StableRNG(1337)
Expand All @@ -17,7 +17,7 @@ import Plots: PlotsBase
ylims = (1e-2, 1e4),
bar_position = :stack,
)
@test NaNMath.minimum(gpl[1][1][:y]) <= 1e-2
@test NaNMath.minimum(gpl[1][1][:y]) 1e-2
@test NaNMath.minimum(gpl[1][1][:y]) > 0
rng = StableRNG(1337)
gpl = groupedhist(
Expand All @@ -26,7 +26,7 @@ import Plots: PlotsBase
ylims = (1e-2, 1e4),
bar_position = :dodge,
)
@test NaNMath.minimum(gpl[1][1][:y]) <= 1e-2
@test NaNMath.minimum(gpl[1][1][:y]) 1e-2
@test NaNMath.minimum(gpl[1][1][:y]) > 0

data = [1, 1, 1, 1, 2, 1]
Expand Down

0 comments on commit b02abd6

Please sign in to comment.