Wolfram 언어

새로운 시각화 영역

가중 데이터에 워드 클라우드 사용하기

각 나라에 인구 가중치를 붙이는 데이터를 생성합니다.

In[1]:=
Click for copyable input
years = Range[1716, 2016, 100]; data = Table[ AssociationThread @@ Transpose[ Select[EntityValue[ CountryData[], {"Name", EntityProperty["Country", "Population", {"Date" -> DateObject[{year}]}]}], TrueQ[Last[#] > \!\(\* NamespaceBox["LinguisticAssistant", DynamicModuleBox[{Typeset`query$$ = "0 people", Typeset`boxes$$ = TemplateBox[{"0", "\"people\"", "people", "\"People\""}, "Quantity", SyntaxForm -> Mod], Typeset`allassumptions$$ = {}, Typeset`assumptions$$ = {}, Typeset`open$$ = {1, 2}, Typeset`querystate$$ = { "Online" -> True, "Allowed" -> True, "mparse.jsp" -> 1.326065`6.574109805988145, "Messages" -> {}}}, DynamicBox[ToBoxes[ AlphaIntegration`LinguisticAssistantBoxes["", 4, Automatic, Dynamic[Typeset`query$$], Dynamic[Typeset`boxes$$], Dynamic[Typeset`allassumptions$$], Dynamic[Typeset`assumptions$$], Dynamic[Typeset`open$$], Dynamic[Typeset`querystate$$]], StandardForm], ImageSizeCache->{101., {8., 16.}}, TrackedSymbols:>{ Typeset`query$$, Typeset`boxes$$, Typeset`allassumptions$$, Typeset`assumptions$$, Typeset`open$$, Typeset`querystate$$}], DynamicModuleValues:>{}, UndoTrackedVariables:>{Typeset`open$$}], BaseStyle->{"Deploy"}, DeleteWithContents->True, Editable->False, SelectWithContents->True]\)] &]], {year, years}];

각 국가에 대해 항상 동일한 색상을 사용하는 색상 함수를 구축합니다.

In[2]:=
Click for copyable input
cfun[weight_, string_] := cfun[_, string] = RandomChoice[ColorData[97, "ColorList"]]

나라를 나타내는 문자의 크기는 인구에 의해 가중치를 붙인 시간의 경과에 따른 일련의 워드 클라우드를 생성합니다.

In[3]:=
Click for copyable input
Multicolumn[ MapThread[ WordCloud[#, PlotLabel -> Style[Framed[#2], 16, Background -> LightGray], ColorFunction -> cfun, ImageSize -> 300] &, {data, years}], 2, Appearance -> "Horizontal"]
Out[3]=

관련 예제

de en es fr ja pt-br ru zh