Glmakie in vscode single plot popout

When working with Julia in VSCode, you may encounter the need to create a single plot and pop it out into a separate window. This can be useful for better visualization or for comparing multiple plots side by side. In this article, we will explore three different ways to achieve this.

Option 1: Using the Plots.jl Package

The Plots.jl package provides a high-level interface for creating plots in Julia. To create a single plot and pop it out into a separate window, you can follow these steps:


using Plots
plot(rand(10))
gui()

By calling the `gui()` function after creating the plot, a separate window will open displaying the plot. You can interact with the plot in this window, zooming in/out, panning, or saving it as an image.

Option 2: Using the PyPlot.jl Package

If you prefer using the PyPlot backend for creating plots, you can achieve the same result using the PyPlot.jl package. Here’s how:


using PyPlot
plot(rand(10))
show()

The `show()` function will open a separate window displaying the plot. Similar to the previous option, you can interact with the plot in this window.

Option 3: Using the GR.jl Package

Another option is to use the GR.jl package, which provides a high-performance plotting backend. Here’s how you can create a single plot and pop it out into a separate window using GR.jl:


using GR
plot(rand(10))
display()

The `display()` function will open a separate window displaying the plot. Again, you can interact with the plot in this window.

Among these three options, the choice depends on your personal preference and the specific requirements of your project. Plots.jl provides a high-level interface and supports multiple backends, making it a versatile choice. PyPlot.jl offers compatibility with the popular Python plotting library, matplotlib. GR.jl, on the other hand, focuses on high-performance plotting. Consider your needs and preferences to determine which option is better suited for your use case.

Rate this post

Leave a Reply

Your email address will not be published. Required fields are marked *

Table of Contents