tpemartin / 110-1-economic-data-visualization Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://tpemartin.github.io/110-1-Economic-Data-Visualization/
License: MIT License
Home Page: https://tpemartin.github.io/110-1-Economic-Data-Visualization/
License: MIT License
dataSet1 <-
data.frame(
x=1979:2018
)
set.seed(2038)
dataSet1$y <- sample(10:40, length(dataSet1$x), T)
ggplot1 <- list()
ticks <- list()
ticks$major <- seq(1980, 2015, by=5)
ticks$minor <- c(1979, 2018)
majorLength = 3 #input$length
minor_majorRatio = 0.7 #input$ratio
ggplot()+
geom_step(
data=dataSet1,
mapping=
aes(
x=x,
y=y
)
) +
scale_x_continuous(
breaks={
breaks =
c(1979,seq(1985, 2015, by=5),2018)
breaks
},
labels={
labels = c(
"1979", "85", "90", "95", "2000", "05", "10", "15", "18"
)
labels}
) +
theme(
axis.ticks.length.x = unit(0,"mm")
) +
geom_rug(
mapping=aes(
x=ticks$major
),
outside=TRUE, # draw rug outside the plot panel
size=0.5, #input$majorsize
length=grid::unit(
majorLength,
"mm"
)
) +
geom_rug(
mapping=aes(
x=ticks$minor
),
outside = TRUE,
size=0.5, #input$minorsize
length=grid::unit(
minor_majorRatio*majorLength,
"mm"
)
)+
coord_cartesian(clip="off")+
theme(
axis.text.x = element_text(
margin = margin(
12 #input$margin
),
size=16 #input$textSize
))
# the same as
ggplot()+
geom_step(
data=dataSet1,
mapping=
aes(
x=x,
y=y
)
) +
{
list(
scale_x_continuous(
breaks = {
breaks <-
c(1979, seq(1985, 2015, by = 5), 2018)
breaks
},
labels = {
labels <- c(
"1979", "85", "90", "95", "2000", "05", "10", "15", "18"
)
labels
}
),
theme(
axis.ticks.length.x = unit(0, "mm")
),
geom_rug(
mapping = aes(
x = ticks$major
),
outside = TRUE, # draw rug outside the plot panel
size = 0.5, # input$majorsize
length = grid::unit(
majorLength,
"mm"
)
),
geom_rug(
mapping = aes(
x = ticks$minor
),
outside = TRUE,
size = 0.5, # input$minorsize
length = grid::unit(
minor_majorRatio * majorLength,
"mm"
)
),
coord_cartesian(clip = "off"),
theme(
axis.text.x = element_text(
margin = margin(
12 # input$margin
),
size = 16 # input$textSize
)
)
)
}
ggplot1$plot1
ggplot1$plot1 -> # allow drawing outside the plot panel
ggplot1$plot2
ggplot1$plot2
ggplot1$plot2
devtools::install_github("tpemartin/econDV2", force=T)
Then modify your .Rprofile file in your project. Locate gg <- list(...)
change it to
gg <- list(
dash = econDV2::ggdash,
geom = econDV2::ggbrowse,
aes = econDV2::ggaes,
resize_image = econDV2::resize_image
)
ggplot()+
geom_point(
mapping = aes(
x=c(53, 56, 58),
y=c(49, 54.9, 58)
),
shape=21,
color="black",
stroke=1, #input$stroke
fill="blue", #input$fill
size=5 #input$size
)
目前時間: 四 7~9
針對R語言中階使用者且有相當ggplot2程度使用者所設計的資料視覺化課程,本課程主要教授web app互動資訊儀表板的設計,課程目標有:
有要修的同學在以下可以的時段:
可以 按 thumb-up
不可以 按thumb-down
不打算修的不用回應。
Due: Feb. 6
Format: Rmd file with 3 graphs. It's knitted result is like Daily Chart in Economist.
breaks = c(
1979,
seq(1985, 2015, by=5),
2018
)
labels = c(
"1979", "85", "90", "95", "2000", "05", "10", "15", "18"
)
ggplot1 <- list()
ggplot()+
geom_step(
data=dataSet1,
mapping=
aes(
x=x,
y=y
)
) -> ggplot1$plot0
ggplot1$plot0
x=interger
x=discrete
scale_x_discrete
scale_x_continuous
Fine tune x scale
ggplot1$plot0 +
scale_x_continuous(
breaks=breaks,
labels=labels
) -> ggplot1$plot1
ggplot1$plot1
ggplot1$plot1 +
theme(
axis.ticks.length.x=unit(0, "mm")
) -> ggplot1$plot2
ggplot1$plot2
bigyears <-
seq(1980, 2015, by=5)
smallyears <-
seq(1979, 2018)
ggplot1$plot2 +
geom_rug(
aes(
x=bigyears
),
outside = T,
length=unit(
2, #input$bigT
"mm"
)
) +
geom_rug(
aes(
x=smallyears
),
outside = T,
length=unit(
1, #input$smallT
"mm"
)
)+
coord_cartesian(clip="off")
set.seed(2020)
type1 <- function(){
dnorm(1990:2010, mean=1991, sd=3)*2500 -> x
round(x, digits = 0)
}
type2 <- function(){
dnorm(1994:2010, mean=1998, sd=2)*1000->x
round(x, digits=0)
}
type3 <- function(){
dnorm(2002:2010, mean=2005, sd=2.3)*800->x
round(x, digits=0)
}
data_set4 <- data.frame(
year=c(
1990:2010,
1994:2010,
2002:2010),
storage_type=
c(
rep("type1", 21),
rep("type2", 17),
rep("type3", 9)),
sales_amount=c(
type1(),
type2(),
type3()
)
)
This semester I will drop one weekly graph. So if you are too busy preparing your final, you can skip one graph without affecting your grades. But I still encourage to submit your last weekly graph so that I can give you some comments.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.