Torvaney / ggsoccer

Plot soccer event data in R/ggplot2
https://torvaney.github.io/ggsoccer/
Other
178 stars 27 forks source link

Additional data sources [side-tracked] #12

Closed Torvaney closed 4 years ago

Torvaney commented 5 years ago
Zuhgoh commented 4 years ago

Please, i dont know if it s possible but could you help me. I try to use ggsoccer...I m not an expert, i discovered R, and i would like put on the map the mean position of my player. The GPS give me position X and Y. But the max X is 100 and the max Y is 64... How can i change with theme_pitch(). Thanks for you answer Have a nice day

Torvaney commented 4 years ago

Hey @Zuhgoh - it sounds like you are using a new data source that's not present in the package. Fortunately, if you know the dimensions of your data source, this is relatively easy to do!

You just need to create a new list containing the dimensions of your data source like the ones found here: https://github.com/Torvaney/ggsoccer/blob/master/R/dimensions.R

# fill in ??? with your data's dimensions 
pitch_zuhgoh <- list(
  length = 100,
  width = 64,
  penalty_box_length = ???,
  penalty_box_width = ???,
  six_yard_box_length = ???,
  six_yard_box_width = ???,
  penalty_spot_distance = ???,
  goal_width = ???,
  origin_x = ???,
  origin_y = ???
)

Then you can supply this list as an argument to annotate_pitch:

ggplot() +
  annotate_pitch(dimensions = pitch_zuhgoh) +
  theme_pitch() +
  # ... etc
Zuhgoh commented 4 years ago

Thank youuuuuuuuuuuuuuuuuuuuuuuuuuu

If i ve got other question, can i ask you? I m new and i try to learn this new world for me.... Thanks

Le jeu. 19 mars 2020 à 13:14, Ben Torvaney notifications@github.com a écrit :

Hey @Zuhgoh https://github.com/Zuhgoh - it sounds like you are using a new data source that's not present in the package. Fortunately, if you know the dimensions of your data source, this is relatively easy to do!

You just need to create a new list containing the dimensions of your data source like the ones found here: https://github.com/Torvaney/ggsoccer/blob/master/R/dimensions.R

fill in ??? with your data's dimensions pitch_zuhgoh <- list(

length = 100, width = 64, penalty_box_length = ???, penalty_box_width = ???, six_yard_box_length = ???, six_yard_box_width = ???, penalty_spot_distance = ???, goal_width = ???, origin_x = ???, origin_y = ??? )

Then you can supply this list as an argument to annotate_pitch:

ggplot() + annotate_pitch(dimensions = pitch_zuhgoh) + theme_pitch() +

... etc

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Torvaney/ggsoccer/issues/12#issuecomment-601145249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOYDSPPO2EDLRBWQ4UDTPPDRIIECTANCNFSM4HE4ME4A .

Zuhgoh commented 4 years ago

Just one question, since i try with "my field", i can t see my plot... Could you help me?

Le jeu. 19 mars 2020 à 17:27, Zuh Goh zuhgoh@gmail.com a écrit :

Thank youuuuuuuuuuuuuuuuuuuuuuuuuuu

If i ve got other question, can i ask you? I m new and i try to learn this new world for me.... Thanks

Le jeu. 19 mars 2020 à 13:14, Ben Torvaney notifications@github.com a écrit :

Hey @Zuhgoh https://github.com/Zuhgoh - it sounds like you are using a new data source that's not present in the package. Fortunately, if you know the dimensions of your data source, this is relatively easy to do!

You just need to create a new list containing the dimensions of your data source like the ones found here: https://github.com/Torvaney/ggsoccer/blob/master/R/dimensions.R

fill in ??? with your data's dimensions pitch_zuhgoh <- list(

length = 100, width = 64, penalty_box_length = ???, penalty_box_width = ???, six_yard_box_length = ???, six_yard_box_width = ???, penalty_spot_distance = ???, goal_width = ???, origin_x = ???, origin_y = ??? )

Then you can supply this list as an argument to annotate_pitch:

ggplot() + annotate_pitch(dimensions = pitch_zuhgoh) + theme_pitch() +

... etc

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Torvaney/ggsoccer/issues/12#issuecomment-601145249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOYDSPPO2EDLRBWQ4UDTPPDRIIECTANCNFSM4HE4ME4A .

Zuhgoh commented 4 years ago

Sorry, now all is ok... just a question, how can i do for put numbers with ","... for example 42,12? Because R tell me "Error in data.frame(x = c(41, 8, 52, 7, 57, 2), y = c(50.2, 16, 5, 33)) : les arguments impliquent des nombres de lignes différents : 6, 4"

Sorry sorry and thanks thanks

Le jeu. 19 mars 2020 à 18:23, Zuh Goh zuhgoh@gmail.com a écrit :

Just one question, since i try with "my field", i can t see my plot... Could you help me?

Le jeu. 19 mars 2020 à 17:27, Zuh Goh zuhgoh@gmail.com a écrit :

Thank youuuuuuuuuuuuuuuuuuuuuuuuuuu

If i ve got other question, can i ask you? I m new and i try to learn this new world for me.... Thanks

Le jeu. 19 mars 2020 à 13:14, Ben Torvaney notifications@github.com a écrit :

Hey @Zuhgoh https://github.com/Zuhgoh - it sounds like you are using a new data source that's not present in the package. Fortunately, if you know the dimensions of your data source, this is relatively easy to do!

You just need to create a new list containing the dimensions of your data source like the ones found here: https://github.com/Torvaney/ggsoccer/blob/master/R/dimensions.R

fill in ??? with your data's dimensions pitch_zuhgoh <- list(

length = 100, width = 64, penalty_box_length = ???, penalty_box_width = ???, six_yard_box_length = ???, six_yard_box_width = ???, penalty_spot_distance = ???, goal_width = ???, origin_x = ???, origin_y = ??? )

Then you can supply this list as an argument to annotate_pitch:

ggplot() + annotate_pitch(dimensions = pitch_zuhgoh) + theme_pitch() +

... etc

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Torvaney/ggsoccer/issues/12#issuecomment-601145249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOYDSPPO2EDLRBWQ4UDTPPDRIIECTANCNFSM4HE4ME4A .

Zuhgoh commented 4 years ago

Sorry,

I ve got a question, the last... it s possible to change the field and put the pitcure in files attachement?

Thanks

Le jeu. 19 mars 2020 à 13:14, Ben Torvaney notifications@github.com a écrit :

Hey @Zuhgoh https://github.com/Zuhgoh - it sounds like you are using a new data source that's not present in the package. Fortunately, if you know the dimensions of your data source, this is relatively easy to do!

You just need to create a new list containing the dimensions of your data source like the ones found here: https://github.com/Torvaney/ggsoccer/blob/master/R/dimensions.R

fill in ??? with your data's dimensions pitch_zuhgoh <- list(

length = 100, width = 64, penalty_box_length = ???, penalty_box_width = ???, six_yard_box_length = ???, six_yard_box_width = ???, penalty_spot_distance = ???, goal_width = ???, origin_x = ???, origin_y = ??? )

Then you can supply this list as an argument to annotate_pitch:

ggplot() + annotate_pitch(dimensions = pitch_zuhgoh) + theme_pitch() +

... etc

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Torvaney/ggsoccer/issues/12#issuecomment-601145249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOYDSPPO2EDLRBWQ4UDTPPDRIIECTANCNFSM4HE4ME4A .

Torvaney commented 4 years ago

Sorry, now all is ok... just a question, how can i do for put numbers with ","... for example 42,12? Because R tell me "Error in data.frame(x = c(41, 8, 52, 7, 57, 2), y = c(50.2, 16, 5, 33)) : les arguments impliquent des nombres de lignes différents : 6, 4"

This is because your x and y vectors (arguments to data.frame) have different lengths.

I ve got a question, the last... it s possible to change the field and put the pitcure in files attachement?

I'm not sure what you mean here, I'm afraid.

In future, if you need more general R help, including setting up RStudio and the like, you may get more timely useful answers on other forums. https://community.rstudio.com/ tends to be quite friendly and helpful. https://stackoverflow.com/ is another option, but is less beginner-friendly.