美国城市

by Zhen Liu

刘震

泡泡图如何揭示美国最适合居住的城市 (How a Bubble Plot Reveals the Best Cities to Live in the US)

In this article, I’ll show you some exciting facts about American cities, the value of bubble plots in deciding which city to live in, and how to create those plots.

在本文中,我将向您展示有关美国城市的一些令人振奋的事实,气泡图在决定居住哪个城市方面的价值以及如何创建这些图。

Are you thinking about investing in real estate in 2018? Moving to a new city? When considering these decisions, you need to weigh in different factors like unemployment rate, housing price, the size of the city, safety and so on. Even with all that data and four corresponding bar charts, you’ll still be clueless staring at that table. You’ll try to find the best candidates, but those factors are telling different stories… Sounds like a complex problem.

您是否正在考虑在2018年投资房地产? 搬到新城市? 在考虑这些决定时,您需要权衡各种因素,例如失业率,房价,城市规模,安全性等。 即使有了所有这些数据和四个相应的条形图,您仍然会毫无头绪地盯着那个桌子。 您将尝试找到最合适的人选,但是那些因素在讲不同的故事……听起来像是一个复杂的问题。

So, is there a way we can visualize all these factors in 1 chart and compare them ALL? Yes, we can use a bubble plot!

因此,有没有一种方法可以在一张图表中可视化所有这些因素,并将它们全部比较? 是的,我们可以使用气泡图!

什么是泡泡图? (What’s a bubble plot?)

A bubble plot is a type of chart that displays more than two dimensions of data (compared to traditional scatter plots). In addition to plotting a dot on an X-Y plane, it uses the size, color, or shape of the point to display more dimensions.

气泡图是一种图表,它显示了两个以上的数据维度(与传统的散点图相比)。 除了在XY平面上绘制点外,它还使用点的大小,颜色或形状来显示更多尺寸。

We use unemployment rate as the X-axis, median home price as the Y-axis, and the population of the cities as the size of the dots. This makes a good third dimension. Color is randomly assigned to each city.

我们将失业率用作X轴,将房价中位数用作Y轴 ,并将城市人口用作点的大小。 这是一个很好的三维。 颜色是随机分配给每个城市的。

美国最适合居住的城市是…(等待它) (The best city in the US to live in is…(wait for it))

Winner: Nashville!

优胜者 纳什维尔!

Other recommendations: Austin, Omaha, Milwaukee, Dallas, Minneapolis, Denver and Aurora.

其他建议: 奥斯丁,奥马哈,密尔沃基,达拉斯,明尼阿波利斯,丹佛和奥罗拉。

They have low unemployment (and therefore there’s higher chance of finding a job), and low home price, because they are on the lower left side of the plot. What does that mean?

他们的失业率很低(因此找到工作的机会更高),房价也很低,因为它们位于地块的左下角。 那是什么意思?

It means you can make your choices based on this plot.

这意味着您可以根据此图进行选择。

For example, if you consider unemployment rate to be more important and don’t mind the higher home prices, then Honolulu, Oakland, Boston, and San Diego are strong candidates

例如,如果您认为失业率更为重要并且不介意更高的房价,那么檀香山,奥克兰,波士顿和圣地亚哥是最佳选择

如何将安全性作为另一个因素呢? (What about adding safety as another factor?)

Sure. Let’s add safety as a fourth factor (the other three factors are still home price, unemployment rate, and population). Instead of randomly assigning a color for a city, we use the color scale for crime (crime rate per 100,000 people). Red means more crime and blue means less.

当然。 让我们添加安全性作为第四个因素(其他三个因素仍然是房价,失业率和人口)。 我们没有为城市随机分配颜色,而是使用犯罪颜色标度 (每10万人的犯罪率)。 红色表示更多犯罪, 蓝色表示较少犯罪。

结果会改变吗? (Does the result change?)

It did! If safety is very important for you, then Milwaukee might not be such a great choice among the previous recommendations (even though it’s at the lower left side of the graph).

它做了! 如果安全对您来说非常重要,那么在先前的建议中,密尔沃基可能不是一个很好的选择(即使它在图表的左下方)。

Now you see the power of a bubble plot: the ability to demonstrate multiple factors in one 2-D plot. If you only have bar charts for those factors, it’s hard for you to identify the cities with an ideal combination of factors. The bubble plot basically created a “visual objective function” for you to optimize a multi-variable decision-making problem.

现在,您将看到气泡图的力量:在一个二维图中展示多个因素的能力。 如果您仅具有这些因素的条形图,则很难确定具有理想因素组合的城市。 气泡图基本上为您创建了一个“视觉目标函数”,以优化多变量决策问题。

失业率和房价随时间如何变化? (How do unemployment rate and home price change over time?)

We can create an interactive motion chart to add time as a dimension (2013 to 2017) to see how the factors change for these cities over time.

我们可以创建一个交互式运动图,将时间添加为一个维度(2013年至2017年),以查看这些城市的因素随时间的变化情况。

To avoid too much visual information, I didn’t use crime data and used the different colors to represent a few selected cities.

为了避免过多的视觉信息,我没有使用犯罪数据,而是使用不同的颜色来代表一些选定的城市。

The good news is that the unemployment rate for almost all cities decreased significantly (moving from right to left). But the bad news is that the housing prices are going up pretty fast (especially for San Francisco, San Jose, Los Angles, New York, and Seattle).

好消息是,几乎所有城市的失业率都显着下降(从右向左移动)。 但是坏消息是,房价上涨非常快(尤其是旧金山,圣何塞,洛杉矶,纽约和西雅图)。

Want to create the charts yourself? Here is my code for the bubble plots and the motion chart in R. Have fun playing with the plots :)

想自己创建图表吗? 这是我的R中气泡图和运动图的代码。玩得开心吧:)

################ Bubble Plot ################library(data.table)library(ggplot2)library(ggrepel)
bubble_data <-fread("https://raw.githubusercontent.com/zhendata/Medium_Posts/c007346db1575aca391a6623c87bb5a31a60b365/bubble_plot_merged_city_data.csv",sep=",")
bubble_plot <- ggplot(bubble_data,                aes(x = Unemployment_Rate, y = Home_Price/1000)) +
geom_point(aes(size = Population, fill = Total_Crime),shape=21) +# Create 'Bubble' by assigning size a variable #
scale_fill_continuous(low = "#33FFFF", high ="#FF6699" ) +scale_size_area(max_size = 20)+# Select bubble color scale and bubble maximum size #
geom_text_repel(          aes(label = City),nudge_x = 0,nudge_y = 0.75,size = 6) +# Use geom_text_repel to repel the labels away from each other #
theme_bw()+# Use white background instead of the default grey one #
ggtitle("Best Cities in US to Live in") +labs(x = "Unemployment Rate%", y = "Home Price",       size = "Population",fill="Crime") +theme(plot.title = element_text(size=25, hjust = 0.5),        axis.title=element_text(size=20, face = "bold"),        axis.text=element_text(size=15)) +# Style title and axis #
scale_y_continuous(name="Home Price", breaks = seq(0, 1500, by=250),                       labels=c("0", "250K", "500K", "750K", "1000k",    "1250k", "1500K"))# Make y-axis more readable by replacing scientific number by "K" #
print(bubble_plot)
################# Motion Chart #################library(data.table)library(googleVis)
motion_data <-fread("https://raw.githubusercontent.com/zhendata/Medium_Posts/c007346db1575aca391a6623c87bb5a31a60b365/motion_chart_merged_city_data.csv",sep=",")
motion_chart <- gvisMotionChart(motion_data, idvar = "City", timevar = "Year",xvar = "Unemployment Rate",yvar= "Home Price",sizevar="Population")
plot(motion_chart)# R automatically opens a tab in the browser for you# The flash player needs to be enabled in browser
######### Data #########"""The datasets I used are from Zillow (medium housing), FBI’s UCR program, census.gov (population), Bureau of Labor (unemployment). I did some data cleaning and joining for the format I needed in this article, and you can click the links below to download."""bubble_plot_merged_city_data.csv, motion_chart_merged_city_data.csv

Follow me and give me a few claps if you found this helpful!

如果您发现这有帮助,请跟我来,并给我一些鼓掌!

You can also read my previous articles on data science, real estate, and decision making:

您还可以阅读我以前有关数据科学,房地产和决策的文章:

How to analyze seasonality and trends to save money on your apartment lease.When I was looking for a new apartment to rent, I started to wonder: is there a data-driven decision making strategy…medium.freecodecamp.orgHow to Use Data to Predict Rent and Optimize Your Lease Duration So You Can Save MoneyIn my last post, we talked about how to pick the best month to sign the lease based on seasonality. Now, how long…medium.freecodecamp.org

如何分析季节性和趋势以节省您的公寓租金。 当我正在寻找一个新的公寓出租,我开始怀疑:是有一个数据驱动的决策策略... medium.freecodecamp.org 如何使用数据来预测租金和优化您的租约期限这样可以节省钱 在我在上一篇文章中,我们讨论了如何根据季节选择最佳月份来签署租约。 现在,要多长时间…… medium.freecodecamp.org

翻译自: https://www.freecodecamp.org/news/how-a-bubble-plot-can-reveal-the-best-places-to-live-in-the-us-e2054c844062/

美国城市

美国城市_泡泡图如何揭示美国最适合居住的城市相关推荐

  1. 城市槽音乐在津巴布韦的美国音乐如何影响其他文化和身份的个案研究

    城市槽音乐在津巴布韦的美国音乐如何影响其他文化和身份的个案研究 第一章 1.0引言和背景 在津巴布韦音乐始终保持人民中一个特殊的地方.津巴布韦的音乐总是交织着国家的政治历史.在解放战争时期,津巴布韦非 ...

  2. navicat er图没有连线_迁徙图?流向图?城市关系强度图?

    文章首发于公众号「码上GIS」,欢迎关注.文中流向图和城市关系强度图的 ArcMap 10.5 Mxd 工程和数据可在公众号后台回复「190708」和「190709」获取 不记得是从哪年开始,每年春运 ...

  3. arcgis两点之间连线_使用ArcGIS制作城市关系强度图(附数据下载)

    规划或地理等相关专业的同学可能会遇到城市关系强度图的制作.我们主要介绍制图部分,至于城市间关系强度如何计算,请左转自行查文献或相关资料学习. ArcMap中有个XY转线(XY to Line)的GP工 ...

  4. 会议容易中吗_【留学评估】美国留学后就业真的和想象中的一样容易吗?

    本文首发于公号[小白大道],欢迎关注. 写在前面:请对自己早做规划.早做规划.早做规划(重要的事情说3遍). 不是说你被美国学校录取后就万事大吉. 如果你想未来留在美国工作,请早些做一份求职规划. 1 ...

  5. 回顾历史_回顾美联储历史,美国货币政策是如何演变的?

    要闻 回顾美联储历史,美国货币政策是如何演变的? 2019年10月22日 11:18:27 智通财经网 本文来自 "期货日报". 作为美国的中央银行,美联储成立以来所制定的货币政策 ...

  6. GIS实验之制作城市联系强度图

    一.问题描述 二.分析所给定的实验数据 三.ArcMap制作城市关系强度图 一.问题描述 数据描述 :给定某些城市之间的交互强度数据. 问题描述 :基于这些数据制作空间交互地图. 形式和内容不限可以采 ...

  7. 2014美国大学计算机专业排名,2014年美国大学计算机专业研究生排名

    2014年美国大学排名,研究生院排名已经发布,以下计算机专业研究生学院排名信息来源于<USNews>,供各位申请美国名校的同学参考,更多美国计算机专业研究生院申请方案及规划的问题,请致电咨 ...

  8. R_circlize包_和弦图(二)

    作者:李誉辉 四川大学在读研究生 往期精彩: R_插值_拟合_回归_样条 接上一篇:R_circlize包_和弦图(一) link弦可见 在需要强调某些relation时,需要高亮对应的弦,一般有4种 ...

  9. Origin如何绘制泡泡图?

    首先在Sheet中输入想要绘制泡泡图的数据,在数组名中Width和Length限定了Scatter的位置,Mass定义了泡泡的尺寸,而Type则是用于数据的分组. 在Sheet中选中前三列数据即A(X ...

最新文章

  1. 为什么通过微服务的方法构建应用程序?
  2. 《Effective C#》读书笔记——条目28:提供粗粒度的互联网API使用C#表达设计
  3. CoffeeScript 更优美的Javascript
  4. Emmet 简写语法
  5. 6.Linux 运行级别
  6. windows远程桌面神器
  7. java swing窗口放置屏幕中央问题思考
  8. 常见的文件后缀名和对应的编辑工具(下)
  9. java基础学习总结——方法的重载(overload)
  10. html css字体特效,40款CSS+JS文字动画特效html源码
  11. OI退役记,第二部分,八十中记事
  12. 网付扫码点餐新福利,消费者点餐可获微信支付金币奖励
  13. 【Android面试题】准备、hr面试问题总结
  14. github问题之Unable to retrieve your user info from the server
  15. JS JQuery 操作: Json转 Excel 下载文件
  16. 计算机模拟实验的关系,试说明数值模拟方法的特点,它与理论研究,实验研究有什么关系...
  17. 计算机系统英语参考文献短,计算机英文外文外文 计算机英文参考文献怎么写...
  18. 【限时干货】数据圈火爆的数据产品文章全集
  19. ECM技术学习:卷积跨分量帧内预测模型(Convolutional cross-component intra prediction model)
  20. flash找茬小游戏开发总结

热门文章

  1. 【C++】由指针常量和常量指针引发的问题
  2. 线程名称的获取与修改
  3. dj鲜生-10-用户注册的继续-错误提示的前端显示-防重名验证
  4. MySQL中查看某数据库大小及表大小
  5. JavaWeb14-HTML篇笔记(一)
  6. 网络分析仪-inSSIDer
  7. Java的FTP协议级客户端实现详解
  8. 2017年预测:突破性创意工作站、物联网
  9. 《HTML5开发手册》——1.5 初学者“菜谱”:使用nav元素创建导航
  10. 对中级 Linux 用户有用的 20 个命令