1

I have a series of values like that with 80 entries.

Index      Value
35        100000
77      20000000
94         83400
153     12700000
189        82600
          ...   
7118      132050
7200        1800
7240      257710
7409    40000000
7736     1000000

When I plot it against a categorical variable it produces this 1e8 notation and squeezes most of my values around the 0.0 y tick label.

enter image description here

My code:

f,ax=plt.subplots(figsize=(12,8))
ax=sb.swarmplot(x=df['col1'], y=df['col2'], data=df)

How can I not have this 1e8 notation and spread my scatter points they can be distinctively visualized?

UPDATE: I included ax.set(yscale="log") and edited the y_tick_labels and it looks better. Thanks all.

ax.set(yscale="log")
ax.set_yticklabels(['100','1000','10000','100,000','1,000,000','10mil','100mil'])

enter image description here

tripleee
  • 175,061
  • 34
  • 275
  • 318
Fuustack
  • 21
  • 2

1 Answers1

1

Consider using logarithmic scale for your plot:

plt.xscale('log')

See matplotlib documentation for more details.

Or in seaborn:

f,ax=plt.subplots(figsize=(12,8))
ax.set(xscale="log")
ax=sb.swarmplot(x=df['col1'], y=df['col2'], data=df)
NesteruS
  • 64
  • 3