Wolfram mathematica 为什么mathematica中没有使用此代码生成wordcloud?
我得到的只是:Wolfram mathematica 为什么mathematica中没有使用此代码生成wordcloud?,wolfram-mathematica,word-cloud,Wolfram Mathematica,Word Cloud,我得到的只是: data = EntityValue[CountryData[], {"Name", "Population"}]; WordCloud[data] 没有任何图形我能够通过使用Heike的在10.0版中获得单词cloud,但是我不得不删除与自定义距离函数有关的部分,因为它会让这个版本的速度慢得令人难以置信 WordCloud[{{"Afghanistan", Quantity[35623235, "People"]}, {"Albania", Quantity[3248
data = EntityValue[CountryData[], {"Name", "Population"}];
WordCloud[data]
没有任何图形我能够通过使用Heike的在10.0版中获得单词cloud,但是我不得不删除与自定义距离函数有关的部分,因为它会让这个版本的速度慢得令人难以置信
WordCloud[{{"Afghanistan", Quantity[35623235, "People"]}, {"Albania",
Quantity[3248655, "People"]}, {"Algeria",
Quantity[37473690, "People"]}, {"American Samoa",
Quantity[54719, "People"]}, {"Andorra",
Quantity[85458, "People"]}, {"Angola", .....
这些与10.3版中使用WordCloud[data]
对我有用,什么mathematica版本?mathematica版本10.0文档说wordcloud是在10.1中引入的。如果它对你有用的话,你可以试试这个
WordCloud[{{[1]],quantitymagnity[[2]]]}&/@data]
data = << "http://pastebin.com/raw/02YJ9Ntx";
range = {Min[data[[All, 2]]], Max[data[[All, 2]]]};
words = Style[#1, FontFamily -> "Times", FontWeight -> Bold,
FontColor ->
Hue[RandomReal[], RandomReal[{.5, 1}], RandomReal[{.5, 1}]],
FontSize -> Rescale[#2, range, {12, 70}]] & @@@ data;
wordsimg =
ImagePad[#, -3 -
BorderDimensions[#]] & /@ (Image[
Graphics[Text[Framed[#, FrameMargins -> 2]]]] & /@ words);
wordsimgRot =
ImageRotate[#, RandomReal[2 Pi], Background -> White] & /@ wordsimg;
iteration2[img1_, w_] :=
Module[{imdil, centre, diff, dimw, padding, padded1, minpos},
dimw = ImageDimensions[w];
padded1 = ImagePad[img1, {dimw[[1]] {1, 1}, dimw[[2]] {1, 1}}, 1];
imdil =
Binarize[
ImageCorrelate[Binarize[ColorNegate[padded1], 0.05],
Dilation[Binarize[ColorNegate[w], .05], 1]]];
centre = ImageDimensions[padded1]/2;
minpos =
Reverse@Nearest[Position[Reverse[ImageData[imdil]], 0],
Reverse[centre]][[1]];
Sow[minpos - centre];
diff = ImageDimensions[imdil] - dimw;
padding[pos_] := Transpose[{#, diff - #} &@Round[pos - dimw/2]];
ImagePad[#, (-Min[#] {1, 1}) & /@ BorderDimensions[#]] &@
ImageMultiply[padded1, ImagePad[w, padding[minpos], 1]]]
{Fold[iteration2, wordsimgRot[[1]], Rest@wordsimgRot],
Fold[iteration2, wordsimg[[1]], Rest@wordsimg]}