You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让Julia绘图在VS Code内显示而非外部GKS QTterm窗口?

How to Display Julia Plots Inline in VS Code

Hey, I've run into this exact issue before and got it sorted out pretty easily. Here are two ways to make your plots show up directly in the VS Code interface instead of popping up an external QT window:

Temporary Fix (Per Session)

If you just want this to work for your current Julia REPL session, run this line first before loading Plots:

ENV["GKSwstype"] = "100"
using Plots
plot(rand(10))

After setting this environment variable, your plot will render in the dedicated "Plots" panel within VS Code instead of the external window.

Permanent Fix (All Sessions)

To avoid having to set this every time you start Julia, you can add the environment variable to Julia's startup configuration:

  • Locate Julia's config folder: it's usually ~/.julia/config/ on macOS/Linux, or C:\Users\[YourUsername]\.julia\config\ on Windows.
  • If there's no startup.jl file in this folder, create a new one.
  • Add this single line to the file:
    ENV["GKSwstype"] = "100"
    

Save the file, and from now on whenever you launch the Julia REPL in VS Code, this setting will be applied automatically. Just run using Plots; plot(rand(10)) as usual, and your plot will show up inline.

A quick note: make sure you have the latest version of the Julia extension installed in VS Code—older versions might not support inline plotting properly. You can check for updates in the VS Code Extensions marketplace.

内容的提问来源于stack exchange,提问作者Pawan Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 20:12:43