Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of aes (shape) Mapping in ggplot2 Point Graph geom_point

Shulou Source: shulou.com Published: 2022-06-01 04:56:10 09月29日 Update

Most people do not understand the knowledge points of this article "ggplot2 point map geom_point aes (shape) mapping method", so the editor summarizes the following contents to you, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "ggplot2 point map geom_point aes (shape) mapping method" article.

Different from the point shape setting, the shape mapping of a point must be transformed into a factor, and continuous variables cannot be mapped to shape.

Dat X Y shape1 16 022 6 13 3 6 24 46 35 5 6 46 15 57 25 68 35 79 4 5 810 5 5 911 14 1012 24 1113 3 4 1214 4 4 1315 5 4 1416 13 1517 23 1618 3 3 1719 4 3 1820 5 3 1921 12 2022 22 2123 32 2224 42 2325 5 2 2426 11 25

Mapping shape column data to aes (shape)

Library (ggplot2) p=ggplot (dat,aes) + geom_point (size=20) print (p)

The error will be reported directly, pay attention to the conversion factor first:

Dat$shape=factor (dat$shape) p=ggplot (dat,aes) + geom_point (size=10) print (p)

From the result picture, we can obviously know that the mapping of shape is valid, only 6, the first six factors are valid, while the later factors can not appear other shape (corresponding factors "0", "1", "2". Not the numbers 0, 1, 2.)

Therefore, in the process of data collation, it should be noted that there should be no more than six classifications based on shape mapping.

The above is about the content of this article on "the method of aes (shape) mapping in ggplot2 point map geom_point". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more related knowledge, please follow the industry information channel.

Tags: Content factors methods data validity articles knowledge articles obvious value variables pictures most that is numbers more steps knowledge points results industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Docker MySQL Apple Xiaomi