dailylog 7-20-20

1 minute read

HOW DO I?

MAKE SUBPLOTS

LIST COMPREHENSION FOR DICTIONARY MAKING

d = {int(k):int(v) for k,v in d.items()}

REPLACE VALUE VAL ROW ITEM IN PANDAS DATAFRAME

df_new = df_new.replace({'executive_leader': 'Old value I do not want'}, 'Office of the CEO')

CONVERT TO MARKDOWN?

jupyter nbconvert --to markdown VG_EDA_5_slideshow.ipynb

REARRANGE COLUMNS

df = df[['mean', '0', '1', '2', '3']]

Annotate a donut?

BEST MATPLOTLIB TUTORIAL EVER Labeling Donut

Use Color Dictionary with SNS palette

color_dict = dict({'Africa':'brown',
                  'Asia':'green',
                  'Europe': 'orange',
                  'Oceania': 'red',
                   'Americas': 'dodgerblue'})

g = sns.scatterplot(x="gdpPercap", y="lifeExp", hue="continent",
              data=gapminder, palette=color_dict,
                   legend='full')
g.set(xscale="log")

DATETIME

from datetime import datetime
datetime.now().strftime('%Y-%m-%d %H:%M:%S')

MODIFY TICK LABELS

SO

.set_xticks
plt.xticks

REMOVE AXIS

SO

ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)

GET COLOR BREWER COLORS COLORBREWER

List of Paletts

Color stuffs palette=[‘green’,’orange’,’brown’,’dodgerblue’,’red’],

install.packages("RColorBrewer")
library(RColorBrewer)
display.brewer.pal(n = 8, name ='GnBu' )


display.brewer.pal(n = 8, name='RdYlGn')

display.brewer.pal(n = 8, name='Set1')
brewer.pal(n = 8, name='Set1')

display.brewer.pal(n=4, name="RdYlGn")
brewer.pal(n=4, name="RdYlGn")

Include a chunk of HTML code within an HTML page?!

SO

  • enclose it in <xmp>LIKE THIS</xmp> tags

Copy file pathname?

Hold down option key

SEABORN INSPIRATION

seaborn.relplot — seaborn 0.10.1 documentation

Visualizing statistical relationships — seaborn 0.10.1 documentation

— TABS

2019_11_03_WK_5_Seaborn

IST718_LAB3_EMI

matplotlib.pyplot.subplots — Matplotlib 3.2.2 documentation

matplotlib.axes.Axes.tick_params — Matplotlib 3.2.2 documentation

seaborn.scatterplot — seaborn 0.10.1 documentation

python - Annotate text in facetgrid of sns relplot - Stack Overflow

python - How to change legend size with matplotlib.pyplot - Stack Overflow

chapter4.pdf

Visualization — pandas 0.25.0.dev0+752.g49f33f0d documentation

python - How to display the value of the bar on each bar with pyplot.barh()? - Stack Overflow

python - Matplotlib horizontal bar chart (barh) is upside-down - Stack Overflow

python - Y values on each stacked bar using matplotlib - Stack Overflow

python - How can I get list of values from dict? - Stack Overflow

python - Create a dictionary with list comprehension - Stack Overflow

pandas replace nan with 0 - Google Search

count - Length of an integer in Python - Stack Overflow

python - Seaborn - change bar colour according to hue name - Stack Overflow

python - Changing width of bars in bar chart created using seaborn.factorplot - Stack Overflow

matplotlib - Python - Pyplot x-axis not showing on graph - Stack Overflow

matplotlib.axes.Axes.bar — Matplotlib 3.3.0 documentation

Setting Different Bar color in matplotlib Python - Stack Overflow

matplotlib.container — Matplotlib 3.3.0 documentation