我怎样才能调整一个海生婴儿的尺寸?

2024-04-19 05:40:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图创建一个16x10的显示,但只得到一个平方输出

下面是用于创建绘图的代码。有很多内容是不需要发布的

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = [16, 10]

sns.set_theme(context='paper', style='darkgrid', palette="Paired", 
              font_scale=2)
custom_style = {'axes.facecolor': 'white',
                 'axes.edgecolor': 'black',
                 'axes.grid': False,
                 'axes.axisbelow': True,
                 'axes.labelcolor': 'black',
                 'figure.facecolor': 'white',
                 'grid.color': '.8',
                 'grid.linestyle': '-',
                 'text.color': 'black',
                 'xtick.color': 'black',
                 'ytick.color': 'black',
                 'xtick.direction': 'out',
                 'ytick.direction': 'out',
                 'lines.solid_capstyle': 'round',
                 'patch.edgecolor': 'w',
                 'patch.force_edgecolor': True,
                 'image.cmap': 'rocket',
                 'font.family': ['sans-serif'],
                 'font.sans-serif': ['Arial', 'DejaVu Sans', 'Liberation Sans', 
                                     'Bitstream Vera Sans', 'sans-serif'], 
                 'xtick.bottom': True,
                 'xtick.top': False,
                 'ytick.left': True,
                 'ytick.right': False,
                 'axes.spines.left': True,
                 'axes.spines.bottom': True,
                 'axes.spines.right': False,
                 'axes.spines.top': False}
# White background with ticks and black border lines, Turns grid off
ax = sns.set_style(rc=custom_style)

# Normal distribution plots
f, ax = plt.subplots()
sns.set_context("paper", 
                rc={"font.size":12,"axes.titlesize":8,"axes.labelsize":12})
ax = sns.displot(data=df_no_Nan, x=TAA, hue=R, hue_order=[Eq, Po], 
                 kind="kde", fill=True, legend=False)
ax.set(xlabel=OrientationUnit)

# Legend
plt.legend(labels=[Eq, Po], loc='best').set_title("Region") # legend

# Axis limits
ax.set(ylim=(0, None))
ax.set(xlim=(0, 90))

enter image description here 我不知道为什么尺寸没有调整绘图。提前谢谢你


Tags: falsetruestylepltaxgridcolorblack