0

I have a scatter plot im working with and for some reason im not seeing all the x values on my graph

#%%
from pandas import DataFrame, read_csv
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

file = r"re2.csv"
df = pd.read_csv(file)


#sns.set(rc={'figure.figsize':(11.7,8.27)})

g = sns.FacetGrid(df, col='city')
g.map(plt.scatter, 'type', 'price').add_legend()

image of plot

This is an image of a small subset of my plots, you can see that Res is displaying, the middle bar should be displaying Con and the last would be Mlt. These are all defined in the type column from my data set but are not displaying.

Any clue how to fix?

StupidWolf
  • 45,075
  • 17
  • 40
  • 72
humanPlus
  • 9
  • 1
  • can you share the file? I want to code it out – user27286 Mar 28 '20 at 21:40
  • Do you have the latest versions of pandas and seaborn installed? – JohanC Mar 28 '20 at 21:52
  • http://www.filedropper.com/forstack Heres a link with my file as well as the dataset I'm using To my knowledge i have the latest versions of both pandas and seaborn as they were installed recently, I can check and make sure though. Was this a bug in previous versions? – humanPlus Mar 28 '20 at 22:18
  • Could you provide a [mcve] within the question? (Also see https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – ImportanceOfBeingErnest Mar 28 '20 at 22:34

1 Answers1

0

Python is doing what you tell it to do. Just pick different features, presumably things that make more sense for plotting, if you want to generate a more interesting plots. See this generic example below.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme(style="darkgrid")

tips = sns.load_dataset("tips")
sns.relplot(x="total_bill", y="tip", hue="smoker", data=tips);

enter image description here

Personally, I like plotly plots, which are dynamic, more than I like seaborn plots.

https://plotly.com/python/line-and-scatter/

ASH
  • 20,759
  • 19
  • 87
  • 200