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.
Drawing Maps with Raster Data in ggplot2
지도 데이터는 벡터(Vector) 또는 래스터(Raster) 데이터로 나뉜다. 이 포스팅에서는 래스터(Raster) 데이터를 이용하여 지도를 그려볼까한다. 래스터(Raster) 데이터 모델은 셀의 연속 그리드로 공간을 나타낸다. raster 데이터를 읽고 활용할 수 있는 패키지는 대표적으로 terra
와 raster
정도 있다. 각각 함수명이나 파라메터 사용법 정도 다를 뿐 원리는 동일하다. 하나씩 알아보려 한다.
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.