The geom_crossbar
function in the ggplot2
package is useful for showing ranges and central points like the median or mean. Also, it can be used to make Gantt charts. Gantt charts are mainly used in project management to show task schedules and progress. They display the start and end times and durations of tasks with bars.
Enhance Your Charts - Adding Points to Line Graphs for Clarity
When the data doesn’t show much variation, a line graph created with ggplot2
can look a bit plain. In such cases, adding points to each coordinate can make the graph clearer and more distinct. In ggplot2
, you can use the geom_point
function to add points. There are 26 different shapes you can choose from, not just circles. This allows for more effective visualization when dividing lines by groups, as you can set different point shapes for each group, as shown below.
Creating Bubble Charts in R
A bubble chart is a type of data visualization that shows the relationship between three variables at the same time. It looks like a regular scatter plot with X and Y coordinates, but it also uses the size of the bubbles to show an extra variable. This makes bubble charts very useful for visualizing data with multiple dimensions.
[Read More]Drawing Donut Charts in R
There isn’t a specific function in ggplot2
for drawing donut charts. Nevertheless, you can use the coord_polar
function to bend a stacked bar plot along either the x-axis or y-axis to create a donut chart. The figure below is a simple example created as a donut chart.
Applying Colors to ggplot Graphs (viridis, brewer scales)
Creating a graph takes time to decide on the structure, but choosing colors often takes even longer. That’s because colors can make a graph look either outdated or aesthetically pleasing. Therefore, I tend to spend a lot of time on color selection. Here, I’ll briefly summarize functions that helps me with color selection. The program used is R
, and I’ve utilized the ggplot2
package.
Examples using the scales package with ggplot2
The scales
package contains functions for scaling adjustments used in ggplot2
. This package helps effectively adjust various properties of the graph such as axes, colors, and sizes. The following examples will help you understand the scales functions better.
(ggplot2) Setting Map Colors with scale_fill_viridis_d
I’ve been gradually learning how to draw maps using R programming. The key to a map graph is mapping colors to regions, so I’ve been studying related ggplot
functions one by one. In this post, I plan to write about how to map colors using the viridis
scale.