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

Julia crash + hangs with large Plots.jl plot #3518

Open
smartinsightsfromdata opened this issue Jan 17, 2024 · 3 comments
Open

Julia crash + hangs with large Plots.jl plot #3518

smartinsightsfromdata opened this issue Jan 17, 2024 · 3 comments

Comments

@smartinsightsfromdata
Copy link

smartinsightsfromdata commented Jan 17, 2024

This issue was originally reported as a Plots issue here JuliaPlots/Plots.jl#4856

As I was able to render the graph in the REPL, it is now clear that the issue is with VSCODE.

Strangely though it happens with the GR backend but NOT with the Plotly backend.

With following code Plots.jl crashes and julia hangs. Julia 1.9.4 on Ubuntu 23.04 + vscode.
The Boston housing dataset is very common and similar visualizations exist e.g. with Seaborn on Python and many packages in R.
Everything works with 11 variables / columns but crashes with >11. As there are no problems in plotly, it may well be that the problem is centred on the gr() backend.

using DataFrames, Plots
using MLDatasets: BostonHousing

dataset = BostonHousing()
df = dataset.features;

df = df[:,1:12];

function correlogram(df)
    rows = cols = size(df,2)
    plots = []
    for row = 1:rows, col = 1:cols
        if row == col
            push!(
                plots,
                histogram(df[:,row],bins=10, xtickfont = font(5), ytickfont = font(5), legend = false))
        else
            push!(
                plots,
                scatter(df[:,row], df[:,col], xtickfont = font(5), ytickfont = font(5), legend = false, markersize=1, alpha = 0.3, smooth = true,
                linewidth=3, linecolor=:red),
            )
        end
    end
    plot(plots..., size=(1200, 1000), layout = (rows, cols))
end

correlogram(df)

Before dying julia display the following:

free(): invalid next size (normal)

[760418] signal (6.-6): Aborted
in expression starting at none:0

I originally found the problem with StatsPlots and reported JuliaPlots/StatsPlots.jl#547 , but also in this case the plots works in the REPL and crashes + hangs with VSCODE.

@pfitzseb
Copy link
Member

Try exporting the plot as a png or svg outside of VS Code. I'd expect that to error as well because we're not really doing anything besides that.

@smartinsightsfromdata
Copy link
Author

@pfitzseb how do you explain it works with plotly backend and crashes with gr?

@pfitzseb
Copy link
Member

I mean, plotly appears to serialize things fine and GR doesn't. It's entirely different code doing the conversion to a vector or pixel graphics format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants