Today I train on Python skills.
All code is in R except where commented prior as “# Python code”
library(reticulate) # to enable python code chunks in R Markdown
Matplotlib is a visualization package/library.
# Python code # Import matplotlib import matplotlib.pyplot as plt
Using example data
# Python code # Create some data year = [1950, 1970, 1990, 2010] pop = [2.519, 3.692, 5.263, 6.972]
# Python code # Line plot plt.plot(year, pop) plt.xlabel('Year') plt.ylabel('Population') plt.title('Population Projections') plt.show()
# Python code # Scatterplot plt.scatter(year, pop) plt.show()
I tried to import a data set as csv and use pandas as well. What I found was that it’s not possible to use R Markdown interactively with Python commands. I do want to get Python work published in this blog, to do so I will follow this approach;
- Learn Python in terminal and anaconda
- Figure out how to publish HTML jupyter notebooks
- Figure out how to deploy those notebooks into this website