Plots.jl: [BUG] Plots too large with GR backend in Pluto after Plots 1.8 update

Created on 10 Nov 2020  ·  21Comments  ·  Source: JuliaPlots/Plots.jl

Details

After the Plots.jl update to V1.8, plots with the GR backend are very large by default in Pluto.jl, see attached screenshot and example notebook.

With Plots V1.7, the plot size for GR backend was fine. With the Plotly backends, the size is fine both for Plots.jl V1.7 and V1.8.

image

Pluto notebook:

### A Pluto.jl notebook ###
# v0.12.7

using Markdown
using InteractiveUtils

# ╔═╡ a1b0e0c0-2333-11eb-3d72-fbe9f9005bcb
begin
    using Pkg
    Pkg.activate(mktempdir())
end

# ╔═╡ ac2ac340-2333-11eb-210a-e577dcb4f095
begin
    Pkg.add("Plots")
    using Plots
end

# ╔═╡ b4b7c9e0-2333-11eb-3812-ab64fd5965d7
x = 1:10

# ╔═╡ bdcf3630-2333-11eb-16da-3fa14b0b6451
y = rand(10)

# ╔═╡ c0c0fef0-2333-11eb-37cc-3fc755c82535
begin
    gr()
    plot(x, y)
end

# ╔═╡ cb5dabb0-2333-11eb-02b1-0bd81d94ca74
begin
    plotlyjs()
    plot(x, y)
end

# ╔═╡ cffb28a0-2333-11eb-36fc-9b4c63cdcf20
begin
    plotly()
    plot(x, y)
end

# ╔═╡ Cell order:
# ╠═a1b0e0c0-2333-11eb-3d72-fbe9f9005bcb
# ╠═ac2ac340-2333-11eb-210a-e577dcb4f095
# ╠═b4b7c9e0-2333-11eb-3812-ab64fd5965d7
# ╠═bdcf3630-2333-11eb-16da-3fa14b0b6451
# ╠═c0c0fef0-2333-11eb-37cc-3fc755c82535
# ╠═cb5dabb0-2333-11eb-02b1-0bd81d94ca74
# ╠═cffb28a0-2333-11eb-36fc-9b4c63cdcf20

Backends

This bug occurs on ( insert x below )

Backend | yes | no | untested
-------------|-----|-----|---------
gr (default) | x | |
pyplot | | | x
plotly | | x |
plotlyjs | | x |
pgfplotsx | | | x
inspectdr | | | x

Versions

Plots.jl version: 1.8 (this issue does not occur in 1.7)

Backend version (]st -m):
From worker 3: Activating new environment at C:\Users\xxx\AppData\Local\Temp\jl_PPuWRf\Project.toml
From worker 3: Updating registry at C:\Users\xxx\.julia\registries\General
From worker 3: Updating git-repo https://github.com/JuliaRegistries/General.git
Resolving package versions...
From worker 3: Updating C:\Users\xxx\AppData\Local\Temp\jl_PPuWRf\Project.toml
From worker 3: [91a5bcdd] + Plots v1.8.0
From worker 3: Updating C:\Users\xxx\AppData\Local\Temp\jl_PPuWRf\Manifest.toml
From worker 3: [79e6a3ab] + Adapt v2.3.0
From worker 3: [56f22d72] + Artifacts v1.3.0
From worker 3: [6e34b625] + Bzip2_jll v1.0.6+5
From worker 3: [83423d85] + Cairo_jll v1.16.0+6
From worker 3: [35d6a980] + ColorSchemes v3.10.1
From worker 3: [3da002f7] + ColorTypes v0.10.9
From worker 3: [5ae59095] + Colors v0.12.4
From worker 3: [34da2185] + Compat v3.23.0
From worker 3: [d38c429a] + Contour v0.5.5
From worker 3: [9a962f9c] + DataAPI v1.4.0
From worker 3: [864edb3b] + DataStructures v0.18.8
From worker 3: [e2d170a0] + DataValueInterfaces v1.0.0
From worker 3: [5ae413db] + EarCut_jll v2.1.5+1
From worker 3: [2e619515] + Expat_jll v2.2.7+6
From worker 3: [c87230d0] + FFMPEG v0.4.0
From worker 3: [b22a6f82] + FFMPEG_jll v4.3.1+4
From worker 3: [53c48c17] + FixedPointNumbers v0.8.4
From worker 3: [a3f928ae] + Fontconfig_jll v2.13.1+14
From worker 3: [59287772] + Formatting v0.4.1
From worker 3: [d7e528f0] + FreeType2_jll v2.10.1+5
From worker 3: [559328eb] + FriBidi_jll v1.0.5+6
From worker 3: [0656b61e] + GLFW_jll v3.3.2+1
From worker 3: [28b8d3ca] + GR v0.53.0
From worker 3: [d2c73de3] + GR_jll v0.52.0+0
From worker 3: [5c1252a2] + GeometryBasics v0.3.3
From worker 3: [78b55507] + Gettext_jll v0.20.1+7
From worker 3: [7746bdde] + Glib_jll v2.59.0+4
From worker 3: [42e2da0e] + Grisu v1.0.0
From worker 3: [cd3eb016] + HTTP v0.8.19
From worker 3: [83e8ac13] + IniFile v0.5.0
From worker 3: [c8e1da08] + IterTools v1.3.0
From worker 3: [82899510] + IteratorInterfaceExtensions v1.0.0
From worker 3: [692b3bcd] + JLLWrappers v1.1.3
From worker 3: [682c06a0] + JSON v0.21.1
From worker 3: [aacddb02] + JpegTurbo_jll v2.0.1+3
From worker 3: [c1c5ebd0] + LAME_jll v3.100.0+3
From worker 3: [dd4b983a] + LZO_jll v2.10.0+3
From worker 3: [b964fa9f] + LaTeXStrings v1.2.0
From worker 3: [23fbe1c1] + Latexify v0.14.3
From worker 3: [dd192d2f] + LibVPX_jll v1.9.0+1
From worker 3: [e9f186c6] + Libffi_jll v3.2.1+4
From worker 3: [d4300ac3] + Libgcrypt_jll v1.8.5+4
From worker 3: [7e76a0d4] + Libglvnd_jll v1.3.0+3
From worker 3: [7add5ba3] + Libgpg_error_jll v1.36.0+3
From worker 3: [94ce4f54] + Libiconv_jll v1.16.0+7
From worker 3: [4b2f31a3] + Libmount_jll v2.34.0+3
From worker 3: [89763e89] + Libtiff_jll v4.1.0+2
From worker 3: [38a345b3] + Libuuid_jll v2.34.0+7
From worker 3: [1914dd2f] + MacroTools v0.5.6
From worker 3: [739be429] + MbedTLS v1.0.3
From worker 3: [c8ffd9c3] + MbedTLS_jll v2.16.8+1
From worker 3: [442fdcdd] + Measures v0.3.1
From worker 3: [e1d29d7a] + Missings v0.4.4
From worker 3: [77ba4419] + NaNMath v0.3.4
From worker 3: [e7412a2a] + Ogg_jll v1.3.4+2
From worker 3: [458c3c95] + OpenSSL_jll v1.1.1+6
From worker 3: [91d4177d] + Opus_jll v1.3.1+3
From worker 3: [bac558e1] + OrderedCollections v1.3.2
From worker 3: [2f80f16e] + PCRE_jll v8.42.0+4
From worker 3: [69de0a69] + Parsers v1.0.11
From worker 3: [30392449] + Pixman_jll v0.38.4+5
From worker 3: [ccf2f8ad] + PlotThemes v2.0.0
From worker 3: [995b91a9] + PlotUtils v1.0.7
From worker 3: [91a5bcdd] + Plots v1.8.0
From worker 3: [784f63db] + Qhull_jll v2019.1.0+2
From worker 3: [ede63266] + Qt_jll v5.15.0+3
From worker 3: [3cdcf5f2] + RecipesBase v1.1.1
From worker 3: [01d81517] + RecipesPipeline v0.2.0
From worker 3: [189a3867] + Reexport v0.2.0
From worker 3: [ae029012] + Requires v1.1.0
From worker 3: [6c6a2e73] + Scratch v1.0.3
From worker 3: [992d4aef] + Showoff v0.3.2
From worker 3: [a2af1166] + SortingAlgorithms v0.3.1
From worker 3: [90137ffa] + StaticArrays v0.12.5
From worker 3: [2913bbd2] + StatsBase v0.33.2
From worker 3: [09ab397b] + StructArrays v0.4.4
From worker 3: [3783bdb8] + TableTraits v1.0.0
From worker 3: [bd369af6] + Tables v1.2.0
From worker 3: [a2964d1f] + Wayland_jll v1.17.0+4
From worker 3: [2381bf8a] + Wayland_protocols_jll v1.18.0+4
From worker 3: [02c8fc9c] + XML2_jll v2.9.10+3
From worker 3: [aed1982a] + XSLT_jll v1.1.33+4
From worker 3: [4f6342f7] + Xorg_libX11_jll v1.6.9+4
From worker 3: [0c0b7dd1] + Xorg_libXau_jll v1.0.9+4
From worker 3: [935fb764] + Xorg_libXcursor_jll v1.2.0+4
From worker 3: [a3789734] + Xorg_libXdmcp_jll v1.1.3+4
From worker 3: [1082639a] + Xorg_libXext_jll v1.3.4+4
From worker 3: [d091e8ba] + Xorg_libXfixes_jll v5.0.3+4
From worker 3: [a51aa0fd] + Xorg_libXi_jll v1.7.10+4
From worker 3: [d1454406] + Xorg_libXinerama_jll v1.1.4+4
From worker 3: [ec84b674] + Xorg_libXrandr_jll v1.5.2+4
From worker 3: [ea2f1a96] + Xorg_libXrender_jll v0.9.10+4
From worker 3: [14d82f49] + Xorg_libpthread_stubs_jll v0.1.0+3
From worker 3: [c7cfdc94] + Xorg_libxcb_jll v1.13.0+3
From worker 3: [cc61e674] + Xorg_libxkbfile_jll v1.1.0+4
From worker 3: [12413925] + Xorg_xcb_util_image_jll v0.4.0+0
From worker 3: [2def613f] + Xorg_xcb_util_jll v0.4.0+0
From worker 3: [975044d2] + Xorg_xcb_util_keysyms_jll v0.4.0+0
From worker 3: [0d47668e] + Xorg_xcb_util_renderutil_jll v0.3.9+0
From worker 3: [c22f9ab0] + Xorg_xcb_util_wm_jll v0.4.1+0
From worker 3: [35661453] + Xorg_xkbcomp_jll v1.4.2+4
From worker 3: [33bec58e] + Xorg_xkeyboard_config_jll v2.27.0+4
From worker 3: [c5fb5394] + Xorg_xtrans_jll v1.4.0+3
From worker 3: [83775a58] + Zlib_jll v1.2.11+18
From worker 3: [3161d3a3] + Zstd_jll v1.4.5+2
From worker 3: [0ac62f75] + libass_jll v0.14.0+4
From worker 3: [f638f0a6] + libfdk_aac_jll v0.1.6+4
From worker 3: [b53b4c65] + libpng_jll v1.6.37+6
From worker 3: [f27f6e37] + libvorbis_jll v1.3.6+6
From worker 3: [1270edf5] + x264_jll v2020.7.14+2
From worker 3: [dfaa095f] + x265_jll v3.0.0+3
From worker 3: [d8fb68d0] + xkbcommon_jll v0.9.1+5
From worker 3: [2a0f44e3] + Base64
From worker 3: [ade2ca70] + Dates
From worker 3: [8bb1440f] + DelimitedFiles
From worker 3: [8ba89e20] + Distributed
From worker 3: [b77e0a4c] + InteractiveUtils
From worker 3: [76f85450] + LibGit2
From worker 3: [8f399da3] + Libdl
From worker 3: [37e2e46d] + LinearAlgebra
From worker 3: [56ddb016] + Logging
From worker 3: [d6f4376e] + Markdown
From worker 3: [a63ad114] + Mmap
From worker 3: [44cfe95a] + Pkg
From worker 3: [de0858da] + Printf
From worker 3: [3fa0cd96] + REPL
From worker 3: [9a3f8284] + Random
From worker 3: [ea8e919c] + SHA
From worker 3: [9e88b42a] + Serialization
From worker 3: [1a1011a3] + SharedArrays
From worker 3: [6462fe0b] + Sockets
From worker 3: [2f01184e] + SparseArrays
From worker 3: [10745b16] + Statistics
From worker 3: [8dfed614] + Test
From worker 3: [cf7118a7] + UUIDs
From worker 3: [4ec0a83e] + Unicode
[ Info: For saving to png with the Plotly backend PlotlyBase has to be installed.

Output of versioninfo():
Julia Version 1.5.2
Commit 539f3ce943 (2020-09-23 23:17 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 6

GR bug priority

Most helpful comment

@lmh91 : Thanks - I fixed it in Plots#master and tagged a new release.

All 21 comments

We (SolidStateDetectors.jl) also have this issue when compiling our Docs via Documenter.jl

Same problem appears when plotting with GR in jupyter notebooks.
The problem does not occur when plotting with pyplot though.

Same problem here with Jupiter notebooks. The plots are fine in the GKS Term.
I created a fresh environment and added only Plots and IJulia to test this.

immagine

I'm really sorry for this. The issue seems to occur with GR version 0.53. The Pluto notebook in the issue description works, if you add

Pkg.add(PackageSpec(name="GR", version="0.52"))

to the first cell.

@jheinen do you know what change in GR 0.53 might cause this and how we can fix it in Plots?

Hmm. Strange - don't see any problem in plain GR. Will check it later ...

To be honest: I don't understand this section. The result is much too big, so I don't see a problem within GR. Did the values vor px or pt probably change in Plots.jl?

Simplifying the expression seems to fix the problem:

gr_point_mult(s) = get_thickness_scaling(s) / 500  # divide by nominal window height

Same with @myrddin89 problem. Works fine in plain GR:

Screen Shot 2020-11-10 at 17 13 35

@daschw : IMO some scaling parameters in Plots.jl have changed, which have not been adapted in the GR backend code.

Also, the PNG output is OK:
Screen Shot 2020-11-10 at 17 18 14

But why does it work with Plots 1.8 and GR 0.52, but not with Plots 1.8 and GR 0.53? I'm not aware of any recent scaling Parameter changes for GR in Plots. I could not find any in the diff of Plots 1.8.0 vs 1.7.4.

... in my opinion the problem occurred well before Plots 1.7.4

May be we have to different bugs: the text height and the window size. Right now, I'm totally confused ...

Would be easier for me, if any of the problems would occur in plain GR.

@daschw : Which GR run-time are you using with Plots 1.8 and GR 0.53? (Plots.GR.version())

julia> Plots.GR.version()
"0.53.0"

Ok, the window height problem (for SVG) can probably be fixed by removing those lines.

@daschw : Can you confirm this?

For my environment, the above patch fixes the problem:
Screen Shot 2020-11-10 at 18 26 38

Sorry. I was not aware, that this commit would have side effects in Plots.jl.

I can confirm that removing those lines fixes our Plots in our Documentation again.

@lmh91 : Thanks - I fixed it in Plots#master and tagged a new release.

Thank you all, especially @jheinen !

Thank you all, especially @jheinen !

Well, it was our mistake :-(

Nevertheless, thanks guys for fixing this right away!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Krastanov picture Krastanov  ·  3Comments

asinghvi17 picture asinghvi17  ·  3Comments

mkborregaard picture mkborregaard  ·  3Comments

pkofod picture pkofod  ·  3Comments

tbenst picture tbenst  ·  3Comments