-
-
Notifications
You must be signed in to change notification settings - Fork 371
A get API #4783
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
Draft
BeastyBlacksmith
wants to merge
25
commits into
master
Choose a base branch
from
bbs/getattr
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
A get API #4783
Changes from 6 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
8e2959a
basic extraction form Plot
BeastyBlacksmith e53e7f1
extra_kwargs for Plot
BeastyBlacksmith ada3455
handle magic arguments for Plot
BeastyBlacksmith 616cf00
factor out
BeastyBlacksmith a29dffe
tests for axis and subplot
BeastyBlacksmith 9625c76
implement getting from series
BeastyBlacksmith 72dadb3
format and stub for <--
BeastyBlacksmith cb5dda9
add interpolation and <-- syntax for attribute access
BeastyBlacksmith a69160c
integrate in Plots
BeastyBlacksmith 62c59d6
use dev versions of Recipe packages in CI
BeastyBlacksmith f39ae96
disable build, format
BeastyBlacksmith f679518
fix ci
BeastyBlacksmith 7642c0a
dev Recipe packages on other actions
BeastyBlacksmith d9a8c38
Remove PyPlot from test env
BeastyBlacksmith cc4be02
run Plots tests without xvfb
BeastyBlacksmith 1f4c0a5
add prefix to ubuntu runs
BeastyBlacksmith 5414fc4
Merge branch 'master' into bbs/getattr
BeastyBlacksmith aa234f8
update invalidations.yml
BeastyBlacksmith 516ad83
uodate ci.yml
BeastyBlacksmith c657a47
take 2
BeastyBlacksmith 2fb98a3
invalidations
BeastyBlacksmith 6543a42
invalidations
BeastyBlacksmith 3a19444
invalidations
BeastyBlacksmith 3962cb5
invalidations
BeastyBlacksmith 1bbf717
invalidations
BeastyBlacksmith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,7 @@ export | |
BezierCurve, | ||
|
||
plotattr, | ||
getattr, | ||
scalefontsize, | ||
scalefontsizes, | ||
resetfontsizes | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using Plots, Test | ||
|
||
tplot = plot( | ||
repeat([1:5, 2:6], inner = 3), | ||
layout = @layout([a b; c]), | ||
this = :that, | ||
line = (5, :dash), | ||
title = ["A" "B"], | ||
xlims = [:auto (0, Inf)], | ||
) | ||
@testset "Get attributes" begin | ||
@testset "From Plot" begin | ||
@test getattr(tplot, :size) == default(:size) == getattr(tplot, :sizes) | ||
@test getattr(tplot, :linestyle) == permutedims(fill(:dash, 6)) | ||
@test getattr(tplot, :title) == ["A" "B" "A"] | ||
@test getattr(tplot, :xlims) == [:auto (0, Inf) :auto] #Note: this is different from Plots.xlims.(tplot.subplots) | ||
@test getattr(tplot, :lims) == [ | ||
(xaxis = :auto, yaxis = :auto, zaxis = :auto), | ||
(xaxis = (0, Inf), yaxis = :auto, zaxis = :auto), | ||
(xaxis = :auto, yaxis = :auto, zaxis = :auto), | ||
] | ||
@test getattr(tplot, :this) == Dict( | ||
:series => | ||
[1 => :that, 2 => :that, 3 => :that, 4 => :that, 5 => :that, 6 => :that], | ||
:subplots => Any[], | ||
:plot => Any[], | ||
) | ||
@test (@test_logs ( | ||
:info, | ||
r"line is a magic argument", | ||
) getattr(tplot, :line)) === missing | ||
BeastyBlacksmith marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@test_throws ArgumentError getattr(tplot, :nothere) | ||
end | ||
@testset "From Sublot" begin | ||
sp = tplot[2] | ||
@test getattr(sp, :size) == default(:size) == getattr(sp, :sizes) | ||
@test getattr(sp, :linestyle) == permutedims(fill(:dash, 2)) | ||
@test getattr(sp, :title) == "B" | ||
@test getattr(sp, :xlims) == (0, Inf) | ||
@test getattr(sp, :lims) == [ | ||
(xaxis = (0, Inf), yaxis = :auto, zaxis = :auto), | ||
] | ||
@test getattr(sp, :this) == Dict( | ||
:series => | ||
[2 => :that, 5 => :that], | ||
:subplots => Any[], | ||
:plot => Any[], | ||
) | ||
@test (@test_logs ( | ||
:info, | ||
r"line is a magic argument", | ||
) getattr(sp, :line)) === missing | ||
BeastyBlacksmith marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@test_throws ArgumentError getattr(sp, :nothere) | ||
end | ||
@testset "From Axis" begin | ||
axis = tplot[3][:yaxis] | ||
@test getattr(axis, :size) == default(:size) == getattr(axis, :sizes) | ||
@test getattr(axis, :linestyle) == permutedims(fill(:dash, 2)) | ||
@test getattr(axis, :title) == "A" | ||
@test getattr(axis, :xlims) === :auto # TODO: is this expected? | ||
@test getattr(axis, :lims) == :auto | ||
@test getattr(axis, :this) == Dict( | ||
:series => | ||
[3 => :that, 6 => :that], | ||
:subplots => Any[], | ||
:plot => Any[], | ||
) | ||
@test (@test_logs ( | ||
:info, | ||
r"line is a magic argument", | ||
) getattr(axis, :line)) === missing | ||
BeastyBlacksmith marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@test_throws ArgumentError getattr(axis, :nothere) | ||
end | ||
@testset "From Series" begin | ||
series = tplot[1][1] | ||
@test getattr(series, :size) == default(:size) == getattr(series, :sizes) | ||
@test getattr(series, :linestyle) == :dash | ||
@test getattr(series, :title) == "A" | ||
@test getattr(series, :xlims) == :auto | ||
@test getattr(series, :lims) == [ | ||
(xaxis = :auto, yaxis = :auto, zaxis = :auto), | ||
] | ||
@test getattr(series, :this) == Dict( | ||
:series => | ||
[1 => :that], | ||
:subplots => Any[], | ||
:plot => Any[], | ||
) | ||
@test (@test_logs ( | ||
:info, | ||
r"line is a magic argument", | ||
) getattr(series, :line)) === missing | ||
BeastyBlacksmith marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@test_throws ArgumentError getattr(series, :nothere) | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.