全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1887 9
2020-07-17
悬赏 1000 个论坛币 已解决
  这个图怎么做的 求指点
QQ图片20200717004929.jpg

原图尺寸 40.26 KB

QQ图片20200717004929.jpg

最佳答案

llb_321 查看完整内容

这张图,可以有多种方法,ps最简单,tikz稍微麻烦些,R绘图函数应该也能实现但不确定如何实现。 我用tikz做了一个,代码如下: \documentclass[17pt]{scrartcl} \usepackage{ctex} \usepackage{tikz} \usetikzlibrary{decorations,decorations.text} \newcommand{\framesize}{15cm} \begin{document} \thispagestyle{empty} \begin{tikzpicture}[overlay,remember picture,font=\sffamily\bfseries,transform shape,e ...
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2020-7-17 20:51:17
这张图,可以有多种方法,ps最简单,tikz稍微麻烦些,R绘图函数应该也能实现但不确定如何实现。
我用tikz做了一个,代码如下:
\documentclass[17pt]{scrartcl}
\usepackage[UTF8]{ctex}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.text}
\newcommand{\framesize}{15cm}

\begin{document}
\thispagestyle{empty}

\begin{tikzpicture}[overlay,remember picture,font=\sffamily\bfseries,transform shape,every node/.style={inner sep=0pt}]

\draw[gray,dotted,line width=.05cm] ([xshift=-9cm,yshift=-8cm]current page.north)  - - ([xshift=6.5cm,yshift=-8cm]current page.north);
\draw[gray,dotted,line width=.05cm] ([xshift=-9cm,yshift=-14cm]current page.north)  - - ([xshift=6.5cm,yshift=-14cm]current page.north);
\draw[gray,dotted,line width=.05cm] ([xshift=-9cm,yshift=-18.5cm]current page.north)  - - ([xshift=6.5cm,yshift=-18.5cm]current page.north);
\draw[gray,dotted,line width=.05cm] ([xshift=-9cm,yshift=-21.5cm]current page.north)  - - ([xshift=6.5cm,yshift=-21.5cm]current page.north);
\draw[gray,dotted,line width=.05cm] ([xshift=-9cm,yshift=-23cm]current page.north)  - - ([xshift=6.5cm,yshift=-23cm]current page.north);
\draw[gray,dotted,line width=.05cm] ([xshift=-9cm,yshift=-25cm]current page.north)  - - ([xshift=6.5cm,yshift=-25cm]current page.north);

\draw[gray,dotted,line width=.05cm] ([xshift=-1.5cm,yshift=-2cm]current page.north)  - - ([xshift=-1.5cm,yshift=-25cm]current page.north);
\draw[gray,dotted,line width=.05cm] ([xshift=6.5cm,yshift=-2cm]current page.north)  - - ([xshift=6.5cm,yshift=-25cm]current page.north);


\filldraw[white,fill=blue] ([xshift=-1.5cm,yshift=-25cm]current page.north) circle (0.2);
\filldraw[white,fill=blue] ([xshift=-1.5cm,yshift=-23cm]current page.north) circle (0.96);
\filldraw[white,fill=blue] ([xshift=-1.5cm,yshift=-21.5cm]current page.north) circle (1.49);
\filldraw[white,fill=blue] ([xshift=-1.5cm,yshift=-18.5cm]current page.north) circle (2.26);
\filldraw[white,fill=blue] ([xshift=-1.5cm,yshift=-14cm]current page.north) circle (3.91);
\filldraw[white,fill=blue] ([xshift=-1.5cm,yshift=-8cm]current page.north) circle (4.62);

\filldraw[yellow,fill=red] ([xshift=6.5cm,yshift=-25cm]current page.north) circle (0.04);
\filldraw[yellow,fill=red] ([xshift=6.5cm,yshift=-23cm]current page.north) circle (0.25);
\filldraw[yellow,fill=red] ([xshift=6.5cm,yshift=-21.5cm]current page.north) circle (0.44);
\filldraw[yellow,fill=red] ([xshift=6.5cm,yshift=-18.5cm]current page.north) circle (0.8);
\filldraw[yellow,fill=red] ([xshift=6.5cm,yshift=-14cm]current page.north) circle (1.49);
\filldraw[yellow,fill=red] ([xshift=6.5cm,yshift=-8cm]current page.north) circle (1.95);

\node[gray,inner sep=4pt] (text) at ([xshift=-3.5cm,yshift=-24.5cm]current page.north){\large 0.128\%};
\node[gray,inner sep=4pt] (text) at ([xshift=-3.5cm,yshift=-22.5cm]current page.north){\large 2.9\%};
\node[white,inner sep=4pt] (text) at ([xshift=-1.5cm,yshift=-21.5cm]current page.north){\large 7\%};
\node[white,inner sep=4pt] (text) at ([xshift=-1.5cm,yshift=-18.5cm]current page.north){\large 16\%};
\node[white,inner sep=4pt] (text) at ([xshift=-1.5cm,yshift=-14cm]current page.north){\large 48\%};
\node[white,inner sep=4pt] (text) at ([xshift=-1.5cm,yshift=-8cm]current page.north){\large 67\%};

\node[gray,inner sep=4pt] (text) at ([xshift=4.5cm,yshift=-24.5cm]current page.north){\large 0.005\%};
\node[gray,inner sep=4pt] (text) at ([xshift=4.5cm,yshift=-22.5cm]current page.north){\large 0.2\%};
\node[gray,inner sep=4pt] (text) at ([xshift=4.5cm,yshift=-21cm]current page.north){\large 0.6\%};
\node[white,inner sep=4pt] (text) at ([xshift=6.5cm,yshift=-18.5cm]current page.north){\large 2\%};
\node[white,inner sep=4pt] (text) at ([xshift=6.5cm,yshift=-14cm]current page.north){\large 7\%};
\node[white,inner sep=4pt] (text) at ([xshift=6.5cm,yshift=-8cm]current page.north){\large 12\%};

\node[gray,inner sep=4pt,text opacity=0.75] (text) at ([xshift=-8cm,yshift=-7.5cm]current page.north){\large 参加高考};
\node[gray,inner sep=4pt] (text) at ([xshift=-8cm,yshift=-13.5cm]current page.north){\large 全日制};
\node[gray,inner sep=4pt] (text) at ([xshift=-8cm,yshift=-18cm]current page.north){\large 本科};
\node[gray,inner sep=4pt] (text) at ([xshift=-8cm,yshift=-21cm]current page.north){\large 211};
\node[gray,inner sep=4pt] (text) at ([xshift=-8cm,yshift=-22.5cm]current page.north){\large 985};
\node[gray,inner sep=4pt] (text) at ([xshift=-8cm,yshift=-24.5cm]current page.north){\large 清北};

\node[gray,inner sep=4pt,fill= gray!20] (text) at ([xshift=-1.5cm,yshift=-2cm]current page.north){\large 城市};
\node[gray,inner sep=4pt,fill= gray!20] (text) at ([xshift=6.5cm,yshift=-2cm]current page.north){\large 农村};

\end{tikzpicture}
\end{document}

输出结果:
college.png
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2020-7-18 06:40:45
觉得这是一张气泡图,横坐标为包含城市和农村的城乡变量,纵坐标包含参加高考、全日制大学等指标的高考入学变量,关键是决定气泡大小的权重变量,但是奇怪的是城市+农村的比例不为100%,有的还很低,不太好理解,除城市和农村外还有什么来源?气泡图很多软件都可以做,R、Stata/SPSS/JMP/Tableau, 如果有原始数据,我想我能做出这个图来(当然得理解这些比例怎么算出来的,也就是除城市和农村外还有什么来源)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2020-7-18 09:25:27
fugangxx 发表于 2020-7-18 06:40
觉得这是一张气泡图,横坐标为包含城市和农村的城乡变量,纵坐标包含参加高考、全日制大学等指标的高考入学 ...
我的理解是城镇和农村应该是分开的,二者不可加,即67%由城镇中参加高考的人数除以城镇适龄人口数,而12%则由农村中参加高考的人数除以农村适龄人口数。然后关于这张图,据我观察,这可能就是在word或者PPT里边用形状、文本、线条拼凑而成。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2020-7-18 10:11:20
用R做一个,效果不好。
数据:
college_l.rar
大小:(248 Bytes)

 马上下载

本附件包括:

  • college_l.csv



代码:
#泡泡图

#加个包
library(ggplot2)
library(scales)

#读入数据,
ct<-read.csv("college_l.csv",header=T)

#改点东西
poptheme <- theme_minimal()+
  theme(
    panel.grid.minor.y=element_blank(),
    axis.text.x = element_text(angle = 0, hjust =0.5),
    axis.text.y = element_text(angle = 0, vjust = 0, hjust =1),
    plot.title=element_text(face="bold",size=12,hjust =0),
    axis.line.y=element_line(linetype=1,color='white'),
    axis.line.x=element_line(linetype=1,color='white'),
    axis.ticks = element_line(linetype=2,color='grey'),
    panel.grid=element_line(linetype=2,color='grey'),
    #legend.background = element_rect(fill="gray90", size=0,color='white'),
    #legend.text=element_text(face="bold",size=8),
    #legend.title=element_text(face="bold",size=8),
    legend.position="none",
    axis.text=element_text(face="bold",size=12)
  )

#画泡泡
p<-ggplot(ct)
p+
  aes(x=type,y=position,color=factor(type))+
  geom_point(stat= "identity",aes(size=count),alpha=0.7,show.legend = TRUE)+
  guides(color=guide_legend(title="Year"))+
  scale_size(range = c(0, 67),guide=FALSE)+
  scale_color_manual(values=c("blue","red"))+
  scale_y_continuous(limits=c(4,27),breaks=c(5.5,7.5,8.5,11.5,16,22),labels=c("清北","985","211","本科","全日制","参加高考"))+
  labs(x=NULL,y=NULL,title='城市和农村适龄人口参加高考情况对比')+
  scale_x_discrete(labels=c("城市","农村"),position="top")+
  geom_text(aes(x=type,y=position,label=percent(count),hjust=0.5), size=5,color="black") +
  poptheme

结果:
Rplot.png
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2020-7-18 10:19:15
fugangxx 发表于 2020-7-18 06:40
觉得这是一张气泡图,横坐标为包含城市和农村的城乡变量,纵坐标包含参加高考、全日制大学等指标的高考入学 ...
我理解比例是指分别占城市或农村的适龄考学人口的比例,也就是说城市学生有33%不参加高考,而农村学生88%不参加高考
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群