Irregular scatter plot

Hi I am having issues creating a proper scatter plot for the description product and countries listed. Please I need help, find below the code used, p.s I am new to R language, and would also need a mentor pls

slid3 %>%
slice(1:200) %>%
ggplot(aes(Country_name, Quantity,
colours = Description_name)) +
geom_point(size = 3, alpha = 0.5) +
geom_line(colour = "red")
geom_smooth(method = lm, se = F) +
ggtitle = ("Card Party Games Sales Distribution")

and also the title of the graph is not showing on the graph

Thanks in advance

Please post a small sample of your data. You can do this by posting the output of

dput(head(slid3,20))

Please put lines with three back ticks just before and after the pasted output, like this
```
Your output here
```
What is wrong with the plot generated by your code?

Hi i have sent the image of the graph, it just doesn't look like a scattered plot.

We still need your data to work with your code. Please post some as described previously.

The plot looks generally as I would expect for a plot with categories on the x axis.

In your code, you should have colour = Description_name not colours and I think the method of geom_smooth should be in quotes, "lm".

ok thanks will add the features in

thanks the colour did change but the main title is not showing and also i thought i would have a line connecting all the dots, maybe I should change the scatter plot of boxplot or bar graph

The title does not appear because the correct syntax is

ggtitle ("Card Party Games Sales Distribution")

with no = after ggtitle.

I had this error message Error: Cannot add ggproto objects together. Did you forget to add this object to a ggplot object?

Is there some reason you are not willing to post a sample of your data as I have requested twice? Working with the actual data is far easier than me trying to debug your code without data.

When you change your code, and report a new error, we don't have your new code to refer to in order to identify your problem. You missed out a + symbol possibly, but we can't tell you where without seeing your code. (And your code to us is more useful along with sample data also)

so sorry just read your post. Its fine I need the help so I don't mind.
slid3 %>%
slice(1:50) %>%
ggplot(aes(Country_name, Quantity,
colour = Description_name)) +
geom_point(size = 3, alpha = 0.5) +
geom_line(colour = "red")
geom_smooth(method = "lm", se = F) +
theme_bw() +
labs(title = "Card Party Games Sales Distribution")

do you need the data set?

should I repost the code?

I see that you did, and you need a plus between geom line and geom smooth

If you still need help, yes, I need the data set. This code will give output that you can paste here.

dput(head(slid3, 20))

That will be 20 rows of data. Change the 20 to a number that makes sense for your data. Place three back ticks before and after your pasted data when you post it here. The back tick key is to the left of the 1 key on a US keyboard.
```
Paste your data here
```

I tried uploading the dataset but got an error message that file is too large, I put the 3 ticks before and after but keep getting an error message

thanks just added that

CARD PARTY GAMES 	12	0.42	12433	Norway
CARD PARTY GAMES 	12	0.42	14829	United Kingdom
CARD PARTY GAMES 	12	0.42	12433	Norway
CARD PARTY GAMES 	12	0.42	16686	United Kingdom
CARD PARTY GAMES 	12	0.42	18245	United Kingdom
CARD PARTY GAMES 	12	0.42	12947	United Kingdom
CARD PARTY GAMES 	12	0.42	12484	Spain
CARD PARTY GAMES 	12	0.42	17555	United Kingdom
CARD PARTY GAMES 	12	0.42	15023	United Kingdom
CARD PARTY GAMES 	12	0.42	13742	United Kingdom
CARD PARTY GAMES 	12	0.42	12625	Germany
CARD PARTY GAMES 	12	0.42	14049	United Kingdom
CARD PARTY GAMES 	12	0.42	15358	United Kingdom
CARD PARTY GAMES 	12	0.42	13004	United Kingdom
CARD PARTY GAMES 	12	0.42	15601	United Kingdom
CARD PARTY GAMES 	12	0.42	13309	United Kingdom
CARD PARTY GAMES 	12	0.42	14081	United Kingdom
CARD PARTY GAMES 	72	0.36	14646	Netherlands
CARD PARTY GAMES 	12	0.42	13285	United Kingdom
CARD PARTY GAMES 	12	0.42	13089	United Kingdom
CARD PARTY GAMES 	12	0.42	12474	Germany
CARD PARTY GAMES 	12	0.42	14470	United Kingdom
CARD PARTY GAMES 	12	0.42	14157	United Kingdom
CARD PARTY GAMES 	12	0.42	14157	United Kingdom
CARD PARTY GAMES 	12	0.42	17164	United Kingdom
CARD PARTY GAMES 	12	0.42	16871	United Kingdom
CARD PARTY GAMES 	12	0.42	13481	United Kingdom
CARD PARTY GAMES 	144	0.36	14646	Netherlands
CARD PARTY GAMES 	12	0.42	14286	United Kingdom
CARD PARTY GAMES 	12	0.42	12428	Finland
CARD PARTY GAMES 	12	0.42	13700	United Kingdom
CARD PARTY GAMES 	12	0.42	16187	United Kingdom
CARD PARTY GAMES 	12	0.42	15935	United Kingdom
CARD PARTY GAMES 	72	0.36	14646	Netherlands
CARD PARTY GAMES 	72	0.36	17511	United Kingdom
CARD PARTY GAMES 	12	0.42	14769	United Kingdom
CARD PARTY GAMES 	12	0.42	14049	United Kingdom
CARD PARTY GAMES 	12	0.42	15203	United Kingdom
CARD PARTY GAMES 	12	0.42	13018	United Kingdom
CARD PARTY GAMES 	12	0.42	14447	United Kingdom
CARD PARTY GAMES 	12	0.42	14389	United Kingdom
CARD PARTY GAMES 	12	0.42	15349	United Kingdom
CARD PARTY GAMES 	12	0.42	13761	United Kingdom
CARD PARTY GAMES 	24	0.42	14085	United Kingdom
CARD PARTY GAMES 	12	0.42	17299	United Kingdom
CARD PARTY GAMES 	24	0.42	14808	United Kingdom
CARD PARTY GAMES 	12	0.42	13815	Germany
CARD PARTY GAMES 	12	0.42	16713	United Kingdom
CARD PARTY GAMES 	12	0.42	12474	Germany
CARD PARTY GAMES 	12	0.42	12615	France
CARD PARTY GAMES 	12	0.42	16616	United Kingdom
CARD PARTY GAMES 	12	0.42	17405	United Kingdom
CARD PARTY GAMES 	12	0.42	16186	United Kingdom
CARD PARTY GAMES 	24	0.42	12836	United Kingdom
CARD PARTY GAMES 	12	0.42	14305	United Kingdom
CARD PARTY GAMES 	12	0.42	14307	United Kingdom
CARD PARTY GAMES 	12	0.42	16655	United Kingdom
CARD PARTY GAMES 	12	0.42	16187	United Kingdom
CARD PARTY GAMES 	12	0.42	12865	Austria
CARD PARTY GAMES 	12	0.42	15752	United Kingdom
CARD PARTY GAMES 	12	0.42	14057	United Kingdom
CARD PARTY GAMES 	12	0.42	12360	Austria
CARD PARTY GAMES 	12	0.42	13939	United Kingdom
CARD PARTY GAMES 	12	0.42	12948	United Kingdom
CARD PARTY GAMES 	12	0.42	15856	United Kingdom
CARD PARTY GAMES 	12	0.42	17299	United Kingdom
CARD PARTY GAMES 	12	0.42	17365	United Kingdom
CARD PARTY GAMES 	3	0.42	14096	United Kingdom
CARD PARTY GAMES 	12	0.42	13004	United Kingdom
CARD PARTY GAMES 	12	0.42	13354	United Kingdom
CARD PARTY GAMES 	12	0.42	15933	United Kingdom
CARD PARTY GAMES 	12	0.42	18223	United Kingdom
CARD PARTY GAMES 	4	0.42	14096	United Kingdom
CARD PARTY GAMES 	12	0.42	13520	Switzerland
CARD PARTY GAMES 	1	0.42	14096	United Kingdom
CARD PARTY GAMES 	12	0.42	17758	United Kingdom
CARD PARTY GAMES 	12	0.42	12472	Germany
CARD PARTY GAMES 	12	0.42	17365	United Kingdom
CARD PARTY GAMES 	12	0.42	13588	United Kingdom
CARD PARTY GAMES 	12	0.42	17272	United Kingdom
CARD PARTY GAMES 	1	0.42	14096	United Kingdom
CARD PARTY GAMES 	12	0.42	14286	United Kingdom
CARD PARTY GAMES 	12	0.42	18226	United Kingdom
CARD PARTY GAMES 	7	0.42	14096	United Kingdom
CARD PARTY GAMES 	12	0.42	17947	United Kingdom
CARD PARTY GAMES 	24	0.42	12357	Switzerland
CARD PARTY GAMES 	1	0.42	14096	United Kingdom
CARD PARTY GAMES 	12	0.42	13426	United Kingdom
CARD PARTY GAMES 	9	0.42	14096	United Kingdom
CARD PARTY GAMES 	12	0.42	15933	United Kingdom
CARD PARTY GAMES 	12	0.42	14049	United Kingdom
CARD PARTY GAMES 	12	0.42	12620	France
CARD PARTY GAMES 	7	0.42	14096	United Kingdom
CARD PARTY GAMES 	12	0.42	14293	United Kingdom
CARD PARTY GAMES 	144	0.36	14646	Netherlands
CARD PARTY GAMES 	12	0.42	14189	United Kingdom
                    ```

I copied the data you posted into a file and separated the columns with commas. I had to guess at the column names. Using that data and the code you posted, I get the following.

library(ggplot2)
slid3 <- read.csv("~/R/Play/Dummy.csv")
head(slid3)
#>    Description_Name V1   V2 Quantity   Country_Name
#> 1 CARD PARTY GAMES  12 0.42    12433         Norway
#> 2 CARD PARTY GAMES  12 0.42    14829 United Kingdom
#> 3 CARD PARTY GAMES  12 0.42    12433         Norway
#> 4 CARD PARTY GAMES  12 0.42    16686 United Kingdom
#> 5 CARD PARTY GAMES  12 0.42    18245 United Kingdom
#> 6 CARD PARTY GAMES  12 0.42    12947 United Kingdom
slid3 |> 
  ggplot(aes(Country_Name, Quantity,
             colour = Description_Name)) +
  geom_point(size = 3, alpha = 0.5) +
  geom_line(colour = "red") +
  geom_smooth(method = "lm", se = F) +
  theme_bw() +
  labs(title = "Card Party Games Sales Distribution")
#> `geom_smooth()` using formula 'y ~ x'

Created on 2021-11-02 by the reprex package (v2.0.1)
How would you like that to be different?

To post data in a copy-friendly way, you can use the dput() function. Below is the dput() output for the first ten rows of the data.

> dput(head(slid3,10))
structure(list(Description_Name = c("CARD PARTY GAMES ", "CARD PARTY GAMES ", 
"CARD PARTY GAMES ", "CARD PARTY GAMES ", "CARD PARTY GAMES ", 
"CARD PARTY GAMES ", "CARD PARTY GAMES ", "CARD PARTY GAMES ", 
"CARD PARTY GAMES ", "CARD PARTY GAMES "), V1 = c(12L, 12L, 12L, 
12L, 12L, 12L, 12L, 12L, 12L, 12L), V2 = c(0.42, 0.42, 0.42, 
0.42, 0.42, 0.42, 0.42, 0.42, 0.42, 0.42), Quantity = c(12433L, 
14829L, 12433L, 16686L, 18245L, 12947L, 12484L, 17555L, 15023L, 
13742L), Country_Name = c("Norway", "United Kingdom", "Norway", 
"United Kingdom", "United Kingdom", "United Kingdom", "Spain", 
"United Kingdom", "United Kingdom", "United Kingdom")), row.names = c(NA, 
10L), class = "data.frame")

The structure() function in that output can be copied into a script and its returned value is a data frame of the first 10 rows.

oh wow thank you. Highly appreciated