hope this fix your issue It seems that sns.pointplot simply uses an array of [0...n-1] as x values and then uses the x values that you provide to label the ticks on the x-axis. You can check that by looking at ax.get_xlim() which outputs [-0.5, 4.5]. Therefore, when you provide the actual x values to plt.plot they just seem to be at a wrong position. I wouldn't say that this is a bug, since seaborn considers the input to pointplot to be categorial (here's the documentation for more info)
fixed the issue. Will look into that further I want to plot the results of a 5K and a 10K run in Python with matplotlib and seaborn. My dataset has a column time that contains a string object in a HH:MM:SS format, like 00:28:50 or 1:17:23, with the race results. I created my plot by calculating the time in seconds, but I prefer the actual time in HH:MM:SS format on the axis for readability. , One thing you could do is to modify the ticks manually:
palette = ['#3498db', '#ff0080']
fig, ax = plt.subplots(figsize=(16, 8))
sns.boxplot(ax=ax, data=df, x='time_sec', y='race', hue='sex', order=order, palette=palette, orient='h', linewidth=2.5)
# get the ticks
ticks = ax.get_xticks()
# convert the ticks to string
plt.title('Time in seconds', fontsize=16)
Python matplotlib/seaborn plot bar chart subcategories
With these it helps How can I plot a bar graph for categorical feature containing values male and female to another column containing binary values like 0 and 1 such that x axis contains the male and female whereas y axis contains the number of values of 0 and 1 corresponding to male and female on y axis.
Python Matplotlib/Seaborn/Jupyter - Putting bar plot in wrong place?
This might help you You see two axes in Jupyter because you create a fresh one with plt.subplots() and pandas also creates another one. If you need to reuse an existing axe, pass it to plotting method using ax switch: