Currently, we have data on coordinates and the corresponding words.
I would like to make this a scatter plot. Scatter plots are usually plotted with dots, but this time I want to plot words instead of dots.
Here's how I know so far.

The first method is thisReference siteIt is a scatter plot created using. Use the textplot command in this.

The second method is thisReference siteTo use. However, with this method, the characters will collapse if the coordinates are very close or the same.

If there is another way to make a scatter plot so that the words do not overlap, please let me know. Thank you.

By the way, since the programming languages ​​used in this project are JavaScript and R, the tags are JavaScript and R for the time being, but other methods are also okay. Eventually it will be displayed in HTML, so if it can be saved as an image, it will be output.

  • Answer # 1

    library (ggrepel)
    iris2<-iris [sample (150,50),]
    ggplot (iris2, aes (x = Sepal.Length, y = Sepal.Width)) +
      geom_point (color ='red') +
      geom_text_repel (
        data = iris2,
        aes (label = Species),
        size = 5)


Related articles