Check if plot title already exists before adding again (#4027)

* Check if plot title already exists before adding again

* Add plot title tests
This commit is contained in:
Pearl Li
2022-01-12 05:52:43 -08:00
committed by GitHub
parent 2872c7a345
commit cffeba7609
2 changed files with 37 additions and 14 deletions
+14
View File
@@ -11,3 +11,17 @@ using Plots, Test
@test pl[3][:yaxis][:scale] == :log10
@test pl[4][:yaxis][:scale] == :log10
end
@testset "Plot title" begin
pl = plot(rand(4, 8), layout = 4, plot_title = "My title")
@test pl[:plot_title] == "My title"
@test pl[:plot_titleindex] == 5
plot!(pl)
@test pl[:plot_title] == "My title"
@test pl[:plot_titleindex] == 5
plot!(pl, plot_title = "My new title")
@test pl[:plot_title] == "My new title"
@test pl[:plot_titleindex] == 5
end