――I always forget about the setup, so I will expose the memo.
Creating a venv environment
$ mkdir jupyterlab-sample
$ ce jupyterlab-sample
$ python3 --version
Python 3.9.0
$ python3 -m venv .venv
Main unit pip install
$ .venv/bin/pip3 install jupyterlab
$ .venv/bin/jupyter-lab --version
2.2.9
Start-up
.venv/bin/jupyter-lab
v Start like this
OK if you install using pip of venv
$ .venv/bin/pip3 install numpy
$ .venv/bin/pip3 install matplotlib
Why ...
Frequently set settings for matplotlibrc
.
You can check the path of matplotlibrc
currently used by the following method.
from matplotlib import matplotlib_fname
matplotlib_fname()
If it is displayed as ^, it is possible to overwrite the setting by placing a separate matplotlibrc
in the working directory with the built-in setting.
If you use it normally, Japanese will become tofu, so specify the ttc font file for Mac.
I added Hiragino Maru Gothic Pro
to the prefix to the original font.sans-serif
as follows.
matplotlibrc
font.sans-serif: Hiragino Maru Gothic Pro, DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif
Let's use seaborn. https://github.com/mwaskom/seaborn
Installation
.venv/bin/pip3 install seaborn
Can be used by importing
import seaborn as sns
Set the theme and font to your liking
seaborn.set_style("dark")
sns.set(font='Hiragino Maru Gothic Pro')
matplotlibrc
, seaborn seems to be hard-coded, and Japanese is not displayed properly unless I specify the font individually. ....There is an LSP for jupyterlab, so I want to try it properly
https://github.com/krassowski/jupyterlab-lsp
Recommended Posts