Open yuanzhouIR opened 6 years ago
These rectangles called "tofu" and appear when there is not font for the characters. This is likely to be font issue on Mac similar to wordclound:
https://cdn.rawgit.com/quanteda/quanteda/aba2ebc9/docs/articles/pkgdown/examples/chinese.html
If you set some Japanese font in the similar way, words should print properly.
Thanks. I added the font setting code vertex_labelfont = "MS Gothic"
, but it returns the following error:
> Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
polygon edge not found
In addition: Warning messages:
1: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
no font could be found for family "MS Gothic"
2: In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
no font could be found for family "MS Gothic"
Do you know what wrong it is?
As the error says: your machine does not have MS Gothic.
I checked my Font Book, and it does have MS Gothic. I also tried MS Mincho, which I do not have, and it returns:
> Error in check_font(vertex_labelfont) :
MS Mincho is not found on your system. Run extrafont::import_font() to use custom fonts.
So I think there is some other things wrong.
Did you run extrafont::import_font()
?
I did, but I think it should be extrafont::font_import()
. I also run extrafont::fonts()
, it returns:
> [1] ".Keyboard" "System Font"
[3] "Andale Mono" "Apple Braille"
[5] "AppleMyungjo" "Arial Black"
[7] "Arial" "Arial Narrow"
[9] "Arial Rounded MT Bold" "Arial Unicode MS"
[11] "Bodoni Ornaments" "Bodoni 72 Smallcaps"
[13] "" "Brush Script MT"
[15] "Comic Sans MS" "Courier New"
[17] "DIN Alternate" "DIN Condensed"
[19] "Georgia" "Impact"
[21] "Khmer Sangam MN" "Lao Sangam MN"
[23] "Luminari" "Microsoft Sans Serif"
[25] "MS Gothic" "Tahoma"
[27] "Times New Roman" "Trattatello"
[29] "Trebuchet MS" "Verdana"
[31] "Webdings" "Wingdings"
[33] "Wingdings 2" "Wingdings 3"
The 25th is MS Gothic, but when I run textplot_network(mx_col, min_freq = 0.95, edge_size = 5, vertex_labelfont = "MS Gothic")
, it still returns:
> Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
polygon edge not found
In addition: Warning message:
In grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
no font could be found for family "MS Gothic"
Then please open an issue here https://github.com/quanteda/quanteda/issues and upload replication code. I have a Japanese colleague who uses a Mac.
Hi, Dr. Watanabe,
I met a problem again. When I drew the network plot of the textual data using the code
textplot_network
, I got the plot but all the Japanese words displayed as ロロ.