0

Executing the following:

g = sns.catplot(
    x="price",
    y="neigh",
    kind="bar",
    data=top_bot)
g = g.set(title = "Mean of the top and bottom prices (euros) by neighbour")

enter image description here

The x ticks are being converted to scientific notation. I would like to specify the ticks to use, and also remove the scientific notation from them. I tried several approaches already posted in ´SO´, but the problem is that neither of them worked specifically with catplot.

Edit: This solution doesn't solve my problem at all. For plt.ticklabel_format(style='plain', axis='y') creates an empty plot, followed by the same plot in scientific notation. and for sns.plt.ticklabel_format(style='plain', axis='y',useOffset=False) it outputs AttributeError: module 'seaborn' has no attribute 'plt'

buhtz
  • 10,774
  • 18
  • 76
  • 149
Norhther
  • 545
  • 3
  • 15
  • 35

1 Answers1

0

This is how to use seaborn and matplotlib functionality together. You have to create a matplotlib figure first and make all the changes you need. Than call the seaborn function and adding the information about the axes you want to use.

This is a working minimal example.

import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
# data
top_bot = pd.DataFrame({'price':[i*100000000 for i in range(5)], 'neigh': range(10,15)})
# creating figure
f, ax = plt.subplots()
ax.ticklabel_format(style='plain', axis='both')
sns.barplot(x='price', y='neigh', data=top_bot, ax=ax)

This example in different from your picture, because you did not share the data you have plotted and the code you tried.

I hope this answers your question.

mosc9575
  • 5,618
  • 2
  • 9
  • 32