Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use R language ggplot2 to draw scatter plot

Shulou Source: shulou.com Published: 2022-06-01 22:07:56 10月01日 Update

How to use R language ggplot2 to draw scatter chart, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

The picture to be imitated today comes from the paper Core gut microbial communities are maintained by beneficial interactions and strain variability in fish. The journal is Nature microbiology.

Image.png

The repeated picture is a scatter chart in Figure2

The image.png graph looks a bit like a line chart because the scatter points are too dense. The first step is to prepare the data.

A total of three columns of data, one column x, one column y, and one column is a text label, which point you want to add a text label, corresponding to the content of the text label written on this line, do not want to add is blank

If you need sample data, you can leave a message directly. If you think this tweet is still helpful, you can forward it and support it.

Partial screenshot of data format

Read in data

Here is a relatively convenient way to read data. The data is ready according to the above format, then select all, right-click to select copy, and then open the R language and run the following command

Df1

Tags: Text data labels functions language next questions help adjustment selection location content drawing afterhand pictures that is effects ways methods more Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB MySQL macOS Redmi NVidia