Relative Content

Tag Archive for rggplot2

How to make differentiated data more smooth in R?

So, I have data, that is cumulative, that is, $x_t=x_{t-1}+x$. I need to get values $x$ of the data. I tried to use function diff(), but it makes the plot of the data very sharp and angular, I would like to smooth the differentiated data, how can I do this?

Overlay two population pyramid plots in one ggplot graph

I’m trying to overlay two population pyramid plots in one ggplot2 plot. I first created a plot using the census data with lighter colors and then try to superimpose another plot (created using the survey data with darker colors, say darkred, steelblue) onto the former. Is there any way I can do that while having their gender (sex) labels displayed on the legend? (Male (c/s) refers to Male (census/survey), the same goes to Female). This post is a reference.

Overlay two population pyramid plots in one ggplot graph

I’m trying to overlay two population pyramid plots in one ggplot2 plot. I first created a plot using the census data with lighter colors and then try to superimpose another plot (created using the survey data with darker colors, say darkred, steelblue) onto the former. Is there any way I can do that while having their gender (sex) labels displayed on the legend? (Male (c/s) refers to Male (census/survey), the same goes to Female). This post is a reference.

Label points individually in ggplot2/ggarrange graphs

I created three plots in ggplot2 to show the sex ratio in a panel dataset over different years.
Everything worked well, but when labeling the points of the graph and then putting them together with ggarrange some of the lables just drop out of the graph and cannot be read anymore or they overlap even thought I specified position = position_dodge.

R ggplot add legend to graph associating custom color palette to column names

I have a dataset of multiple measurements that were taken under two different conditions. I graphed each dataset on the same graph and used a different color palette for the different conditions the data was gathered under. I’ve also joined all the sets of data so that they are in a single dataframe that looks like this: