From 7195e157290c1bea6aa631a25f77b4705be22e88 Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Fri, 14 May 2021 22:00:09 +0200 Subject: [PATCH] Create docs on pushing to master (#3494) * Create docs.yml * Update docs.yml * Update docs.yml * Create docs.yml * Update docs.yml * [skip ci] * [skip ci] * [skip ci] * [skip ci] * Update docs.yml * Update docs.yml * Update docs.yml * Update docs.yml * fix pgfplotsx * fix pyplot * remove push workflow (should work without) * conditionally fix pyplot * change env-vars * fix * fix ref * clean up and cache artifacts * add Documenter_key to environment * fix parentheses * "one last fix" * dev => add * fix marker example * exclude 50 for plotly * install ms fonts * only trigger on master * remove REF pretending --- .github/workflows/docs.yml | 50 ++++++++++++++++++++++++++++++++++++++ src/backends/pgfplotsx.jl | 5 ++-- src/backends/pyplot.jl | 10 ++++++-- src/examples.jl | 9 ++++--- 4 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..e1dbcf1a7 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,50 @@ +name: docs + +on: + push: + branches: + - master + tags: '*' + +jobs: + Build_docs: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + repository: JuliaPlots/PlotDocs.jl + - uses: julia-actions/setup-julia@v1 + - name: Cache artifacts + uses: actions/cache@v1 + env: + cache-name: cache-artifacts + with: + path: ~/.julia/artifacts + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} + restore-keys: | + ${{ runner.os }}-test-${{ env.cache-name }}- + ${{ runner.os }}-test- + ${{ runner.os }}- + - name: Install dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y qt5-default \ + ttf-mscorefonts-installer \ + poppler-utils \ + pdf2svg \ + texlive-latex-base \ + texlive-binaries \ + texlive-pictures \ + texlive-latex-extra \ + texlive-luatex \ + ghostscript-x \ + libgconf2-4 + sudo fc-cache -vr + + - name: build documentation + env: + PYTHON: "" + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + run: | + xvfb-run julia --color=yes --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.add(PackageSpec(name="Plots", rev=split(ENV["GITHUB_REF"], "/", limit=3)[3])); Pkg.instantiate()' + xvfb-run julia --color=yes --project=docs/ -e 'withenv("GITHUB_REPOSITORY" => "JuliaPlots/PlotDocs.jl") do; include("docs/make.jl"); end' diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index d3ad78f17..eb9958802 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -82,6 +82,7 @@ function surface_to_vecs(x::AVec, y::AVec, s::Union{AMat,Surface}) end return xn, yn, zn end +surface_to_vecs(x::AVec, y::AVec, z::AVec) = x, y, z function Base.push!(pgfx_plot::PGFPlotsXPlot, item) push!(pgfx_plot.the_plot, item) @@ -483,8 +484,8 @@ function pgfx_add_series!(::Val{:surface}, axis, series_opt, series, series_func push!( series_opt, "surf" => nothing, - "mesh/rows" => length(opt[:x]), - "mesh/cols" => length(opt[:y]), + "mesh/rows" => length(unique(opt[:x])), # unique if its all vectors + "mesh/cols" => length(unique(opt[:y])), "z buffer" => "sort", "opacity" => alpha === nothing ? 1.0 : alpha, ) diff --git a/src/backends/pyplot.jl b/src/backends/pyplot.jl index e1392d05d..5e9da1e45 100644 --- a/src/backends/pyplot.jl +++ b/src/backends/pyplot.jl @@ -1063,8 +1063,14 @@ function _before_layout_calcs(plt::Plot{PyPlotBackend}) ax.spines["left"]."set_position"("zero") end elseif sp[:framestyle] in (:grid, :none, :zerolines) - for (loc, spine) in ax.spines - spine."set_visible"(false) + if PyPlot.version >= v"3.4.1" # that is one where it worked, the API change may have some other value + for spine in ax.spines + ax.spines[string(spine)]."set_visible"(false) + end + else + for (loc, spine) in ax.spines + spine."set_visible"(false) + end end if sp[:framestyle] == :zerolines ax."axhline"(y = 0, color = py_color(sp[:xaxis][:foreground_color_axis]), lw = py_thickness_scale(plt, 0.75)) diff --git a/src/examples.jl b/src/examples.jl index cfc76074c..6d4e631db 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -7,7 +7,7 @@ mutable struct PlotExample exprs::Vector{Expr} end -# the _examples we'll run for each +# the _examples we'll run for each backend const _examples = PlotExample[ PlotExample( # 1 "Lines", @@ -241,14 +241,15 @@ const _examples = PlotExample[ m -> m in Plots.supported_markers(), Plots._shape_keys, ) - markers = reshape(markers, 1, length(markers)) + markers = permutedims(markers) n = length(markers) x = range(0, stop = 10, length = n + 2)[2:(end - 1)] y = repeat(reshape(reverse(x), 1, :), n, 1) scatter( x, y, - m = (8, :auto), + m = markers, + markersize = 8, lab = map(string, markers), bg = :linen, xlim = (0, 10), @@ -1170,7 +1171,7 @@ _backend_skips = Dict( :gr => [25, 30, 47], :pyplot => [2, 25, 30, 31, 47, 49], :plotlyjs => [2, 21, 24, 25, 30, 31, 49, 51], - :plotly => [2, 21, 24, 25, 30, 31, 49, 51], + :plotly => [2, 21, 24, 25, 30, 31, 49, 50, 51], :pgfplotsx => [ 2, # animation 6, # images