Skip to content
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

Upgrade plotly.js to v2.6.3 #3958

Merged
merged 2 commits into from
Dec 1, 2021

Conversation

jks-liu
Copy link
Contributor

@jks-liu jks-liu commented Nov 27, 2021

Announcing Plotly.js 2.0!

Changes in this pr

  1. Change version of plotly.js from 1.57.1 to 2.6.3
  2. Use Plotly.newPlot() instead of the Plotly.plot() function which has been deprecated/under-documented for years and deleted in v2.x.x
  3. The legacy polar r and t attributes of the otherwise-cartesian scatter and bar traces: these attributes have been marked as deprecated and un/under-documented for years and deleted in v2.x.x; the scatterpolar and barpolar trace types should be used instead.

Test result

$ julia test/test_plotly.jl 
Test Summary: | Pass  Total
Plotly        |   14     14

Bugs fixed

Because there is no enough test for Plotly(JS), I checked some bug about them.

Fixed bugs duplicated in current version

Bugs not duplicated in either current version or pr version, so fix them

@codecov
Copy link

codecov bot commented Nov 27, 2021

Codecov Report

Merging #3958 (04f2763) into master (c94cf18) will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3958      +/-   ##
==========================================
+ Coverage   62.45%   62.49%   +0.04%     
==========================================
  Files          29       29              
  Lines        7223     7223              
==========================================
+ Hits         4511     4514       +3     
+ Misses       2712     2709       -3     
Impacted Files Coverage Δ
src/Plots.jl 33.33% <ø> (ø)
src/args.jl 71.71% <0.00%> (-0.31%) ⬇️
src/backends/gr.jl 88.40% <0.00%> (+0.41%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5838182...04f2763. Read the comment docs.

@t-bltg
Copy link
Member

t-bltg commented Nov 28, 2021

Looks good at first glance.

Did you also build the docs to compare the new examples against http://docs.juliaplots.org/latest/generated/plotlyjs/ ?

@jks-liu
Copy link
Contributor Author

jks-liu commented Nov 28, 2021

I will check it, thanks.

@jks-liu
Copy link
Contributor Author

jks-liu commented Nov 29, 2021

When building the docs, I had below errors

$ julia --project=docs/ docs/make.jl
┌ Warning: Replacing module `ColorSchemes`
└ @ Base loading.jl:959
┌ Warning: Gnuplot is not available on this system. Gaston will be unable to produce any plots.
└ @ Gaston ~/.julia/packages/Gaston/ctAQy/src/Gaston.jl:88
ERROR: LoadError: IOError: open("/home/meme/.julia/dev/PlotDocs.jl/docs/src/generated/plotthemes.md", 577, 33060): no such file or directory (ENOENT)
Stacktrace:
 [1] uv_error
   @ ./libuv.jl:97 [inlined]
 [2] open(path::String, flags::UInt16, mode::UInt64)
   @ Base.Filesystem ./filesystem.jl:87
 [3] sendfile(src::String, dst::String)
   @ Base.Filesystem ./file.jl:956
 [4] cp(src::String, dst::String; force::Bool, follow_symlinks::Bool)
   @ Base.Filesystem ./file.jl:355
 [5] top-level scope
   @ ~/.julia/dev/PlotDocs.jl/docs/make.jl:17
in expression starting at /home/meme/.julia/dev/PlotDocs.jl/docs/make.jl:17

So I tried creating the folder of /home/meme/.julia/dev/PlotDocs.jl/docs/src/generated/, another error happens

$ julia --project=docs/ docs/make.jl
┌ Warning: Replacing module `ColorSchemes`
└ @ Base loading.jl:959
┌ Warning: Gnuplot is not available on this system. Gaston will be unable to produce any plots.
└ @ Gaston ~/.julia/packages/Gaston/ctAQy/src/Gaston.jl:88
ansicolor = true
[ Info: SetupBuildDirectory: setting up build directory.
ERROR: LoadError: 'generated/attributes_series.md' is not an existing page!
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] walk_navpages(visible::Bool, title::String, src::String, children::Vector{Any}, parent::Documenter.Documents.NavNode, doc::Documenter.Documents.Document)
    @ Documenter.Builder ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:189
  [3] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:204 [inlined]
  [4] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:206 [inlined]
  [5] #1
    @ ./none:0 [inlined]
  [6] iterate
    @ ./generator.jl:47 [inlined]
  [7] collect_to!(dest::Vector{Documenter.Documents.NavNode}, itr::Base.Generator{Vector{Pair{String, String}}, Documenter.Builder.var"#1#2"{Documenter.Documents.NavNode, Documenter.Documents.Document}}, offs::Int64, st::Int64)
    @ Base ./array.jl:728
  [8] collect_to_with_first!
    @ ./array.jl:706 [inlined]
  [9] collect(itr::Base.Generator{Vector{Pair{String, String}}, Documenter.Builder.var"#1#2"{Documenter.Documents.NavNode, Documenter.Documents.Document}})
    @ Base ./array.jl:687
 [10] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:207 [inlined]
 [11] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:194 [inlined]
 [12] walk_navpages(title::String, children::Vector{Pair{String, String}}, parent::Documenter.Documents.NavNode, doc::Documenter.Documents.Document)
    @ Documenter.Builder ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:203
 [13] walk_navpages(p::Pair{String, Any}, parent::Documenter.Documents.NavNode, doc::Documenter.Documents.Document)
    @ Documenter.Builder ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:206
 [14] #1
    @ ./none:0 [inlined]
 [15] iterate
    @ ./generator.jl:47 [inlined]
 [16] collect_to!
    @ ./array.jl:728 [inlined]
 [17] collect_to_with_first!(dest::Vector{Documenter.Documents.NavNode}, v1::Documenter.Documents.NavNode, itr::Base.Generator{Vector{Pair{String, Any}}, Documenter.Builder.var"#1#2"{Documenter.Documents.NavNode, Documenter.Documents.Document}}, st::Int64)
    @ Base ./array.jl:706
 [18] collect(itr::Base.Generator{Vector{Pair{String, Any}}, Documenter.Builder.var"#1#2"{Documenter.Documents.NavNode, Documenter.Documents.Document}})
    @ Base ./array.jl:687
 [19] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:207 [inlined]
 [20] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:194 [inlined]
 [21] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:203 [inlined]
 [22] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:206 [inlined]
 [23] (::Documenter.Builder.var"#1#2"{Nothing, Documenter.Documents.Document})(p::Pair{String, Vector{Pair{String, Any}}})
    @ Documenter.Builder ./none:0
 [24] iterate
    @ ./generator.jl:47 [inlined]
 [25] collect_to!(dest::Vector{Documenter.Documents.NavNode}, itr::Base.Generator{Vector{Any}, Documenter.Builder.var"#1#2"{Nothing, Documenter.Documents.Document}}, offs::Int64, st::Int64)
    @ Base ./array.jl:728
 [26] collect_to_with_first!
    @ ./array.jl:706 [inlined]
 [27] collect(itr::Base.Generator{Vector{Any}, Documenter.Builder.var"#1#2"{Nothing, Documenter.Documents.Document}})
    @ Base ./array.jl:687
 [28] walk_navpages
    @ ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:207 [inlined]
 [29] runner(#unused#::Type{Documenter.Builder.SetupBuildDirectory}, doc::Documenter.Documents.Document)
    @ Documenter.Builder ~/.julia/packages/Documenter/qdbx6/src/Builder.jl:146
 [30] dispatch(#unused#::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Documents.Document)
    @ Documenter.Utilities.Selectors ~/.julia/packages/Documenter/qdbx6/src/Utilities/Selectors.jl:170
 [31] #2
    @ ~/.julia/packages/Documenter/qdbx6/src/Documenter.jl:266 [inlined]
 [32] cd(f::Documenter.var"#2#3"{Documenter.Documents.Document}, dir::String)
    @ Base.Filesystem ./file.jl:106
 [33] #makedocs#1
    @ ~/.julia/packages/Documenter/qdbx6/src/Documenter.jl:265 [inlined]
 [34] top-level scope
    @ ./timing.jl:210
in expression starting at /home/meme/.julia/dev/PlotDocs.jl/docs/make.jl:80

I need more time to figure it out.

@t-bltg
Copy link
Member

t-bltg commented Nov 29, 2021

When building the docs, I had below errors

Using vanilla julia, it works as expected on my side:

$ julia --project=docs -e 'using Pkg; pkg"dev https://github.com/JuliaPlots/PlotReferenceImages.jl"'
$ julia --project=docs -e 'using Pkg; pkg"dev https://github.com/JuliaPlots/PlotDocs.jl"'
$ julia --project=docs -e 'using Pkg; pkg"dev https://github.com/JuliaPlots/Plots.jl"'
$ julia --project=docs -e 'using Pkg; pkg"add Documenter StatsPlots PlotlyJS Gaston GR PyPlot InspectDR PGFPlotsX UnicodePlots"'
$ cd ~/.julia/dev/Plots
$ ... # now apply https://github.com/JuliaPlots/Plots.jl/pull/3958.patch
$ cd ~/.julia/dev/PlotDocs  # <== are you in the correct directory ?
$ GKSwstype=nul julia --project=docs docs/make.jl
[...]
ansicolor = true
[ Info: SetupBuildDirectory: setting up build directory.
[ Info: Doctest: running doctests.
[ Info: ExpandTemplates: expanding markdown templates.

@jks-liu
Copy link
Contributor Author

jks-liu commented Nov 30, 2021

I think julia -e 'using Pkg; pkg"dev https://github.com/JuliaPlots/PlotDocs.jl"' will only affect the default environment, and julia --project=docs/ docs/make.jl use environment of docs/. How can they affect each other?

@t-bltg
Copy link
Member

t-bltg commented Nov 30, 2021

See how we build the docs in CI:

run: |
export JULIA_DEBUG=Documenter
export PLOTDOCS_ANSICOLOR=true
export GKSwstype=nul # Plots.jl/issues/3664
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 'using Pkg; pkg"add Documenter#master"'
xvfb-run julia --color=yes --project=docs/ -e 'using Pkg; pkg"st -m"'
xvfb-run julia --color=yes --project=docs/ -e 'withenv("GITHUB_REPOSITORY" => "JuliaPlots/PlotDocs.jl") do; include("docs/make.jl"); end'

EDIT: I've updated the julia commands to use --project=docs.

@jks-liu
Copy link
Contributor Author

jks-liu commented Nov 30, 2021

@t-bltg Thanks for your patient support, I can build the docs now.

Except the polar plot, every plot in plotlyjs.html is the same (by my eyes). And I think the polar plots have no essential difference.

  • Before
    image
  • After
    image

@t-bltg
Copy link
Member

t-bltg commented Nov 30, 2021

Thanks for taking the time to fully investigate any potential regression !

Copy link
Member

@BeastyBlacksmith BeastyBlacksmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I think the polar plots have no essential difference.

Well, they do look better now, but they lack the plots styling, such as background color, r-axis position, etc.. But in priciple this can also be changed in another PR

@t-bltg t-bltg merged commit 79cf62c into JuliaPlots:master Dec 1, 2021
@paulnakroshis
Copy link

Will the new LaTeX compatibility be ported to the Plots.jl plotlyjs() backend?

@paulnakroshis
Copy link

I've upgraded to Julia 1.7, and still, I see the following:
"""
(@v1.7) pkg> status
Status ~/.julia/environments/v1.7/Project.toml
[717857b8] DSP v0.7.4
[a93c6f00] DataFrames v1.2.2
[7073ff75] IJulia v1.23.2
[c601a237] Interact v0.10.4
[b964fa9f] LaTeXStrings v1.3.0
[ee78f7c6] Makie v0.15.3
[58dd65bb] Plotly v0.4.1
[f0f68f2c] PlotlyJS v0.18.8
[91a5bcdd] Plots v1.24.4
[c3e4b0f8] Pluto v0.17.2
[cf09d348] Smoothing v1.0.0
[0f1e0344] WebIO v0.8.16
"""
How does one get plotlyjs v2.6.3? I'd love to have LaTeX labels working!

@BeastyBlacksmith
Copy link
Member

I think you are confusing the version numbers of plotly.js (the javascript library) and Plotly.jl/ PlotlyJS.jl, julia libraries which provide bindings for the javascript library in julia.

@paulnakroshis
Copy link

I think you are confusing the version numbers of plotly.js (the javascript library) and Plotly.jl/ PlotlyJS.jl, julia libraries which provide bindings for the javascript library in julia.

ok. That makes sense. Does this update to the javascript library mean that the julia libraries will be relatively easily updated to incorporate the LaTeX bug fix?

isentropic pushed a commit to isentropic/Plots.jl that referenced this pull request Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment