timerring

SciencePlots Basics and Features

August 26, 2023 · 6 min read
Tutorial
Python

Users sometimes need to customize layer properties such as fonts, tick axes, spines, and legends according to a journal’s figure-drawing requirements, which is time-consuming and can also easily cause users to overlook some layer-detail requirements.

As a third-party extension toolkit specifically for drawing scientific-paper figures, SciencePlots provides Matplotlib plot styles (Matplotlib Styles) for mainstream English-language scientific journals (such as Nature, Science, and IEEE).

The installation code for SciencePlots is as follows:

pip install SciencePlots
...


ProPlot Basics and Features

August 25, 2023 · 12 min read
Tutorial
Python

Figures for scientific papers impose higher requirements on the rendering conditions of multilayer elements (fonts, axes, legends, etc.), and we need to change multiple rendering parameters in Matplotlib and Seaborn, especially when drawing complex figures containing multiple subplots, which can easily make the plotting code verbose.

As a concise Matplotlib wrapper, the ProPlot library is a high-level wrapper for Matplotlib’s object-oriented plotting method (object-oriented interface), integrating the cartopy/Basemap mapping libraries, xarray, and pandas, and can compensate for some of Matplotlib’s shortcomings. ProPlot can give Matplotlib enthusiasts a smoother plotting experience.

...


Seaborn Basics and Features

August 24, 2023 · 3 min read
Tutorial
Python

Seaborn provides a more advanced encapsulation on top of Matplotlib, enabling users to use very little code to draw a visualization library for scientific paper figures with rich statistical information. Seaborn is based on Matplotlib, most parameters of plotting functions in Matplotlib can be used in Seaborn plotting functions, and it provides good support for other Python libraries (such as Numpy/Pandas/Scipy).

Install Matplotlib

python -m pip install matplotlib

Install Seaborn

pip install seaborn
...


Plotting Tools and Their Key Features

August 22, 2023 · 2 min read
Tutorial
Python

Python has multiple third-party libraries, including the basic plotting library Matplotlib, the statistical analysis visualization library Seaborn, the scientific plotting library ProPlot, and the scientific plotting theme library SciencePlots.

...


Organizing Code with Design Patterns

August 17, 2023 · 20 min read
Tutorial
Python

好的设计模式方便对代码进行功能扩展/修改,降低耦合性,提高复用性。

from abc import abstractmethod, ABC
from typing import Callable, final, Tuple, List, Sequence, Dict
from random import choices, randrange
from functools import wraps
from numpy import ndarray
from pandas import DataFrame
from time import perf_counter, sleep
from datetime import datetime, timedelta
...


Dividing Functionality with Classes

August 16, 2023 · 31 min read
Tutorial
Python

理解类是运用设计模式的前提;运用类本身也能更好的组织代码,提升扩展性、可读性、复用性。

from typing import Callable, Tuple, List, Sequence
from pandas import DataFrame
...


Writing Maintainable Code

August 16, 2023 · 15 min read
Tutorial
Python

from typing import Callable, Tuple, List
from pandas import DataFrame

项目结构定好了,就开始着手写代码了;那编写代码有哪些注意点呢?

...


Building a Project Structure

August 15, 2023 · 9 min read
Tutorial
Python

在具体的数据科学场景下,按照项目结构→代码编写→功能划分→组织代码的顺序,组织高质量的代码。

项目结构也可认为是目录结构,例如

Image Name Image Name

我们将项目代码拆分成多个功能模块,固化成函数/类并写到不同的文件中,存放在不同的路径里,python 将每个 py 文件视作为一个模块,可以用 import 调用;例如在 main.py 里调用 /db/db.py 里的函数 create_conn

from db.db import create_conn    
conn = create_conn() # create_conn创建了一个数据库的链接对象    
...


Overview of the AI Development Software Environment

March 14, 2023 · 6 min read
Tutorial
Linux | GPU | Python

Regarding software:

  1. Installation of the ubuntu operating system
  2. Abandon bash, embrace zsh
  3. Use of package managers,
  4. Install the NVIDIA GPU driver
  5. Software installation:Miniconda
  6. Software installation:Python IDE
  7. Software installation: ssh
  8. Software installation:Git
  9. Installation of other productivity software
...