Skip to content

Commit

Permalink
relax Plot, lineplot, scatterplot ctors (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg authored Dec 25, 2023
1 parent c4a8b37 commit 7e6b0af
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 49 deletions.
2 changes: 1 addition & 1 deletion ext/TermExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ UnicodePlots.gridplot(plots::Union{AbstractVector,Tuple}; kw...) =
UnicodePlots.gridplot(plots::Plot...; kw...) =
Term.grid(map(UnicodePlots.panel, plots); kw...)

end
end # module
3 changes: 3 additions & 0 deletions src/interface/lineplot.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""
lineplot(; kw...)
lineplot(y; kw...)
lineplot(x, y; kw...)
lineplot!(p, args...; kw...)
Expand Down Expand Up @@ -75,6 +77,7 @@ function lineplot(
lineplot!(Plot(x, y, z, canvas; pkw...), x, y, z; okw...)
end

lineplot(; kw...) = lineplot([]; kw...)
lineplot(y::AbstractVector; kw...) = lineplot(axes(y, 1), y; kw...)

@doc (@doc lineplot) function lineplot!(
Expand Down
3 changes: 3 additions & 0 deletions src/interface/scatterplot.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""
scatterplot(; kw...)
scatterplot(y; kw...)
scatterplot(x, y; kw...)
scatterplot!(p, args...; kw...)
Expand Down Expand Up @@ -69,6 +71,7 @@ function scatterplot(
scatterplot!(Plot(x, y, z, canvas; pkw...), x, y, z; okw...)
end

scatterplot(; kw...) = lineplot([]; kw...)
scatterplot(y::AbstractVector; kw...) = scatterplot(axes(y, 1), y; kw...)

@doc (@doc scatterplot) function scatterplot!(
Expand Down
2 changes: 2 additions & 0 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ function validate_input(x::AbstractVector, y::AbstractVector, z::Nothing)
end
end

Plot(; kw...) = Plot([], []; kw...)

function Plot(
x::AbstractVector,
y::AbstractVector,
Expand Down
6 changes: 3 additions & 3 deletions test/references_24/surfaceplot/sombrero_aspect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
│⠀⠀⠀⠀⠀⣠⣾⡿⠿⣿⣿⣕⣒⣒⣊⣽⣯⡮⠵⠅⠮⠮⢵⣽⣯⣑⣒⣒⣪⣿⣿⠿⢿⣷⣄⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠐⠻⠿⠛⠛⠛⠛⠽⢿⣶⣶⡾⠓⠉⠢⠈⡀⢁⠁⠔⠉⠚⢷⣶⣶⡿⠯⠛⠛⠛⠛⠿⠟⠂⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⣯⣯⣓⢶⣷⡆⣶⣾⡶⣚⣽⣽⠿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⢀⡠⠼⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
└────────────────────────────────────────┘ -10
8 changes: 4 additions & 4 deletions test/references_24/surfaceplot/sombrero_identity.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣨⣅⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⡾⢟⣿⣿⣿⣿⡻⢷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡿⣿⣋⣿⣿⣿⣿⣙⣿⢿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠟⠀⢿⣟⣿⣟⣿⣿⣻⡿⠀⠻⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⢸⣿⣿⢿⡿⣿⣿⡇⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⢀⡠⠜⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠮⣿⣿⠵⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠟⠀⢿⣟⣿⣟⣿⣿⣻⡿⠀⠻⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⢸⣿⣿⢿⡿⣿⣿⡇⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠮⣿⣿⠵⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
└────────────────────────────────────────┘ -10
6 changes: 3 additions & 3 deletions test/references_24/surfaceplot/sombrero_zscale.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⢖⡒⢊⡠⣯⣳⠳⠟⣞⣽⢄⡑⢒⡲⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⡿⡿⢿⣷⣏⣉⢤⣣⣺⡭⢯⣗⣜⡤⣉⣹⣾⡿⢿⢿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠺⠟⠉⠀⠀⠈⣿⣻⣿⡷⢿⡻⣟⡿⢾⣿⣟⣿⠁⠀⠀⠉⠻⠗⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣯⣟⣻⢞⡷⣟⣻⣽⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⢀⡠⠼⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣺⣗⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣯⣟⣻⢞⡷⣟⣻⣽⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠻⣺⣗⠟⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
└────────────────────────────────────────┘ -10
6 changes: 3 additions & 3 deletions test/references_8/surfaceplot/sombrero_aspect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
│⠀⠀⠀⠀⠀⣠⣾⡿⠿⣿⣿⣕⣒⣒⣊⣽⣯⡮⠵⠅⠮⠮⢵⣽⣯⣑⣒⣒⣪⣿⣿⠿⢿⣷⣄⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠐⠻⠿⠛⠛⠛⠛⠽⢿⣶⣶⡾⠓⠉⠢⠈⡀⢁⠁⠔⠉⠚⢷⣶⣶⡿⠯⠛⠛⠛⠛⠿⠟⠂⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⣯⣯⣓⢶⣷⡆⣶⣾⡶⣚⣽⣽⠿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⢀⡠⠼⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠊⠁⠀⠀⠀⠀⠉⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⡳⡻⡃⢟⢟⢞⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠪⠆⡵⠕⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ │▄▄│
│⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀│ └──┘
└────────────────────────────────────────┘ -10
Loading

0 comments on commit 7e6b0af

Please sign in to comment.