Thetazero Pubs
ikochergin
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.4

?????????? ? ?????????

????? ????? ?????? ? ??????? ?????? ???????????.


??? ?????? ?? ?????? ??????

myfigure <- matrix( c( c(-5, 4), c(-7, 4), c(-9, 6),c(-11,6),c(-12,5), + c(-14,5),c(-12,4),c(-14,3),c(-12,3),c(-11,2),c(-10,2),c(-9, 1), + c(-9,0),c(-8,-2),c(0,-3),c(3,-2),c(19,-2),c(4,0),c(19,4),c(4,2), + c(2,3),c(6,9),c(10,11),c(3,11),c(1,10), c(-5, 4)) ,nrow=2)
mypoint <- c(-10.5, 4.5)
dim(myfigure)
## [1]  2 26
rownames(myfigure) <- c("x","y")
myfigure.df <-  as.data.frame(t(myfigure))
str(myfigure.df)
## 'data.frame':    26 obs. of  2 variables:
##  $ x: num  -5 -7 -9 -11 -12 -14 -12 -14 -12 -11 ...
##  $ y: num  4 4 6 6 5 5 4 3 3 2 ...

? ?????? ??????? ??? ????????????? (polygon) ??? ?????? ??????? ?????? gglot2

 g0 <-  ggplot(data = myfigure.df, aes(x=x,y=y)) + geom_polygon(color="dark blue",fill="cyan") 
g0

??????? ?????? ? ??????

 g1 <-  g0 + geom_point(aes(x=mypoint[1],y=mypoint[2]),color="black",fill="yellow",shape=24,size=2.5)
g1 




?????????? 1. ??????? ???????? ????????

? ???????????? ?? ????? ?????? ??? ? ????????? ???????? ?????????? ??????? ????????? (??????? coord_*) ? ???? ??????????. ?????????? ?????? ????? ????????????? ????????? (ratio=1) ???? ??????? ??? ??? y ? ???? ??????? x, ? ???? ?????????? ?????? ???? ? ?????-????? (black-and-white) ???????????? ??????.

?????????? 2. ??????? ???????? ?????? (?????????? ??????????? ??? x).

? ???????????? ?? ????? ??? ? ????????? ???????? ?????????? ??????? ????????? (??????? coord_*) ? ???? ??????????. ?????????? ?????? ????? ????????????? ????????? (ratio=-1) ???? ??????? ??? ??? y ? ???? ??????? x, ? ???? ?????????? ?????? ???? (classic) ??? ???????????? ?????. ??????? ???????? ????.

Copyright © 2016 thetazero.com All Rights Reserved. Privacy Policy