By default, Blogdown uses the system Python installation. To tell Blogdown to use a different version of Python, e.g., Python 3 installed via Homebrew, one needs to configure a different engine in Knitr:
knitr::opts_chunk$set(engine.path = list(python = '/usr/local/bin/python3')) I include this line in my ~/.Rprofile. Now you can test to ensure that it is using the specified version of Python:
import sys print(sys.version) ## 3.9.5 (default, May 4 2021, 03:36:27) ## [Clang 12.
One way to include Matplotlib plots in Rmarkdown files within Blogdown is to save them to the /static directory. Files in this directory are then copied over to the /public directory for publishing.
pwd mkdir -p ../../static/post/2017-10-28-using-python-s-matplotlib-with-rmarkdown_files # The p flag will create the directory (and intermediate subdirectories) if it doesn't exist, otherwise will do nothing ## /Users/zac/git/zacbook.net/content/post knitr::current_input() # will return the name of the Rmd file ## [1] "2017-10-28-using-python-s-matplotlib-with-rmarkdown.
R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
You can embed an R code chunk like this:
summary(cars) ## speed dist ## Min. : 4.0 Min. : 2.00 ## 1st Qu.:12.0 1st Qu.: 26.00 ## Median :15.0 Median : 36.00 ## Mean :15.4 Mean : 42.
Check out how Tranquilpeak theme display well HTML elements (title, paragraph, blockquote, table and more..). It’s simple and elegant.
Tranquilpeak Hugo theme have its own theme to highlight source code. It’s based on GitHub theme: simple and elegant. Check out how it sublimate source codes.