Kingsley121
Kingsley121

Reputation: 11

how do i create a scatter plot in pycharm 2019 IDE

import pandas as pd
import matplotlib.pyplot as plt
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
path = "https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DA0101EN/auto.csv"
df = pd.read_csv(path)
headers = ["symboling","normalized-losses","make","fuel-type","aspiration", "num-of-doors","body-style",
         "drive-wheels","engine-location","wheel-base", "length","width","height","curb-weight","engine-type",
         "num-of-cylinders", "engine-size","fuel-system","bore","stroke","compression-ratio","horsepower",
         "peak-rpm","city-mpg","highway-mpg","price"]
df.columns = headers
y = df["price"]
x = df["engine-size"]
plt.xlabel("engine")
plt.ylabel("price")
plt.title("Price Vs Engine size")
plt.scatter(x, y)

And after this i get "finished with exit code 0" and i don't see any scatter diagram

Upvotes: 0

Views: 2167

Answers (1)

snatchysquid
snatchysquid

Reputation: 1352

Have you tried using plt.show() at the end?

Upvotes: 4

Related Questions