Skip to content

Commit

Permalink
мелкие правки, в т.ч. новая тема hrbrthemes
Browse files Browse the repository at this point in the history
  • Loading branch information
iMissile committed Mar 6, 2017
1 parent 6da78df commit 17c89b6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
15 changes: 14 additions & 1 deletion 05 APDEX/apdex_calc_v3.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ library(lubridate)
#library(scales)
#library(forecast)
library(stringr)
library(hrbrthemes)
#library(RColorBrewer)

# gf <- c(4,5,6)
Expand Down Expand Up @@ -190,10 +191,15 @@ end_time <- max(mydata$timestamp)
# ïîñòàâèòü ôèêñèðîâàííûå ãðàíèöû + öâåòíûå ãîðèçîíòàëüíûå ëèíèè
qplot(timestamp, apdex, data = mydata, geom = c("point", "smooth"))

# windowsFonts(Verdana="TT Verdana")
windowsFonts(robotoC="Roboto Condensed")

dfplot <- ggplot(mydata, aes(timestamp, apdex)) +
#scale_x_date(labels = date_format("%d %b %Y"), breaks = date_breaks("week")) +
# scales http://stackoverflow.com/questions/3606697/how-to-set-limits-for-axes-in-ggplot2-r-plots
theme_ipsum_rc(base_family="robotoC", base_size = 11.5) +
# theme_ipsum() +
# theme_bw(base_size = 12, base_family = "") +
ylim(0, 1) +
# http://research.stowers-institute.org/efg/R/Color/Chart/ColorChart.pdf
# APDEX èíäèêàòîðû/ 0.94, 0.85, 0.7, 0.5
Expand All @@ -206,7 +212,6 @@ dfplot <- ggplot(mydata, aes(timestamp, apdex)) +
geom_hline(aes(yintercept=.7), colour="yellow", linetype="dashed", size=1) +
geom_hline(aes(yintercept=.5), colour="red", linetype="dashed", size=1) +
geom_line() +
theme_bw(base_size = 12, base_family = "") +
# geom_density(alpha = 0.3) +
xlab("Äàòà") +
ylab("APDEX")
Expand All @@ -221,6 +226,14 @@ print(dfplot) #end of print statement
dev.off() #close the png device to save the figure.

stop("Ñêðèïò çàâåðøåí")
# ============================================
# https://github.com/wch/extrafont

# Vector of font family names
fonts()

# Show entire table
fonttable()

# ============================================

Expand Down
10 changes: 5 additions & 5 deletions 51 habr/habr.wpu
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
'history': {},
'launch-id': None,
'sel-line': 2L,
'sel-line-start': 146L,
'selection_end': 146L,
'selection_start': 146L}),
'sel-line-start': 145L,
'selection_end': 145L,
'selection_start': 145L}),
('bookmarks',
'wide',
1,
Expand Down Expand Up @@ -413,8 +413,8 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
'splits': 2,
'tab_location': 'left',
'user_data': {}},
'window-alloc': (16,
61,
'window-alloc': (-70,
189,
1900,
1008)}]}
guimgr.recent-documents = [loc('excel_convert.py')]
Expand Down
6 changes: 3 additions & 3 deletions 64 DC_heatmap/faceted_heatmaps.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ windowsFonts(Verdana="TT Verdana")

gg = ggplot(wkdays, aes(x=hour, y=wkday, fill=n))
gg = gg + geom_tile(color="white", size=0.1)
gg = gg + scale_fill_viridis(option="B", name="# Events", label=comma) # https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html
gg = gg + scale_fill_viridis(option="B", name="KPI", label=comma) # https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html
#gg = gg + scale_fill_distiller(palette="RdYlGn", name="# Events", label=comma) # http://docs.ggplot2.org/current/scale_brewer.html
#gg = gg + coord_equal()
gg = gg + coord_fixed(ratio = 1)
gg = gg + labs(x=NULL, y=NULL, title="Events per weekday & hour of day")
gg = gg + labs(x=NULL, y=NULL, title="KPI ïî ÷àñàì è äíÿì íåäåëè")
gg = gg + theme_tufte(base_family="Verdana")
gg = gg + theme(plot.title=element_text(hjust=0))

Expand All @@ -76,7 +76,7 @@ if(TRUE){
# ==================íåýôôåêòèâíîå ïðèìåíåíèå map!!!!Âñå èç-çà tz è ïîøòó÷íîé îáðàáîòêè
if(FALSE){
# ðàáî÷åå ðåøåíèå îòñþäà: https://github.com/rstudio/rstudio-conf/tree/master/2017/List_Columns-Jenny_Bryan
attacks <- attacks %>%
attacks <- attacks_raw %>%
# mutate(rt=map(.$timestamp, ~ ymd_hms(.x, quiet=FALSE))) %>% # ñ ýòèì ïîäõîäîì ~ â 8 ðàç ìåäëåííåå
mutate(rt=ymd_hms(timestamp, quiet=FALSE)) %>%
mutate(hour=as.numeric(map2(.$rt, .$tz, ~ format(.x, "%H", tz=.y)))) %>%
Expand Down
11 changes: 8 additions & 3 deletions 66 availability_calc/calc5.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,17 @@ spta_df
options(digits=22)
mttr_value <- c(1, 4, 24, 72) # óêàçàíî âðåìÿ â ÷àñàõ íà âîññòàíîâëåíèå
# ïîêàçàòåëè mtbf ïîëó÷àþòñÿ íå ñîâñåì ïîíÿòíûå.
# Âèäèìî ïîòîìó, ÷òî äóáëü ïî ïëîùàäêàì èäåò
df <-
equip_df %>% group_by(model, role) %>%
summarise(mtbf_series=1/sum(1/mtbf_n)) %>%
equip_df %>% group_by(model, role, site) %>%
summarise(mtbf_series=1/sum(1/mtbf_n_year))
df <- df %>%
mutate(res=map(mtbf_series, function(x){ tibble(mttr=mttr_value, avail=x / (x + mttr_value/(24*365)))})) %>%
unnest() %>%
mutate(mtbf_series=mtbf_series/(24*365))
mutate(mtbf_series=mtbf_series)
#mutate(spta=total*afr7/100) %>%
#arrange(desc(spta))
Expand Down

0 comments on commit 17c89b6

Please sign in to comment.