Code cause graphical problems

Hi,

I have a question on how to manually edit the codes below, are there any grammer issues related to string, numbers? Why the graph doesn't coming through correctly?

Code:
w<-read.csv(file="Satisfaction.csv",head=TRUE,sep=",")
p<-ggplot(data=w,aes(x=LE,y=WellBeing,color=Country))
p+geom_point(size=4)
print(p + geom_point(size=4)+ggtitle("Jielan Liu Question 4")+theme(plot.title=element_text(hjust=0.5)))

Console tab:
w<-read.csv(file="Satisfaction.csv",head=TRUE,sep=",")

p<-ggplot(data=w,aes(x=LE,y=WellBeing,color=Country))
p+geom_point(size=4)
print(p + geom_point(size=4)+ggtitle("Jielan Liu Question 4")+theme(plot.title=element_text(hjust=0.5)))

Plot:

Can you help to find the error in R codes to cause this graph? Unfortunately, all my R codes for others graph also show this table, I don't know how to amend the coding.

Thanks

In order to help you, we need sample data on a copy/paste friendly format since it seems you are new to R, I'm going to help you to create a reprex this time, but I hope you learn from this and provide your own REPRoducible EXample (reprex) next time.

# Sample data on a copy/paste friendly format
sample_df <- data.frame(stringsAsFactors=FALSE,
                     ID = c(109, 18, 26, 127, 17, 53, 76, 48, 80, 146, 11, 103,
                            107, 4, 132, 64, 74, 151, 21, 123, 129, 135, 85,
                            124, 65, 148, 150, 19, 60, 3, 112, 121, 134, 1, 113,
                            82, 12, 59, 92, 110, 106, 33, 23, 91, 5, 117, 94, 70,
                            50, 55, 46, 86, 83, 10, 137, 31, 78, 13, 102, 104, 88,
                            32, 14, 77, 36, 73, 15, 51, 6, 45, 27, 119, 98, 63,
                            143, 38, 37, 118, 69, 116, 81, 120, 138, 140, 49, 72,
                            84, 147, 66, 128, 111, 22, 40, 145, 42, 114, 61, 96,
                            58, 67, 28, 8, 144, 125, 29, 16, 30, 7, 57, 24, 25,
                            71, 97, 149, 75, 122, 108, 56, 126, 79, 139, 90, 89,
                            87, 142, 62, 35, 101, 52, 34, 47, 43, 133, 20, 141,
                            136, 39, 44, 95, 131, 100, 130, 41, 105, 93, 54, 9, 2,
                            68, 99, 115),
                Country = c("Afghanistan", "Albania", "Algeria", "Angola",
                            "Argentina", "Armenia", "Australia", "Austria",
                            "Azerbaijan", "Bahrain", "Bangladesh", "Belarus",
                            "Belgium", "Belize", "Benin", "Bolivia",
                            "Bosnia and Herzegovina", "Botswana", "Brazil", "Bulgaria",
                            "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada",
                            "Central African Republic", "Chad", "Chile", "China",
                            "Colombia", "Comoros", "Congo", "Congo,
                            Dem. Rep. of the", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba",
                            "Cyprus", "Czech", "Denmark", "Djibouti",
                            "Dominican Republic", "Ecuador", "Egypt", "El Salvador",
                            "Estonia", "Ethiopia", "Finland", "France", "Georgia",
                            "Germany", "Ghana", "Greece", "Guatemala", "Guinea",
                            "Guyana", "Haiti", "Honduras", "Hong Kong", "Hungary",
                            "Iceland", "India", "Indonesia", "Iran", "Iraq",
                            "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan",
                            "Kazakhstan", "Kenya", "Korea", "Kuwait",
                            "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Liberia", "Libya",
                            "Lithuania", "Luxembourg", "Macedonia", "Madagascar",
                            "Malawi", "Malaysia", "Mali", "Malta", "Mauritania",
                            "Mauritius", "Mexico", "Moldova", "Mongolia",
                            "Morocco", "Mozambique", "Myanmar", "Namibia", "Nepal",
                            "Netherlands", "New Zealand", "Nicaragua", "Niger",
                            "Nigeria", "Norway", "Pakistan", "Palestine", "Panama",
                            "Paraguay", "Peru", "Philippines", "Poland",
                            "Portugal", "Qatar", "Romania", "Russia", "Rwanda",
                            "Saudi Arabia", "Senegal", "Serbia", "Sierra Leone",
                            "Singapore", "Slovakia", "Slovenia", "South Africa", "Spain",
                            "Sri Lanka", "Sudan", "Sweden", "Switzerland",
                            "Syria", "Tajikistan", "Tanzania", "Thailand", "Togo",
                            "Trinidad and Tobago", "Tunisia", "Turkey",
                            "Turkmenistan", "Uganda", "Ukraine", "United Arab Emirates",
                            "United Kingdom", "United States of America", "Uruguay",
                            "Uzbekistan", "Venezuela", "Vietnam", "Yemen",
                            "Zambia", "Zimbabwe"),
              Continent = c("Asia", "Europe", "Africa", "Africa",
                            "South America", "Europe", "Ocenia", "Europe",
                            "Europe", "Asia", "Asia", "Europe", "Europe", "Europe",
                            "Africa", "South America", "Europe", "Africa",
                            "South America", "Europe", "Africa", "Africa", "Asia",
                            "Africa", "North America", "Africa", "Africa",
                            "South America", "Asia", "South America", "Africa", "Africa",
                            "Africa", "South America", "Africa", "Europe",
                            "South America", "Europe", "Republic Europe", "Europe",
                            "Africa", "South America", "South America", "Africa",
                            "South America", "Europe", "Africa", "Europe", "Europe",
                            "Europe", "Europe", "Africa", "Europe",
                            "South America", "Africa", "South America", "North America",
                            "South America", "Asia", "Europe", "Europe", "Asia",
                            "Asia", "Asia", "Asia", "Europe", "Asia", "Europe",
                            "North America", "Asia", "Asia", "Asia", "Africa", "Asia",
                            "Asia", "Asia", "Asia", "Europe", "Asia", "Africa",
                            "Africa", "Europe", "Europe", "Europe", "Africa",
                            "Africa", "Asia", "Africa", "Europe", "Africa", "Africa",
                            "North America", "Europe", "Asia", "Africa",
                            "Africa", "Asia", "Africa", "Asia", "Europe", "Europe",
                            "South America", "Africa", "Africa", "Europe", "Asia",
                            "Asia", "North America", "South America",
                            "South America", "Asia", "Europe", "Europe", "Asia", "Europe",
                            "Asia", "Africa", "Asia", "Africa", "Europe", "Africa",
                            "Asia", "Europe", "Europe", "Africa", "Europe",
                            "Asia", "Africa", "Europe", "Europe", "Asia", "Asia",
                            "Africa", "Asia", "Africa", "North America", "Africa",
                            "Asia", "Asia", "Africa", "Europe", "Asia", "Europe",
                            "North America", "Africa", "Asia", "South America",
                            "Asia", "Asia", "Africa", "Africa"),
        Life_Expectancy = c(48.7, 76.9, 73.1, 51.1, 75.9, 74.2, 81.9, 80.9,
                            70.7, 75.1, 68.9, 70.3, 80, 76.1, 56.1, 66.6, 75.7,
                            53.2, 73.5, 73.4, 55.4, 50.4, 63.1, 51.6, 81, 48.4,
                            49.6, 79.1, 73.5, 73.7, 61.1, 57.4, 48.4, 79.3, 55.4,
                            76.6, 79.1, 79.6, 77.7, 78.8, 57.9, 73.4, 75.6,
                            73.2, 72.2, 74.8, 59.3, 80, 81.5, 73.7, 80.4, 64.2, 79.9,
                            71.2, 54.1, 69.9, 62.1, 73.1, 82.8, 74.4, 81.8,
                            65.4, 69.4, 73, 69, 80.6, 81.6, 81.9, 73.1, 83.4, 73.4,
                            67, 57.1, 80.6, 74.6, 67.7, 67.5, 73.3, 72.6, 56.8,
                            74.8, 72.2, 80, 74.8, 66.7, 54.2, 74.2, 51.4, 79.6,
                            58.6, 73.4, 77, 69.3, 68.5, 72.2, 50.2, 65.2, 62.5,
                            68.8, 80.7, 80.7, 74, 54.7, 51.9, 81.1, 65.4, 72.8, 76.1,
                            72.5, 74, 68.7, 76.1, 79.5, 78.4, 74, 68.8, 55.4,
                            73.9, 59.3, 74.5, 47.8, 81.1, 75.4, 79.3, 52.8, 81.4,
                            74.9, 61.5, 81.4, 82.3, 75.9, 67.5, 58.2, 74.1, 57.1,
                            70.1, 74.5, 74, 65, 54.1, 68.5, 76.5, 80.2, 78.5, 77,
                            68.3, 74.4, 75.2, 65.5, 49, 51.4),
      Life_Satisfaction = c(4.8, 5.3, 5.2, 4.2, 6.4, 4.4, 7.4, 7.3, 4.2, 4.5,
                            5, 5.5, 6.9, 6.5, 3.7, 5.8, 4.7, 3.6, 6.8, 4.2, 4,
                            3.8, 4.2, 4.4, 7.7, 3.6, 3.7, 6.6, 4.7, 6.4, 3.9,
                            3.8, 4, 7.3, 4.2, 5.6, 5.4, 6.4, 6.2, 7.8, 5, 4.7, 5.8,
                            3.9, 6.7, 5.1, 4.4, 7.4, 6.8, 4.1, 6.7, 4.6, 5.8,
                            6.3, 4, 6, 3.8, 5.9, 5.6, 4.7, 6.9, 5, 5.5, 4.8, 5, 7.3,
                            7.4, 6.4, 6.2, 6.1, 5.7, 5.5, 4.3, 6.1, 6.6, 5, 5,
                            4.7, 5.2, 4.2, 4.9, 5.1, 7.1, 4.2, 4.6, 5.1, 5.6, 3.8,
                            5.8, 5, 5.5, 6.8, 5.6, 4.6, 4.4, 4.7, 5.3, 4.9, 3.8,
                            7.5, 7.2, 5.7, 4.1, 4.8, 7.6, 5.3, 4.8, 7.3, 5.8,
                            5.6, 4.9, 5.8, 4.9, 6.6, 4.9, 5.5, 4, 6.7, 3.8, 4.5,
                            4.1, 6.5, 6.1, 6.1, 4.7, 6.2, 4.2, 4.4, 7.5, 7.5, 4.1,
                            4.4, 3.2, 6.2, 2.8, 6.7, 4.7, 5.5, 6.6, 4.2, 5.1,
                            7.2, 7, 7.2, 6.1, 5.1, 7.5, 5.8, 3.9, 5.3, 4.8),
   Ecological_Footprint = c(0.5, 1.8, 1.6, 0.9, 2.7, 1.7, 6.7, 5.3, 2, 6.6,
                            0.7, 4, 7.1, 2.1, 1.4, 2.6, 2.7, 2.8, 2.9, 3.6,
                            1.5, 0.8, 1.2, 1.1, 6.4, 1.4, 1.9, 3.2, 2.1, 1.8, 1.3,
                            1.1, 0.8, 2.5, 1, 4.2, 1.9, 4.4, 5.3, 8.3, 1.8, 1.4,
                            2.4, 2.1, 2, 4.7, 1.1, 6.2, 4.9, 1.4, 4.6, 1.7, 4.9,
                            1.8, 1.7, 2.1, 0.6, 1.7, 5.8, 3.6, 6.5, 0.9, 1.1, 2.7,
                            1.4, 6.2, 4, 4.5, 1.7, 4.2, 2.1, 4.1, 0.9, 4.6, 9.7,
                            1.3, 1.3, 4, 2.8, 1.3, 3.2, 4.4, 10.7, 5.4, 1.2,
                            0.8, 3.9, 1.9, 4.3, 2.9, 4.6, 3.3, 2.1, 5.5, 1.3, 0.8,
                            1.9, 2, 0.8, 6.3, 4.3, 1.6, 2.6, 1.4, 4.8, 0.8, 1.4,
                            3, 3, 2, 1, 3.9, 4.1, 11.7, 2.8, 4.4, 0.7, 4, 1.5,
                            2.6, 1.1, 6.1, 4.7, 5.2, 2.6, 4.7, 1.2, 1.6, 5.7, 5,
                            1.5, 0.9, 1.2, 2.4, 1, 7.6, 1.8, 2.6, 4, 1.6, 3.2, 8.9,
                            4.7, 7.2, 5.1, 1.8, 3, 1.4, 0.9, 0.8, 1.2),
        Happiness_Index = c(36.8, 54.1, 52.2, 33.2, 54.1, 46, 42, 47.1, 40.9,
                            26.6, 56.3, 37.4, 37.1, 59.3, 31.1, 43.6, 42.4,
                            22.6, 52.9, 34.1, 31.8, 30.5, 40.3, 33.7, 43.6, 25.3,
                            24.7, 53.9, 44.7, 59.8, 36.5, 34.5, 30.5, 64, 35.9,
                            40.6, 56.2, 45.5, 39.4, 36.6, 37.2, 50.7, 52.5, 39.6,
                            58.9, 34.9, 39.2, 42.7, 46.5, 46, 47.2, 40.3, 40.5,
                            56.9, 30, 51.2, 41.3, 56, 37.5, 37.4, 40.2, 50.9, 55.5,
                            41.7, 49.2, 42.4, 55.2, 46.4, 58.5, 47.5, 51.7, 34.7,
                            38, 43.8, 27.1, 49.1, 49.1, 34.9, 42.9, 35.2, 40.8,
                            34.6, 29, 28.3, 46.8, 42.5, 40.5, 26, 43.1, 32.3,
                            36.6, 52.9, 48, 26.8, 47.9, 35.7, 44.2, 38.9, 45.6,
                            43.1, 51.6, 57.1, 26.8, 33.6, 51.4, 54.1, 51.2, 57.8,
                            45.8, 52.4, 52.4, 42.6, 38.7, 25.2, 42.2, 34.5, 36.9,
                            46, 33.3, 41.3, 28.8, 39.8, 40.1, 40.2, 28.2, 44.1,
                            49.4, 37.6, 46.2, 50.3, 47.1, 47.8, 30.7, 53.5, 28.2,
                            30.3, 48.3, 47.6, 39.1, 31.5, 37.6, 31.8, 47.9, 37.3,
                            39.3, 46, 56.9, 60.4, 43, 37.7, 35.3)
)

library(tidyverse)

sample_df %>% 
    ggplot(aes(x = Life_Expectancy, y = Life_Satisfaction, color = Country)) + 
    geom_point(size=4, show.legend = FALSE) + 
    ggtitle("Jielan Liu Question 4") + 
    theme(plot.title=element_text(hjust=0.5))

Created on 2019-11-30 by the reprex package (v0.3.0.9000)

1 Like

Hi,

Thanks. Yes, I am very new to Rstudio and doing self learning to complete School work. If you have any suggestion to improve learning sprees, it’s very welcome.

This is your code:

ample_df %>%
ggplot(aes(x = Life_Expectancy, y = Life_Satisfaction, color = Country)) +
geom_point(size=4, show.legend = FALSE) +
ggtitle("Jielan Liu Question 4") +
theme(plot.title=element_text(hjust=0.5))

  • My code start with

W<-read.csv(filled = β€œβ€, head=TRUE, sep=β€œβ€)
P<-ggplot( data=w, aes(x= LE, y=WellBeing, color=country)

  • geom_point(size=4)
  • print(ggtitle(β€œ Jielan Liu Question 4”) + theme(plot.title= element_text(hjust=0.5))

My code can not bring graph. Is that case from what lack of from your code?

Thx

The key difference is removing the leggend for Country with show.legend = FALSE

geom_point(size = 4, show.legend = FALSE) +

Hi,

I tried again, the graph still don't come out.This time I used udpated code:

w<-read.csv(filled= ",", head=TRUE, sep= ",")
p<-ggplot(data=w, aes(x=LE, y=WellBeing, color=Country) + geom_point(size=4, show.legend=FALSE) +print(ggtitle("Jielan Liu Question 4") + theme(plot.title = element_text(hjust=0.5))

My dataset is
ID Country Continent LE WellBeing Footprint HPI
109 Afghanistan Asia 48.7 4.8 0.5 36.8
18 Albania Europe 76.9 5.3 1.8 54.1
26 Algeria Africa 73.1 5.2 1.6 52.2
127 Angola Africa 51.1 4.2 0.9 33.2
17 Argentina South America 75.9 6.4 2.7 54.1
53 Armenia Europe 74.2 4.4 1.7 46
76 Australia Ocenia 81.9 7.4 6.7 42
48 Austria Europe 80.9 7.3 5.3 47.1
80 Azerbaijan Europe 70.7 4.2 2 40.9
146 Bahrain Asia 75.1 4.5 6.6 26.6
11 Bangladesh Asia 68.9 5 0.7 56.3
103 Belarus Europe 70.3 5.5 4 37.4
107 Belgium Europe 80 6.9 7.1 37.1
4 Belize Europe 76.1 6.5 2.1 59.3
132 Benin Africa 56.1 3.7 1.4 31.1
64 Bolivia South America 66.6 5.8 2.6 43.6
74 Bosnia and Herzegovina Europe 75.7 4.7 2.7 42.4
151 Botswana Africa 53.2 3.6 2.8 22.6
21 Brazil South America 73.5 6.8 2.9 52.9
123 Bulgaria Europe 73.4 4.2 3.6 34.1
129 Burkina Faso Africa 55.4 4 1.5 31.8
135 Burundi Africa 50.4 3.8 0.8 30.5
85 Cambodia Asia 63.1 4.2 1.2 40.3
124 Cameroon Africa 51.6 4.4 1.1 33.7
65 Canada North America 81 7.7 6.4 43.6
148 Central African Republic Africa 48.4 3.6 1.4 25.3
150 Chad Africa 49.6 3.7 1.9 24.7
19 Chile South America 79.1 6.6 3.2 53.9
60 China Asia 73.5 4.7 2.1 44.7
3 Colombia South America 73.7 6.4 1.8 59.8
112 Comoros Africa 61.1 3.9 1.3 36.5
121 Congo Africa 57.4 3.8 1.1 34.5
134 Congo, Dem. Rep. of the Africa 48.4 4 0.8 30.5
1 Costa Rica South America 79.3 7.3 2.5 64
113 Cote d'Ivoire Africa 55.4 4.2 1 35.9
82 Croatia Europe 76.6 5.6 4.2 40.6
12 Cuba South America 79.1 5.4 1.9 56.2
59 Cyprus Europe 79.6 6.4 4.4 45.5
92 Czech Republic Europe 77.7 6.2 5.3 39.4
110 Denmark Europe 78.8 7.8 8.3 36.6
106 Djibouti Africa 57.9 5 1.8 37.2
33 Dominican Republic South America 73.4 4.7 1.4 50.7
23 Ecuador South America 75.6 5.8 2.4 52.5
91 Egypt Africa 73.2 3.9 2.1 39.6
5 El Salvador South America 72.2 6.7 2 58.9
117 Estonia Europe 74.8 5.1 4.7 34.9
94 Ethiopia Africa 59.3 4.4 1.1 39.2
70 Finland Europe 80 7.4 6.2 42.7
50 France Europe 81.5 6.8 4.9 46.5
55 Georgia Europe 73.7 4.1 1.4 46
46 Germany Europe 80.4 6.7 4.6 47.2
86 Ghana Africa 64.2 4.6 1.7 40.3
83 Greece Europe 79.9 5.8 4.9 40.5
10 Guatemala South America 71.2 6.3 1.8 56.9
137 Guinea Africa 54.1 4 1.7 30
31 Guyana South America 69.9 6 2.1 51.2
78 Haiti North America 62.1 3.8 0.6 41.3
13 Honduras South America 73.1 5.9 1.7 56
102 Hong Kong Asia 82.8 5.6 5.8 37.5
104 Hungary Europe 74.4 4.7 3.6 37.4
88 Iceland Europe 81.8 6.9 6.5 40.2
32 India Asia 65.4 5 0.9 50.9
14 Indonesia Asia 69.4 5.5 1.1 55.5
77 Iran Asia 73 4.8 2.7 41.7
36 Iraq Asia 69 5 1.4 49.2
73 Ireland Europe 80.6 7.3 6.2 42.4
15 Israel Asia 81.6 7.4 4 55.2
51 Italy Europe 81.9 6.4 4.5 46.4
6 Jamaica North America 73.1 6.2 1.7 58.5
45 Japan Asia 83.4 6.1 4.2 47.5
27 Jordan Asia 73.4 5.7 2.1 51.7
119 Kazakhstan Asia 67 5.5 4.1 34.7
98 Kenya Africa 57.1 4.3 0.9 38
63 Korea Asia 80.6 6.1 4.6 43.8
143 Kuwait Asia 74.6 6.6 9.7 27.1
38 Kyrgyzstan Asia 67.7 5 1.3 49.1
37 Laos Asia 67.5 5 1.3 49.1
118 Latvia Europe 73.3 4.7 4 34.9
69 Lebanon Asia 72.6 5.2 2.8 42.9
116 Liberia Africa 56.8 4.2 1.3 35.2
81 Libya Africa 74.8 4.9 3.2 40.8
120 Lithuania Europe 72.2 5.1 4.4 34.6
138 Luxembourg Europe 80 7.1 10.7 29
140 Macedonia Europe 74.8 4.2 5.4 28.3
49 Madagascar Africa 66.7 4.6 1.2 46.8
72 Malawi Africa 54.2 5.1 0.8 42.5
84 Malaysia Asia 74.2 5.6 3.9 40.5
147 Mali Africa 51.4 3.8 1.9 26
66 Malta Europe 79.6 5.8 4.3 43.1
128 Mauritania Africa 58.6 5 2.9 32.3
111 Mauritius Africa 73.4 5.5 4.6 36.6
22 Mexico North America 77 6.8 3.3 52.9
40 Moldova Europe 69.3 5.6 2.1 48
145 Mongolia Asia 68.5 4.6 5.5 26.8
42 Morocco Africa 72.2 4.4 1.3 47.9
114 Mozambique Africa 50.2 4.7 0.8 35.7
61 Myanmar Asia 65.2 5.3 1.9 44.2
96 Namibia Africa 62.5 4.9 2 38.9
58 Nepal Asia 68.8 3.8 0.8 45.6
67 Netherlands Europe 80.7 7.5 6.3 43.1
28 New Zealand Europe 80.7 7.2 4.3 51.6
8 Nicaragua South America 74 5.7 1.6 57.1
144 Niger Africa 54.7 4.1 2.6 26.8
125 Nigeria Africa 51.9 4.8 1.4 33.6
29 Norway Europe 81.1 7.6 4.8 51.4
16 Pakistan Asia 65.4 5.3 0.8 54.1
30 Palestine Asia 72.8 4.8 1.4 51.2
7 Panama North America 76.1 7.3 3 57.8
57 Paraguay South America 72.5 5.8 3 45.8
24 Peru South America 74 5.6 2 52.4
25 Philippines Asia 68.7 4.9 1 52.4
71 Poland Europe 76.1 5.8 3.9 42.6
97 Portugal Europe 79.5 4.9 4.1 38.7
149 Qatar Asia 78.4 6.6 11.7 25.2
75 Romania Europe 74 4.9 2.8 42.2
122 Russia Asia 68.8 5.5 4.4 34.5
108 Rwanda Africa 55.4 4 0.7 36.9
56 Saudi Arabia Asia 73.9 6.7 4 46
126 Senegal Africa 59.3 3.8 1.5 33.3
79 Serbia Europe 74.5 4.5 2.6 41.3
139 Sierra Leone Africa 47.8 4.1 1.1 28.8
90 Singapore Asia 81.1 6.5 6.1 39.8
89 Slovakia Europe 75.4 6.1 4.7 40.1
87 Slovenia Europe 79.3 6.1 5.2 40.2
142 South Africa Africa 52.8 4.7 2.6 28.2
62 Spain Europe 81.4 6.2 4.7 44.1
35 Sri Lanka Asia 74.9 4.2 1.2 49.4
101 Sudan Africa 61.5 4.4 1.6 37.6
52 Sweden Europe 81.4 7.5 5.7 46.2
34 Switzerland Europe 82.3 7.5 5 50.3
47 Syria Asia 75.9 4.1 1.5 47.1
43 Tajikistan Asia 67.5 4.4 0.9 47.8
133 Tanzania Africa 58.2 3.2 1.2 30.7
20 Thailand Asia 74.1 6.2 2.4 53.5
141 Togo Africa 57.1 2.8 1 28.2
136 Trinidad and Tobago North America 70.1 6.7 7.6 30.3
39 Tunisia Africa 74.5 4.7 1.8 48.3
44 Turkey Asia 74 5.5 2.6 47.6
95 Turkmenistan Asia 65 6.6 4 39.1
131 Uganda Africa 54.1 4.2 1.6 31.5
100 Ukraine Europe 68.5 5.1 3.2 37.6
130 United Arab Emirates Asia 76.5 7.2 8.9 31.8
41 United Kingdom Europe 80.2 7 4.7 47.9
105 United States of America North America 78.5 7.2 7.2 37.3
93 Uruguay Africa 77 6.1 5.1 39.3
54 Uzbekistan Asia 68.3 5.1 1.8 46
9 Venezuela South America 74.4 7.5 3 56.9
2 Vietnam Asia 75.2 5.8 1.4 60.4
68 Yemen Asia 65.5 3.9 0.9 43
99 Zambia Africa 49 5.3 0.8 37.7
115 Zimbabwe Africa 51.4 4.8 1.2 35.3

That is the same data I used in my reprex above (with a proper format) and it works, could you be more specific about your issue? Do you get any error message?
Ideally try to make a proper reproducible for your issue as explained in this guide

Hi

I got the photo from Rstudio it is the same as yours. But how can I get the following photo:

image

It may color=Footprint instead of color=Country. And the color is based on the intensity of Footprint.
Thanks

I don't understand your question, it seems like you already answered to yourself.

Please, do not try to get your assignment done by people on the forum, you will learn nothing by doing so and it is against our homework policy.

If you need help with your homework, please ask your questions in the form of a reproducible example.

1 Like