From 21bc8971428629c9854bdc5a7b9b7d2a0f1c7cc5 Mon Sep 17 00:00:00 2001 From: EasyChart Date: Mon, 3 Jun 2019 11:12:16 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E5=9B=BE3-8-1=20=E9=9B=B7=E8=BE=BE?= =?UTF-8?q?=E5=9B=BE=E7=9A=84=E7=BB=98=E5=88=B6=E6=BC=94=E5=8F=98=E8=BF=87?= =?UTF-8?q?=E7=A8=8B.R?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...274\224\345\217\230\350\277\207\347\250\213.R" | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git "a/\347\254\2543\347\253\240_\347\261\273\345\210\253\346\257\224\350\276\203\345\236\213\345\233\276\350\241\250/\345\233\2763-8-1 \351\233\267\350\276\276\345\233\276\347\232\204\347\273\230\345\210\266\346\274\224\345\217\230\350\277\207\347\250\213.R" "b/\347\254\2543\347\253\240_\347\261\273\345\210\253\346\257\224\350\276\203\345\236\213\345\233\276\350\241\250/\345\233\2763-8-1 \351\233\267\350\276\276\345\233\276\347\232\204\347\273\230\345\210\266\346\274\224\345\217\230\350\277\207\347\250\213.R" index 4831945..6772463 100644 --- "a/\347\254\2543\347\253\240_\347\261\273\345\210\253\346\257\224\350\276\203\345\236\213\345\233\276\350\241\250/\345\233\2763-8-1 \351\233\267\350\276\276\345\233\276\347\232\204\347\273\230\345\210\266\346\274\224\345\217\230\350\277\207\347\250\213.R" +++ "b/\347\254\2543\347\253\240_\347\261\273\345\210\253\346\257\224\350\276\203\345\236\213\345\233\276\350\241\250/\345\233\2763-8-1 \351\233\267\350\276\276\345\233\276\347\232\204\347\273\230\345\210\266\346\274\224\345\217\230\350\277\207\347\250\213.R" @@ -1,10 +1,11 @@ - -#EasyCharts团队出品,如有商用必究, -#如需使用与深入学习,请联系微信:EasyCharts +#EasyCharts鍥㈤槦鍑哄搧锛 +#濡傛湁闂淇涓庢繁鍏ュ涔狅紝鍙仈绯诲井淇★細EasyCharts library(ggplot2) -#--------------------------------------------雷达图实现原理------------------------------------------------------- +#--------------------------------------------闆疯揪鍥惧疄鐜板師鐞------------------------------------------------------- +#Reference:https://github.com/cardiomoon/ggplot2new/blob/4e50b7dcfee3246a169702f88f7dd46cbf933f4b/coord_radar.R + coord_radar <- function (theta = "x", start = 0, direction = 1) { theta <- match.arg(theta, c("x", "y")) r <- if (theta == "x") @@ -15,7 +16,7 @@ ggproto("CoordRadar", CoordPolar, theta = theta, r = r, start = start, is_linear = function(coord) TRUE)} -#----------------------------------------单数据系列-------------------------------------------------------------- +#----------------------------------------鍗曟暟鎹郴鍒-------------------------------------------------------------- label_data<-data.frame(car=c("Math" , "English" , "Biology" , "Music" , "R-Coding" ), id=c(1:5) , value=c(12 , 2 ,14 ,20, 18)) @@ -28,7 +29,7 @@ myAngle<- 360- 360 * (label_data$id-1) /nrow(label_data) ggplot() + geom_polygon(data=mydata,aes(x=id, y=value),color = "black", fill=brewer.pal(7,"Set1")[1],alpha=0.1)+ geom_point(data=mydata,aes(x=id, y=value),size=5,shape=21,color = 'black', fill=brewer.pal(7,"Set1")[1])+ - coord_polar() + #实现为图3-8-1(c) 的圆形雷达图 + coord_polar() + #瀹炵幇涓哄浘3-8-1(c) 鐨勫渾褰㈤浄杈惧浘 ylim(0,22)+ theme_light()+ theme(axis.text.x=element_text(size = 11,colour="black")) @@ -36,7 +37,7 @@ ggplot() + ggplot() + geom_polygon(data=mydata,aes(x=id, y=value),color = "black", fill=brewer.pal(7,"Set1")[1],alpha=0.1)+ geom_point(data=mydata,aes(x=id, y=value),size=5,shape=21,color = 'black', fill=brewer.pal(7,"Set1")[1])+ - coord_polar() + #实现为图3-8-1(c) 的圆形雷达图 + coord_polar() + #瀹炵幇涓哄浘3-8-1(c) 鐨勫渾褰㈤浄杈惧浘 #coord_radar()+ # scale_x_continuous(breaks =label_data$id,labels=label_data$car)+ ylim(0,22)+