my vscode jupyter configuration

my jupyter packages

from IPython.display import display, HTML
from matplotlib import cm, projections
from mpl_toolkits.mplot3d import Axes3D
from pathlib import Path
from pprint import pprint
import clipboard
import concurrent.futures
import cv2
import math
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pickle
import PIL
import platform
import pprint
import re
import sys
import time
# import tensorflow as tf
# import torch
# from torch import Tensor
############################# section 1. pandas setting up. this should be located before section 2.
pd.set_option("display.max_columns", None)
# pd.set_option("display.max_rows", None)
############################# section 2. matplot setting up.
%matplotlib widget
plt.style.use('dark_background')
HTML('''
<style>
.jupyter-matplotlib {background-color: #003030;}
.widget-label, .jupyter-matplotlib-header{color: #b0b0b0;}
.jupyter-button {background-color: #333;color: #b0b0b0;}
.cell-output-ipywidget-background {background-color: transparent !important;}
.cell-output-ipywidget-background pre {color: white !important;}
</style>
''')

vscode using existing jupyter server

step 0: start a local jupyter server

@REM start_jupyter_server.bat
jupyter notebook --no-browser --port=8888 --NotebookApp.token="aaa"
@REM https://127.0.0.1:8888/?token=aaa
@REM http://127.0.0.1:8888/?token=aaa

image

dark matplotlib output

Make Matplotlib widget background color match dark theme in Visual Studio Code
image
(Make sure Visual Studio Code is closed.)

  1. Open file explorer, go to: C:\Users\<your_username_here>\.vscode\extensions\ms-toolsai.jupyter-<(THE VERSION NUMBER MAY VARY)2022.4.1021342353>\out\webviews\webview-side\ipywidgetsRenderer
  2. Open the ipywidgetsRenderer.js file (using Notepad++ or Notepad or even Visual Studio Code) before letting any Jupyter stuff run
  3. Wherever you see cell-output-ipywidget-background followed by background: white, replace white with black.

from

Make Matplotlib widget background color match dark theme in Visual Studio Code - Stack Overflow
https://stackoverflow.com/questions/71206490/make-matplotlib-widget-background-color-match-dark-theme-in-visual-studio-code

posted on   yusisc  阅读(47)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示