-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatplotlib.py
More file actions
53 lines (34 loc) · 1.42 KB
/
Matplotlib.py
File metadata and controls
53 lines (34 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
%matplotlib notebook #to generate all plots in same browser in jupyter
df = pd.read_csv(url / file path, headers) --df will be pandas dataframe which will have all data of headers mentioned in URL/File path
y = df["param1"]
x = df["param2"]
fig = plt.figure(figsize =(10, 7)) -- Size of figure
# Create a dot on x,y position
plt.plot(x,y,'o')
df.plot(kind="line") #line graph of complete dataframe
df["Column_name"].plot(kind = "hist") #histogram of perticular column in dataframe
# Creating plot
plt.boxplot(x) -- Create box plot of x -- param2
plt.scatter(x,y) -- Create scatter plot of x vs y
plt.title("My title of the plot will come here")
plt.xlable("Label of X axis")
plt.ylable("Label of Y axis")
plt.show() --show plot
#heatmap
plt.pcolor(df_pivot, cmap="RdBu") -- Red blue
plt.colorbar()
#Regression plot for model evaluation
sns.regpot( x = "parameter of x", y ="paramter for y", data = dataframe)
#Residual plot for error in prediction
sns.regpot( data1, data2) -- Where data1 and data2 are parameters for which we're seeking relationship
#Distribution plot to evaluate the model work
ax1 = sns.distplot(df[prediction], label = "Actual value")
sns.distplot(Yhat, label = "Fitted values", ax=ax1)
#Histogram plot
sns.histplot(x=df_train['weight'],bins=80)
#Scatter plot for regression to visualize
sns.pairplot(resp)