规划周末的出游
找出美国最大的几个城市,并计算它们距伊利诺伊香槟市的距离.
In[1]:=
data = Quiet[Table[{CommonName[city], QuantityMagnitude[
TravelDistance[{Entity[
"City", {"Champaign", "Illinois", "UnitedStates"}],
city}]]}, {city,
CountryData["UnitedStates", "LargestCities"]}]];
创建城市名字组成的词云,并按反比使距离较近的城市更突出.
In[2]:=
data = Cases[data, {_String, _Real}];
WordCloud[data, ImageSize -> 400, ScalingFunctions -> (1/# &),
PlotTheme -> "Marketing"]
Out[2]=