Skip to content

Commit

Permalink
esimene koduülesanne tehtud
Browse files Browse the repository at this point in the history
  • Loading branch information
miumer committed Feb 18, 2021
1 parent 4c1daf6 commit 22d50f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .Rproj.user/shared/notebooks/paths
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/home/john/Dokumendid/R_Projects/uia_kvant_loengud/Kodutoo_1.Rmd="5E73D97C"
/home/john/Dokumendid/R_Projects/ut_andmeviz/Praktikum2.Rmd="E7063418"
/Users/siimpoldre/Documents/r_projects/ut_andmeviz/Praktikum2.Rmd="8FA58822"
18 changes: 13 additions & 5 deletions Praktikum2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ popViewport()
pushViewport(viewport(x = 0.8, y = 0.9, height = 0.75, width = 0.7, just = c(1, 1)))
grid.points(x = eyecolor$eye_scaled, y = eyecolor$count_scaled, pch = 19, gp = gpar(col = eyecolor$gender_color))
grid.xaxis(at = c(0.2, 0.4, 0.6, 0.8), label = c("Helepruun", "Pruun", "Roheline", "Sinine"))
grid.yaxis(at = grid.pretty(c(0, 122)) / max(eyecolor$count), label = grid.pretty(c(31, 122)))
grid.yaxis(at = grid.pretty(c(0, 122)) / max(eyecolor$count), label = grid.pretty(c(0, 122)))
popViewport()
# Pealkiri
Expand Down Expand Up @@ -445,20 +445,28 @@ popViewport()

- Kasutades õpitud käske joonista sama andmestik välja tulpdiagrammina. Kas tulbad on kõrvuti, üksteise otsas, jagatud tahkudeks või leitud mõni muu lahendus jääb juba enda otsustada.

```{r}
#värvi ja sugu kombineeriv skaleerimine
eyecolor <- eyecolor %>%
mutate(col_gen_scaled = eye_scaled-(as.numeric(as.factor(gender))-1)*0.05)
```


```{r}
grid.newpage()
# Legend
pushViewport(viewport(x = 0.8, y = 0, height = 1, width = 0.2, just = c(0, 0)))
grid.rect()
grid.text(label = "Legend")
grid.rect(x = 0.1, y = c(0.5, 0.55), height = 0.03, width = 0.1, gp = gpar(fill = unique(eyecolor$gender_color)))
grid.text(x = 0.35, y = c(0.5, 0.55), label = unique(eyecolor$gender))
popViewport()
# Graafik
pushViewport(viewport(x = 0.8, y = 0.9, height = 0.75, width = 0.7, just = c(1, 1)))
grid.rect(x = eyecolor$eye_scaled, y = 0, height = eyecolor$count_scaled, width = 0.1, gp = gpar(col = eyecolor$gender_color))
grid.rect(x = eyecolor$col_gen_scaled, y = 0, height = eyecolor$count_scaled, width = 0.05,
gp = gpar(fill = eyecolor$gender_color), just = c(0,0))
grid.xaxis(at = c(0.2, 0.4, 0.6, 0.8), label = c("Helepruun", "Pruun", "Roheline", "Sinine"))
grid.yaxis(at = grid.pretty(c(0, 122)) / max(eyecolor$count), label = c(31, grid.pretty(c(31, 120)),122))
grid.yaxis(at = grid.pretty(c(0, 122)) / max(eyecolor$count), label = grid.pretty(c(0, 122)))
popViewport()
# Pealkiri
Expand Down

0 comments on commit 22d50f3

Please sign in to comment.