From 8a584ceab4e14fb197ad8f42972638c6048dc1ab Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Tue, 5 Apr 2022 13:43:19 +0200 Subject: [PATCH] add/ rearrange docstrings --- src/output.jl | 7 +++++++ src/plot.jl | 6 ++++++ src/recipes.jl | 11 ----------- src/shorthands.jl | 23 +++++++++++++++++++++++ 4 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/output.jl b/src/output.jl index 151f9d6c..88a83888 100644 --- a/src/output.jl +++ b/src/output.jl @@ -79,6 +79,13 @@ const _savemap = Dict( "txt" => txt, ) +for out in Symbol.(unique(values(_savemap))) + @eval @doc """ + $($out)([plot,], filename) + Save plot as $($out)-file. + """ $out +end + const _extension_map = Dict("tikz" => "tex") function addExtension(fn::AbstractString, ext::AbstractString) diff --git a/src/plot.jl b/src/plot.jl index 3fa4d044..da9aa8cf 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -247,6 +247,12 @@ function prepare_output(plt::Plot) _update_plot_object(plt) end +""" + backend_object(plot) + +Returns the backend representation of a Plot object. +Returns `nothing` if the backend does not support this. +""" function backend_object(plt::Plot) prepare_output(plt) plt.o diff --git a/src/recipes.jl b/src/recipes.jl index e927d533..4827232a 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -1625,7 +1625,6 @@ end @nospecialize -"Adds ax+b... straight line over the current plot, without changing the axis limits" abline!(plt::Plot, a, b; kw...) = plot!(plt, [0, 1], [b, b + a]; seriestype = :straightline, kw...) @@ -1670,16 +1669,6 @@ end end end -""" - areaplot([x,] y) - areaplot!([x,] y) - -Draw a stacked area plot of the matrix y. -# Examples -```julia-repl -julia> areaplot(1:3, [1 2 3; 7 8 9; 4 5 6], seriescolor = [:red :green :blue], fillalpha = [0.2 0.3 0.4]) -``` -""" @userplot AreaPlot @recipe function f(a::AreaPlot) diff --git a/src/shorthands.jl b/src/shorthands.jl index fe83eeee..15f2d90d 100644 --- a/src/shorthands.jl +++ b/src/shorthands.jl @@ -478,4 +478,27 @@ xgrid!(args...; kw...) = plot!(; xgrid = args, kw...) yaxis!(args...; kw...) = plot!(; yaxis = args, kw...) ygrid!(args...; kw...) = plot!(; ygrid = args, kw...) +@doc """ + abline!([plot,] a, b; kwargs...) + +Adds ax+b... straight line over the current plot, without changing the axis limits +""" abline! + +@doc """ + areaplot([x,] y) + areaplot!([x,] y) + +Draw a stacked area plot of the matrix y. +# Examples +```julia-repl +julia> areaplot(1:3, [1 2 3; 7 8 9; 4 5 6], seriescolor = [:red :green :blue], fillalpha = [0.2 0.3 0.4]) +``` +""" areaplot + +@doc """ + lens!([plot,] x, y, inset = (sp_index, bbox(x1, x2, y1, y2))) + +Magnify a region of a plot given by `x` and `y`. +`sp_index` is the index of the subplot and `x1`, `x2`, `y1` and `y2` should be between `0` and `1`. +""" lens! @specialize