Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a2-Fish1naTank-Nicolas-Fish #37

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Excel/CarPlots.xlsx
Binary file not shown.
98 changes: 98 additions & 0 deletions Matplotlib/data/cars-sample.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
"","Car","Manufacturer","MPG","Cylinders","Displacement","Horsepower","Weight","Acceleration","Model.Year","Origin"
"5","torino","ford",17,8,302,140,3449,10.5,70,"American"
"6","galaxie 500","ford",15,8,429,198,4341,10,70,"American"
"13","torino (sw)","ford",NA,8,351,153,4034,11,70,"American"
"18","mustang boss 302","ford",NA,8,302,140,3353,8,70,"American"
"21","corona mark ii","toyota",24,4,113,95,2372,15,70,"Japanese"
"24","maverick","ford",21,6,200,85,2587,16,70,"American"
"30","2002","bmw",26,4,121,113,2234,12.5,70,"European"
"32","f250","ford",10,8,360,215,4615,14,70,"American"
"38","corona","toyota",25,4,113,95,2228,14,71,"Japanese"
"39","pinto","ford",25,4,98,NA,2046,19,71,"American"
"44","torino 500","ford",19,6,250,88,3302,15.5,71,"American"
"48","galaxie 500","ford",14,8,351,153,4154,13.5,71,"American"
"51","country squire (sw)","ford",13,8,400,170,4746,12,71,"American"
"56","mustang","ford",18,6,250,88,3139,14.5,71,"American"
"61","corolla 1200","toyota",31,4,71,65,1773,19,71,"Japanese"
"65","corona hardtop","toyota",24,4,113,95,2278,15.5,72,"Japanese"
"69","pinto runabout","ford",21,4,122,86,2226,16.5,72,"American"
"73","galaxie 500","ford",14,8,351,153,4129,13,72,"American"
"82","gran torino (sw)","ford",13,8,302,140,4294,16,72,"American"
"88","pinto (sw)","ford",22,4,122,86,2395,16,72,"American"
"90","corona mark ii (sw)","toyota",23,4,120,97,2506,14.5,72,"Japanese"
"92","corolla 1600 (sw)","toyota",27,4,97,88,2100,16.5,72,"Japanese"
"96","gran torino","ford",14,8,302,137,4042,14.5,73,"American"
"100","ltd","ford",13,8,351,158,4363,13,73,"American"
"108","maverick","ford",18,6,250,88,3021,16.5,73,"American"
"112","country","ford",12,8,400,167,4906,12.5,73,"American"
"116","carina","toyota",20,4,97,88,2279,19,73,"Japanese"
"120","pinto","ford",19,4,122,85,2310,18.5,73,"American"
"131","mark ii","toyota",20,6,156,122,2807,13.5,73,"Japanese"
"134","maverick","ford",21,6,200,NA,2875,17,74,"American"
"138","pinto","ford",26,4,122,80,2451,16.5,74,"American"
"139","corolla 1200","toyota",32,4,71,65,1836,21,74,"Japanese"
"144","gran torino","ford",16,8,302,140,4141,14,74,"American"
"147","gran torino (sw)","ford",14,8,302,140,4638,16,74,"American"
"152","corona","toyota",31,4,76,52,1649,16.5,74,"Japanese"
"157","civic","honda",24,4,120,97,2489,15,74,"Japanese"
"163","maverick","ford",15,6,250,72,3158,19.5,75,"American"
"167","ltd","ford",14,8,351,148,4657,13.5,75,"American"
"174","mustang ii","ford",13,8,302,129,3169,12,75,"American"
"175","corolla","toyota",29,4,97,75,2171,16,75,"Japanese"
"176","pinto","ford",23,4,140,83,2639,17,75,"American"
"179","corona","toyota",24,4,134,96,2702,13.5,75,"Japanese"
"182","pinto","ford",18,6,171,97,2984,14.5,75,"American"
"189","civic cvcc","honda",33,4,91,53,1795,17.5,75,"Japanese"
"198","gran torino","ford",14.5,8,351,152,4215,12.8,76,"American"
"201","maverick","ford",24,6,200,81,3012,17.6,76,"American"
"206","civic","honda",33,4,91,53,1795,17.4,76,"Japanese"
"208","granada ghia","ford",18,6,250,78,3574,21,76,"American"
"213","corolla","toyota",28,4,97,75,2155,16.4,76,"Japanese"
"214","pinto","ford",26.5,4,140,72,2565,13.6,76,"American"
"218","mark ii","toyota",19,6,156,108,2930,15.5,76,"Japanese"
"219","280s","mercedes",16.5,6,168,120,3820,16.7,76,"European"
"222","f108","ford",13,8,302,130,3870,15,76,"American"
"224","accord cvcc","honda",31.5,4,98,68,2045,18.5,77,"Japanese"
"236","granada","ford",18.5,6,250,98,3525,19,77,"American"
"240","thunderbird","ford",16,8,351,149,4335,14.5,77,"American"
"243","corolla liftback","toyota",26,4,97,75,2265,18.2,77,"Japanese"
"244","mustang ii 2+2","ford",25.5,4,140,89,2755,15.8,77,"American"
"250","320i","bmw",21.5,4,121,110,2600,12.8,77,"European"
"253","fiesta","ford",36.1,4,98,66,1800,14.4,78,"American"
"256","civic cvcc","honda",36.1,4,91,60,1800,16.4,78,"Japanese"
"262","fairmont (auto)","ford",20.2,6,200,85,2965,15.8,78,"American"
"263","fairmont (man)","ford",25.1,4,140,88,2720,15.4,78,"American"
"272","futura","ford",18.1,8,302,139,3205,11.2,78,"American"
"275","corona","toyota",27.5,4,134,95,2560,14.2,78,"Japanese"
"278","celica gt liftback","toyota",21.1,4,134,95,2515,14.8,78,"Japanese"
"287","accord lx","honda",29.5,4,98,68,2135,16.6,78,"Japanese"
"290","fairmont 4","ford",22.3,4,140,88,2890,17.3,79,"American"
"294","ltd landau","ford",17.6,8,302,129,3725,13.4,79,"American"
"298","country squire (sw)","ford",15.5,8,351,142,4054,14.3,79,"American"
"305","300d","mercedes",25.4,5,183,77,3530,20.1,79,"European"
"318","corolla tercel","toyota",38.1,4,89,60,1968,18.8,80,"Japanese"
"322","fairmont","ford",26.4,4,140,88,2870,18.1,80,"American"
"326","corona liftback","toyota",29.8,4,134,90,2711,15.5,80,"Japanese"
"329","corolla","toyota",32.2,4,108,75,2265,15.2,80,"Japanese"
"336","240d","mercedes",30,4,146,67,3250,21.8,80,"European"
"337","civic 1500 gl","honda",44.6,4,91,67,1850,13.8,80,"Japanese"
"344","mustang cobra","ford",23.6,4,140,NA,2905,14.3,80,"American"
"345","accord","honda",32.4,4,107,72,2290,17,80,"Japanese"
"351","starlet","toyota",39.1,4,79,58,1755,16.9,81,"Japanese"
"353","civic 1300","honda",35.1,4,81,60,1760,16.1,81,"Japanese"
"356","tercel","toyota",37.7,4,89,62,2050,17.3,81,"Japanese"
"359","escort 4w","ford",34.4,4,98,65,2045,16.2,81,"American"
"360","escort 2h","ford",29.9,4,98,65,2380,20.7,81,"American"
"363","prelude","honda",33.7,4,107,75,2210,14.4,81,"Japanese"
"364","corolla","toyota",32.4,4,108,75,2350,16.8,81,"Japanese"
"370","cressida","toyota",25.4,6,168,116,2900,12.6,81,"Japanese"
"374","granada gl","ford",20.2,6,200,88,3060,17.1,81,"American"
"382","fairmont futura","ford",24,4,140,92,2865,16.4,82,"American"
"390","accord","honda",36,4,107,75,2205,14.5,82,"Japanese"
"391","corolla","toyota",34,4,108,70,2245,16.9,82,"Japanese"
"392","civic","honda",38,4,91,67,1965,15,82,"Japanese"
"393","civic (auto)","honda",32,4,91,67,1965,15.7,82,"Japanese"
"398","granada l","ford",22,6,232,112,2835,14.7,82,"American"
"399","celica gt","toyota",32,4,144,96,2665,13.9,82,"Japanese"
"402","mustang gl","ford",27,4,140,86,2790,15.6,82,"American"
"405","ranger","ford",28,4,120,79,2625,18.6,82,"American"
31 changes: 31 additions & 0 deletions Matplotlib/matplot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches

df = pd.read_csv('data/cars-sample.csv')
df = df.replace(to_replace =["bmw"], value ="#ff0000")
df = df.replace(to_replace =["ford"], value ="#ffff00")
df = df.replace(to_replace =["honda"], value ="#00ff00")
df = df.replace(to_replace =["mercedes"], value ="#0000ff")
df = df.replace(to_replace =["toyota"], value ="#ff00ff")

bmw_patch = mpatches.Patch(color='#ff0000', label='bmw')
ford_patch = mpatches.Patch(color='#ffff00', label='ford')
honda_patch = mpatches.Patch(color='#00ff00', label='honda')
mercedes_patch = mpatches.Patch(color='#0000ff', label='mercedes')
toyota_patch = mpatches.Patch(color='#ff00ff', label='toyota')

scale = 0.1
df['Size'] = df["Weight"] * scale

plt.figure().set_facecolor("#b8c7cc")
plt.grid(which='major', axis='both', color='#b5b5b5', linestyle='-', linewidth=0.1)
scatter = plt.scatter(x='Weight', y='MPG', s='Size', c='Manufacturer', alpha=0.5, data=df)

plt.gca().set_facecolor("#636363")
plt.xlabel('Weight')
plt.ylabel('MPG')
plt.legend(handles=[bmw_patch, ford_patch, honda_patch, mercedes_patch, toyota_patch])

plt.show()
6 changes: 6 additions & 0 deletions R+ggplot2/.Rhistory
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
library("ggplot2")
data <- read.csv(file = "data/cars-sample.csv")
ggplot(data, aes(y=MPG, x=Weight, size=Weight, color=Manufacturer)) + geom_point(alpha = 0.5)
ggsave('R+ggplot2.png')
save.image("D:\\School\\WPI\\20-21\\21 C\\Data vis\\Repos\\02-DataVis-5Ways-1\\R+ggplot2\\5ways.RData")
q()
Binary file added R+ggplot2/5ways.RData
Binary file not shown.
Binary file added R+ggplot2/R+ggplot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions R+ggplot2/RScript.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
library("ggplot2")
data <- read.csv(file = "data/cars-sample.csv")
ggplot(data, aes(y=MPG, x=Weight, size=Weight, color=Manufacturer)) + geom_point(alpha = 0.5)
ggsave('R+ggplot2.png')
98 changes: 98 additions & 0 deletions R+ggplot2/data/cars-sample.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
"","Car","Manufacturer","MPG","Cylinders","Displacement","Horsepower","Weight","Acceleration","Model.Year","Origin"
"5","torino","ford",17,8,302,140,3449,10.5,70,"American"
"6","galaxie 500","ford",15,8,429,198,4341,10,70,"American"
"13","torino (sw)","ford",NA,8,351,153,4034,11,70,"American"
"18","mustang boss 302","ford",NA,8,302,140,3353,8,70,"American"
"21","corona mark ii","toyota",24,4,113,95,2372,15,70,"Japanese"
"24","maverick","ford",21,6,200,85,2587,16,70,"American"
"30","2002","bmw",26,4,121,113,2234,12.5,70,"European"
"32","f250","ford",10,8,360,215,4615,14,70,"American"
"38","corona","toyota",25,4,113,95,2228,14,71,"Japanese"
"39","pinto","ford",25,4,98,NA,2046,19,71,"American"
"44","torino 500","ford",19,6,250,88,3302,15.5,71,"American"
"48","galaxie 500","ford",14,8,351,153,4154,13.5,71,"American"
"51","country squire (sw)","ford",13,8,400,170,4746,12,71,"American"
"56","mustang","ford",18,6,250,88,3139,14.5,71,"American"
"61","corolla 1200","toyota",31,4,71,65,1773,19,71,"Japanese"
"65","corona hardtop","toyota",24,4,113,95,2278,15.5,72,"Japanese"
"69","pinto runabout","ford",21,4,122,86,2226,16.5,72,"American"
"73","galaxie 500","ford",14,8,351,153,4129,13,72,"American"
"82","gran torino (sw)","ford",13,8,302,140,4294,16,72,"American"
"88","pinto (sw)","ford",22,4,122,86,2395,16,72,"American"
"90","corona mark ii (sw)","toyota",23,4,120,97,2506,14.5,72,"Japanese"
"92","corolla 1600 (sw)","toyota",27,4,97,88,2100,16.5,72,"Japanese"
"96","gran torino","ford",14,8,302,137,4042,14.5,73,"American"
"100","ltd","ford",13,8,351,158,4363,13,73,"American"
"108","maverick","ford",18,6,250,88,3021,16.5,73,"American"
"112","country","ford",12,8,400,167,4906,12.5,73,"American"
"116","carina","toyota",20,4,97,88,2279,19,73,"Japanese"
"120","pinto","ford",19,4,122,85,2310,18.5,73,"American"
"131","mark ii","toyota",20,6,156,122,2807,13.5,73,"Japanese"
"134","maverick","ford",21,6,200,NA,2875,17,74,"American"
"138","pinto","ford",26,4,122,80,2451,16.5,74,"American"
"139","corolla 1200","toyota",32,4,71,65,1836,21,74,"Japanese"
"144","gran torino","ford",16,8,302,140,4141,14,74,"American"
"147","gran torino (sw)","ford",14,8,302,140,4638,16,74,"American"
"152","corona","toyota",31,4,76,52,1649,16.5,74,"Japanese"
"157","civic","honda",24,4,120,97,2489,15,74,"Japanese"
"163","maverick","ford",15,6,250,72,3158,19.5,75,"American"
"167","ltd","ford",14,8,351,148,4657,13.5,75,"American"
"174","mustang ii","ford",13,8,302,129,3169,12,75,"American"
"175","corolla","toyota",29,4,97,75,2171,16,75,"Japanese"
"176","pinto","ford",23,4,140,83,2639,17,75,"American"
"179","corona","toyota",24,4,134,96,2702,13.5,75,"Japanese"
"182","pinto","ford",18,6,171,97,2984,14.5,75,"American"
"189","civic cvcc","honda",33,4,91,53,1795,17.5,75,"Japanese"
"198","gran torino","ford",14.5,8,351,152,4215,12.8,76,"American"
"201","maverick","ford",24,6,200,81,3012,17.6,76,"American"
"206","civic","honda",33,4,91,53,1795,17.4,76,"Japanese"
"208","granada ghia","ford",18,6,250,78,3574,21,76,"American"
"213","corolla","toyota",28,4,97,75,2155,16.4,76,"Japanese"
"214","pinto","ford",26.5,4,140,72,2565,13.6,76,"American"
"218","mark ii","toyota",19,6,156,108,2930,15.5,76,"Japanese"
"219","280s","mercedes",16.5,6,168,120,3820,16.7,76,"European"
"222","f108","ford",13,8,302,130,3870,15,76,"American"
"224","accord cvcc","honda",31.5,4,98,68,2045,18.5,77,"Japanese"
"236","granada","ford",18.5,6,250,98,3525,19,77,"American"
"240","thunderbird","ford",16,8,351,149,4335,14.5,77,"American"
"243","corolla liftback","toyota",26,4,97,75,2265,18.2,77,"Japanese"
"244","mustang ii 2+2","ford",25.5,4,140,89,2755,15.8,77,"American"
"250","320i","bmw",21.5,4,121,110,2600,12.8,77,"European"
"253","fiesta","ford",36.1,4,98,66,1800,14.4,78,"American"
"256","civic cvcc","honda",36.1,4,91,60,1800,16.4,78,"Japanese"
"262","fairmont (auto)","ford",20.2,6,200,85,2965,15.8,78,"American"
"263","fairmont (man)","ford",25.1,4,140,88,2720,15.4,78,"American"
"272","futura","ford",18.1,8,302,139,3205,11.2,78,"American"
"275","corona","toyota",27.5,4,134,95,2560,14.2,78,"Japanese"
"278","celica gt liftback","toyota",21.1,4,134,95,2515,14.8,78,"Japanese"
"287","accord lx","honda",29.5,4,98,68,2135,16.6,78,"Japanese"
"290","fairmont 4","ford",22.3,4,140,88,2890,17.3,79,"American"
"294","ltd landau","ford",17.6,8,302,129,3725,13.4,79,"American"
"298","country squire (sw)","ford",15.5,8,351,142,4054,14.3,79,"American"
"305","300d","mercedes",25.4,5,183,77,3530,20.1,79,"European"
"318","corolla tercel","toyota",38.1,4,89,60,1968,18.8,80,"Japanese"
"322","fairmont","ford",26.4,4,140,88,2870,18.1,80,"American"
"326","corona liftback","toyota",29.8,4,134,90,2711,15.5,80,"Japanese"
"329","corolla","toyota",32.2,4,108,75,2265,15.2,80,"Japanese"
"336","240d","mercedes",30,4,146,67,3250,21.8,80,"European"
"337","civic 1500 gl","honda",44.6,4,91,67,1850,13.8,80,"Japanese"
"344","mustang cobra","ford",23.6,4,140,NA,2905,14.3,80,"American"
"345","accord","honda",32.4,4,107,72,2290,17,80,"Japanese"
"351","starlet","toyota",39.1,4,79,58,1755,16.9,81,"Japanese"
"353","civic 1300","honda",35.1,4,81,60,1760,16.1,81,"Japanese"
"356","tercel","toyota",37.7,4,89,62,2050,17.3,81,"Japanese"
"359","escort 4w","ford",34.4,4,98,65,2045,16.2,81,"American"
"360","escort 2h","ford",29.9,4,98,65,2380,20.7,81,"American"
"363","prelude","honda",33.7,4,107,75,2210,14.4,81,"Japanese"
"364","corolla","toyota",32.4,4,108,75,2350,16.8,81,"Japanese"
"370","cressida","toyota",25.4,6,168,116,2900,12.6,81,"Japanese"
"374","granada gl","ford",20.2,6,200,88,3060,17.1,81,"American"
"382","fairmont futura","ford",24,4,140,92,2865,16.4,82,"American"
"390","accord","honda",36,4,107,75,2205,14.5,82,"Japanese"
"391","corolla","toyota",34,4,108,70,2245,16.9,82,"Japanese"
"392","civic","honda",38,4,91,67,1965,15,82,"Japanese"
"393","civic (auto)","honda",32,4,91,67,1965,15.7,82,"Japanese"
"398","granada l","ford",22,6,232,112,2835,14.7,82,"American"
"399","celica gt","toyota",32,4,144,96,2665,13.9,82,"Japanese"
"402","mustang gl","ford",27,4,140,86,2790,15.6,82,"American"
"405","ranger","ford",28,4,120,79,2625,18.6,82,"American"
Loading