Created
December 20, 2021 11:33
-
-
Save ialexpovad/c55d11c7dcfb0d5eb5d6270c6bb278de to your computer and use it in GitHub Desktop.
[DivisionAxes.py] Деление осей и подписи к ним #python #matplolib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
# Подключаем модуль управления тиками: | |
import matplotlib.ticker as ticker | |
x = np.linspace(-10, 10, 200) | |
y = 0.01*(x + 9)*(x + 6)*(x - 6)*(x - 9)*x | |
fig, ax = plt.subplots() | |
ax.plot(x, y, color = 'r', linewidth = 3) | |
# Устанавливаем интервал основных делений: | |
ax.xaxis.set_major_locator(ticker.MultipleLocator(2)) | |
# Устанавливаем интервал вспомогательных делений: | |
ax.xaxis.set_minor_locator(ticker.MultipleLocator(1)) | |
# Тоже самое проделываем с делениями на оси "y": | |
ax.yaxis.set_major_locator(ticker.MultipleLocator(50)) | |
ax.yaxis.set_minor_locator(ticker.MultipleLocator(10)) | |
fig.set_figwidth(12) | |
fig.set_figheight(8) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment