Python Bubble Chart

# bubble chart using matplotlib and pandas # place legend outside plot import pandas import matplotlib.pyplot as plt import matplotlib.patches as mpatches %matplotlib inline pandas.set_option('max_columns', 10) # put in path/filename (see csv data below) # data can also be found in data section of world bank site df = pandas.read_csv('path/file_name.csv') plt.scatter(x=df['GDP Per Capita'], y=df['Lifespan'], s=df['Population']/1000, … Continue reading Python Bubble Chart

R Histogram

# histogram # change size of chart library(repr) options(repr.plot.width=4, repr.plot.height=4) hist(mtcars$mpg) # type of histogram using plot # use par las=numeric in {0,1,2,3}; the style of axis labels plot(cut(mtcars$mpg, breaks = 5), las=2) print(sort(mtcars$mpg)) # prints [1] 10.4 10.4 13.3 14.3 14.7 15.0 15.2 15.2 15.5 15.8 16.4 17.3 17.8 18.1 18.7 [16] 19.2 19.2 … Continue reading R Histogram

R Summary Statistics

# load data data(mtcars) # stats summary (Min, 1st Qu., Median, Mean, 3rd Qu., Max) data_summary <- summary(mtcars$mpg) print(data_summary) # prints Min. 1st Qu. Median Mean 3rd Qu. Max. 10.40 15.43 19.20 20.09 22.80 33.90 # five number summary (minimum, lower-hinge, median, upper-hinge, maximum) five_summary <- fivenum(mtcars$mpg) print(five_summary) # prints [1] 10.40 15.35 19.20 22.80 … Continue reading R Summary Statistics

Python Basemap

# some IDEs, editors will need plt.show() from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np   # **********CREATE AND DISPLAY A MAP********** m1 = Basemap(projection='cyl') m1.drawcoastlines() # m1.drawcountries() # Different Types of Map Backgrounds # m1.bluemarble() # m1.shadedrelief() # m1.etopo() # m1.drawrivers(color='blue') # m1.fillcontinents(color='beige', lake_color='blue') # m1.drawmapboundary(color='g', linewidth=5.0, fill_color=None, zorder=None, ax=None) … Continue reading Python Basemap