blog/graphics-in-r-with-ggplot2/ #61
Replies: 20 comments 3 replies
-
Comment written by Souradip Mookerjee on August 22, 2020 12:09:04: Great article! |
Beta Was this translation helpful? Give feedback.
-
Comment written by Antoine Soetewey on August 22, 2020 12:11:35: Thanks Souradip for your feedback! (and your help about commento) |
Beta Was this translation helpful? Give feedback.
-
Comment written by MiRcea Sauciuc on September 02, 2020 06:56:00: Hi, Antoine, Newer to your blog; love the content and your explanations. I'm curious about Axis Ticks: can that also be used for dates? I find myself in situations with continuous data (daily dates), and if I try to do any high-level EDA, the x-axis is jam-packed with (unreadable) dates. So I was looking for ways to fix the issue. Perhaps even making the data weekly/monthly. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Comment written by Antoine Soetewey on September 02, 2020 17:32:10: Dear Mircea, Good question. I'll update the blog with a section about dates, and I'll let you know when I added it. Regards, |
Beta Was this translation helpful? Give feedback.
-
Comment written by Antoine Soetewey on September 03, 2020 06:52:03: Dear Mircea, See this section on how to manage dates in ggplot2. Hope this helps. Regards, |
Beta Was this translation helpful? Give feedback.
-
Comment written by MiRcea Sauciuc on September 10, 2020 05:50:52: Hello, Antoine, Thank you very much! Best, |
Beta Was this translation helpful? Give feedback.
-
Comment written by Mostafa Mohammad Rezaee on November 24, 2020 04:37:27: Great post. Thanks for sharing. I wish I had seen this post earlier. I have "Statistical Graphics" this semester through the "Graphics for Statistics and Data Analysis with R", Second Edition, as the textbook. Anyway, this book provides readers with all codes for its graphs through its website. A combination of this post and the book would be great. |
Beta Was this translation helpful? Give feedback.
-
Comment written by Antoine Soetewey on November 24, 2020 07:17:50: Dear Mostafa, Glad you like it! Regarding the textbook, thanks for the suggestion too--I'll make sure to check it out. Regards, |
Beta Was this translation helpful? Give feedback.
-
Hello Antoine Soetewey,
|
Beta Was this translation helpful? Give feedback.
-
Dear Muhammad, Thanks for your comment. Here is your plot (with base R) versus my plot (with ggplot2): You'll find the code here. Feel free to edit the plot according to your needs. Also, it may be a good idea to check the Hope this helps. Regards, |
Beta Was this translation helpful? Give feedback.
-
Comment written by George Chacko on September 16, 2020 10:36:28: Nice primer- thanks very much. |
Beta Was this translation helpful? Give feedback.
-
Comment written by Antoine Soetewey on September 16, 2020 11:17:39: Glad you like it George! |
Beta Was this translation helpful? Give feedback.
-
Thank you very much, now it is perfect. |
Beta Was this translation helpful? Give feedback.
-
Very valuable introduction to GGPLOT2, thanks! There are some code snippets that I do not understand in the facets section:
I do not know what the (. ~ drv) and (~year) arguments are referencing. John Orr |
Beta Was this translation helpful? Give feedback.
-
Dear John,
In this context, with Hope that helps. Regards, |
Beta Was this translation helpful? Give feedback.
-
Antoine, |
Beta Was this translation helpful? Give feedback.
-
You could read "~ year" as follows: create a multi-panel plot with one pane per year. So "~" is similar to "per" or "by". In practice, if you want to create a multi-panel plot based on one variable you would use facet_wrap(). If you want to create a multi-panel plot based on more than one variables you would use facet_grid() because it allows for more control over the layout. facet_grid() follows the pattern facet_grid(row_variable ~ column_variable). So with facet_grid(year ~ drv) you will create a multi-panel plot with each year as row and each level of drv as column. But with facet_grid(. ~ drv) it's like saying "I want to create a multi-panel plot with no variable as row and each level of drv as column". Does it make more sense now? |
Beta Was this translation helpful? Give feedback.
-
Antoine, Thanks. |
Beta Was this translation helpful? Give feedback.
-
Dear Antoine, as always your tutorials are clear worded, concise and yet so dense with information. There really should be something on the internet like votes one can give for the best internet tutors so that one could boost your work! Antoine, I remain with but one question: How do I create boxplots to detect univariate outlier for a df that contains multiple variables? Do not look for the panel function but much rather something like the correlogram you once blogged about. |
Beta Was this translation helpful? Give feedback.
-
Hello. Thank you for the great article! I had a question regarding the line charts. I would like to make one to track performance, but the problem is that my the variable on the x-achse is a factor. Is it possible to bild a line (trend) chart, when one variable is numeric and the other one a factor?
Keep up the good work :) |
Beta Was this translation helpful? Give feedback.
-
Graphics in R with ggplot2 - Stats and R
Learn how to create professional graphics and plots in R (histogram, barplot, boxplot, scatter plot, line plot, density plot, etc.) with the ggplot2 package
https://statsandr.com/blog/graphics-in-r-with-ggplot2/
Beta Was this translation helpful? Give feedback.
All reactions