简体   繁体   中英

How do I change x and y axis limits in seaborn

below are my values for x and y coordinates

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()

x = np.random.randint(1,10,10)
y = np.random.randint(-100,10,10)
plt.scatter(x,y)

在此处输入图像描述

how do I change max and min values for x and y coordinates for instance

在此处输入图像描述

if I want to change X-Axis left to -5 and right to 10 likewise Y-Axis Bottom to -100 and top -20

The resulting figure

在此处输入图像描述

Please add this before plt.scattar

plt.xlim([-5, 10])
plt.ylim([-100, -20])

Sincerely yours,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM