Various changes.
1 parent 4a0e305 commit e626109098a15474f73390037c2162da2e6a52cd
Mark authored on 6 Mar 2017
Showing 5 changed files
View
2
■■■
latex/lectures/preamble.tex
\newcommand{\hilight}[1]{\setlength{\fboxsep}{1pt}\colorbox{yellow!75}{#1}}
 
% uses the same spacing as \hilight, but does no highlighting. Use on the
% original code when using incremental highlighting.
\newcommand{\nohilight}[1]{\hspace{-0.7\fboxsep}{\fboxrule0pt\fbox{#1}}}
\newcommand{\nohilight}[1]{\setlength{\fboxsep}{1pt}\fboxrule0pt\fbox{#1}}
 
\newcommand{\error}[1]{\colorbox{red!75}{#1}}
 
\tcbset{enhanced,boxsep=0pt,top=6pt,bottom=6pt,left=8pt,right=0pt,drop fuzzy shadow}
View
8
latex/lectures/presentation.tex
\defineTPcolor{inactivecolor}{rgb}{0.1,0.1,0.1}
 
\defineTPcolor{pagecolor}{rgb}{0.87, 0.88, 0.90}
 
\defineTPcolor{textcolor}{rgb}{0.32, 0.32, 0.32}
\defineTPcolor{textcolor}{rgb}{0.25, 0.25, 0.25}
 
\defineTPcolor{emcolor}{rgb}{0.32, 0.32, 0.32}
 
%\backgroundstyle[startcolor=red, midcolor=yellow, endcolor=red, stripes=500]{doublehgradient}
\defineTPcolor{emcolor}{rgb}{0.25, 0.25, 0.25}
 
\include{lecturedetails}
\include{content}
 
View
29
plantuml/class-diagram-tips.md
 
You can also use `[hidden]` to create invisible links solely for the purpose of influencing the layout. Repeating them will increase the likelihood that the classes will be placed closer and even be aligned with each other:
 
' place c2 and c4 closer together
c2 -[hidden]-> c4
c2 -[hidden]-> c4
' repeated again to place c2 and c4 even closer
c2 -[hidden]-> c4
 
NodeSep 45 ' horizontal spacing
RankSep 45 ' vertical spacing
}
 
## Grouping
 
You can influence the layout to ensure classes are grouped together:
 
together {
class c1
class c2
}
 
c1 -- c2
 
## Line style
 
Polylines will occasionally be used. For some line decorations (crows feet for ERD for example) look like crap when wonky angles are used.
 
' straight lines only
skinparam linetype ortho
 
' allow polylines
skinparam linetype polyline
 
## Sequence diagram coloring
 
You can change the colors of the arrows and messages as followings:
 
a -[#red]> b : <color blue> some message</color>
View
107
r/graph-functions.r
 
# create initial plot
if(is.null(ylab)) {
ylab <- "Number of Students"
ylab <- "Count"
}
plot(h,ylim=c(0, ylimit), xlab=xlab, ylab=ylab, sub=subText, axes=FALSE, ...)
 
}
 
# function for producing a scatter plot
 
#pointlabels are labels to be rendered beside each point on the plot
scatter <- function(pointlabels=NULL, x, y, xlab, ylab, maxx=100, maxy=100, fit=FALSE, ...) {
 
# plot x vs y as solid points (thats what the pch=19 means) points
plot(x, y, xlim=c(0,maxx), ylim=c(0,maxy), col="light blue", pch=19, xlab=xlab, ylab=ylab, xaxt='n',yaxt='n', ...)
 
# plot some grid lines
abline(h=seq(0, maxy, 10), col="light grey", lty="solid", lwd=0.5)
abline(v=seq(0, maxx, 10), col="light grey", lty="solid", lwd=0.5)
# abline(a=0, b=1, col="light grey", lwd=0.5)
 
# plot the graph
points(x, y, xlim=c(0,maxx), ylim=c(0,maxy), col="light blue", pch=19, xlab=xlab, ylab=ylab, ...)
 
# cache the original graphics params and shrink the text a bit
op <- par(cex=0.7)
 
# y-axis
LEFT <- 2
axis(LEFT, at=seq(0, maxy, by=10), las=1)
axis(1, at=seq(0, maxx, by=10))
par(op)
 
mtext("Scatter Plot", side=3, line=0.25)
# replot the points with darker outline to create a border around the points
points(x,y, col="dark blue")
# display point labels next to points if they were provided
if(!is.null(pointlabels)) {
# calculate a normalised offset for the x position of the labels
xlabelpos <- x-3.8*(maxx/100)
# render the labels
text(xlabelpos,y,pointlabels, cex=0.5)
}
 
# change plot color
op <- par(col="red")
 
co <- list()
co$x <- x
co$y <- y
 
valid <- is.na(co$x) | is.na(co$y)
valid <- !valid
 
co$x <- co$x[valid]
co$y <- co$y[valid]
if(fit) {
# render a lowess regression
lines(lowess(co))
#abline(reggie)
}
 
# restore original plot params
par(op)
}
 
 
# Sums two vectors in a coalescing fashion.
# If either value in x1 or x2 is NA that the result is the non-NA value.
# If both values in x1 or x2 are NA then the result is NA.
# If neither x1 or x2 is NA then the result is x1 + x2.
# coalescing_sum <- function (x1, x2) {
#
# # Iterative version. Keeping around as an example.
#
# results <- 1:length(x1)
#
# for(i in 1:length(x1)) {
#
# if(xor(is.na(x1[i]),is.na(x2[i]))) {
# results[i] <- ifelse(is.na(x1[i]), 0, x1[i]) + ifelse(is.na(x2[i]), 0, x2[i])
# } else {
# results[i] <- x1[i] + x2[i]
# }
#
# }
#
# return(results)
# }
 
# Sums two vectors in a coalescing fashion.
# If either value in x1 or x2 is NA that the result is the non-NA value.
# If both values in x1 or x2 are NA then the result is NA.
# If neither x1 or x2 is NA then the result is x1 + x2.
coalescing_sum <- function (x, y) {
# keep track of which positions have both values as na
both.na <- is.na(x) & is.na(y)
# zero nas
x[is.na(x)] <- 0
y[is.na(y)] <- 0
# do the sum
z <- x + y;
# replace positions with both na as na
z[both.na] <- NA
 
return(z)
}
 
summaryboxplot <- function(data, formula, drawOutlierLabels=F, extras=NULL, labs=NULL, ...) {
# add padding if adding extras
View
6
xelatex/preamble.tex
\setsansfont{Roboto Condensed}
\setmonofont[Scale=MatchLowercase]{Inconsolata}
 
\usepackage{microtype} % general improvements to typography
\usepackage{listings} % syntax highlighting
\usepackage{lstautogobble} % add-on for listings that auto-gobbles leading spaces in code
 
 
% make \emph do italics (just in case other environments change it)
\renewcommand{\emph}[1]{\textit{#1}}
 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% syntax highlighting %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings} % syntax highlighting
\usepackage{lstautogobble} % add-on for listings that auto-gobbles leading spaces in code
 
% create the fonts for code highlighting
\newcommand\codesize{\fontsize{11}{10}\selectfont}
\newcommand{\codefont}{\ttfamily}