楼主: zyz0329
1977 9

[程序分享] 这个图怎么做的 求指点 [推广有奖]

  • 1关注
  • 37粉丝

已卖:328份资源

院士

29%

还不是VIP/贵宾

-

威望
0
论坛币
83453 个
通用积分
371.2642
学术水平
58 点
热心指数
92 点
信用等级
41 点
经验
494 点
帖子
1116
精华
0
在线时间
5697 小时
注册时间
2010-12-1
最后登录
2025-11-25

楼主
zyz0329 在职认证  发表于 2020-7-17 20:51:16 |AI写论文
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 ...
关键词:求指点 怎么做

本帖被以下文库推荐

沙发
llb_321 在职认证  发表于 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
已有 1 人评分论坛币 收起 理由
cheetahfly + 100 精彩帖子

总评分: 论坛币 + 100   查看全部评分

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

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

报纸
llb_321 在职认证  发表于 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
已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
zyz0329 + 5 + 5 + 5 + 5 精彩帖子

总评分: 论坛币 + 5  学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

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

7
cheetahfly 在职认证  发表于 2020-7-19 18:52:34
R语言是可以胜任商业可视化展示的,但是比较费工夫,毕竟这与变量关系研究有区别。
以下是方法之一:
准备工作:
  1. library(tidyverse)
  2. library(scales)
  3. windowsFonts(myFont = windowsFont("微软雅黑"))
  4. # 构建
  5. a <- structure(list(X = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 1L, 2L, 3L, 4L, 5L, 6L),
  6.                                   .Label = c("清华、北大", "985", "211", "全日制本科大学", "全日制大学", "参加高考"),
  7.                                   class = "factor"),
  8.                     type = c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L),
  9.                     position = c(6.5, 7.15, 8.5, 10.5, 13.5, 18, 6.5, 7.15, 8.5, 10.5, 13.5, 18),
  10.                     count = c(0.00128, 0.029, 0.07, 0.16, 0.48, 0.67, 3e-05, 0.002, 0.006, 0.02, 0.07, 0.12)),
  11.                class = c("grouped_df", "tbl_df", "tbl", "data.frame"),
  12.                row.names = c(NA, -12L), groups = structure(list(type = 1:2, .rows = list(1:6, 7:12)), row.names = c(NA, -2L), class = c("tbl_df", "tbl", "data.frame"), .drop = TRUE))
复制代码

下面开始画图:
  1. a %>%
  2.   ggplot(aes(x = type, y = position)) +
  3.   theme_minimal() +
  4.   theme(panel.grid = element_blank(),
  5.         axis.title = element_blank(),
  6.         axis.text = element_blank(),
  7.         text = element_text(family = "myFont"),
  8.         plot.title = element_text(size = 16, face = "bold")) +
  9.   scale_x_continuous(limits = c(0, 2.5), expand = c(0, 0)) +
  10.   scale_y_continuous(limits = c(6, 21.5), expand = c(0, 0)) +
  11.   geom_vline(xintercept = 1L:2L, color = "gray80") +
  12.   geom_hline(yintercept = a$position, color = "gray80") +
  13.   geom_point(aes(size = count, fill = as.factor(type)),
  14.              shape = 21, stroke = 1, color = "white", show.legend =  FALSE) +
  15.   scale_fill_manual(values = c("#2654A1", "#F2706E")) +
  16.   scale_size_area(max_size = 100) +
  17.   annotate(geom = "rect", xmin = 0, xmax = 2.5, ymin = 20.9, ymax = 21.5, fill = "white") +
  18.   annotate(geom = "rect", xmin = 0.75, xmax = 1.25, ymin = 21.1, ymax = 21.5, fill = "#2654A1") +
  19.   annotate(geom = "rect", xmin = 1.75, xmax = 2.25, ymin = 21.1, ymax = 21.5, fill = "#F2706E") +
  20.   annotate(geom = "text", x = c(1, 2), y = 21.35, label = c("城市", "农村"), color = "white", family = "myFont", size = 5, fontface = "bold") +
  21.   annotate(geom = "text", x = 0, y = c(6.5, 7.15, 8.5, 10.5, 13.5, 18) + 0.2, label  = c("清华、北大", "985", "211", "全日制本科大学", "全日制大学", "参加高考"), hjust = 0, family = "myFont", fontface = "bold", color = "gray50") +
  22.   annotate(geom = "text", x = 1, y = c(7.15, 8.5, 10.5, 13.5, 18), label = percent(c(0.029, 0.07, 0.16, 0.48, 0.67), 1), color = "white", size = 4) +
  23.   annotate(geom = "text", x = 2, y = c(10.5, 13.5, 18), label = percent(c(0.02, 0.07, 0.12), 1), color = "white", size = 4) +
  24.   annotate(geom = "rect", xmin = 1.08, xmax = 1.3, ymin = 6.4, ymax = 6.6, fill = "white") +
  25.   annotate(geom = "text", x = 1.2, y = 6.5, label = "0.128%", color = "#2654A1", size = 4) +
  26.   annotate(geom = "rect", xmin = 1.7, xmax = 1.92, ymin = 6.4, ymax = 6.6, fill = "white") +
  27.   annotate(geom = "text", x = 1.91, y = 6.5, label = "0.003%", color = "#F2706E", size = 4, hjust = 1) +  
  28.   annotate(geom = "rect", xmin = 1.77, xmax = 1.92, ymin = 7.05, ymax = 7.25, fill = "white") +
  29.   annotate(geom = "text", x = 1.91, y = 7.15, label = "0.2%", color = "#F2706E", size = 4, hjust = 1) +
  30.   annotate(geom = "rect", xmin = 1.77, xmax = 1.92, ymin = 8.4, ymax = 8.6, fill = "white") +
  31.   annotate(geom = "text", x = 1.91, y = 8.5, label = "0.6%", color = "#F2706E", size = 4, hjust = 1) +
  32.   labs(title = "城乡适龄人口进入不同高校的比例",
  33.        subtitle = "数据来源:\nUnequal Access to College in China: How Far Have Poor, Rural Students Been Left Behind?")
复制代码


成品图片如下:长宽比例尽量和原图保持一致,请自行调整!
text.png
已有 2 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
llb_321 + 5 非常精彩
zyz0329 + 5 + 5 + 5 + 5 精彩帖子

总评分: 论坛币 + 10  学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

8
zyz0329 在职认证  发表于 2020-7-19 23:16:00
cheetahfly 发表于 2020-7-19 18:52
R语言是可以胜任商业可视化展示的,但是比较费工夫,毕竟这与变量关系研究有区别。
以下是方法之一:
准备 ...
可以回复我另外一个帖子,论坛币给你

9
nkunku 发表于 2020-8-7 18:12:58
学习了

10
llb_321 在职认证  发表于 2020-8-8 23:21:47
cheetahfly 发表于 2020-7-19 18:52
R语言是可以胜任商业可视化展示的,但是比较费工夫,毕竟这与变量关系研究有区别。
以下是方法之一:
准备 ...
大佬出手 非同凡响

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 00:04