Category "ggplot2"

How to generate a map for property cluster

Could you help me make a graph in R similar to the one I inserted in the image below, which shows the properties on a map, differentiating by cluster. See in my

(CLOSED) Generating faceted pie charts to indicate weightages

I am looking to build a visual with multiple pie charts to showcase different sleeping conditions and their weightage across a week. Here's my dataset: structur

Increase space between two discrete values in a ggplot2 plot in R

I am trying to figure out how to add space in a plot between two discrete values on the x-axis. For example, in the plot below, I'd like to keep the same spacin

How to fill area below geom_line plot in ggplot with geom_rect?

This is my plot: library(ggplot2) economics <- economics %>% mutate(year = year(economics$date)) ggplot(economics,aes(year, unemploy))+ geom_line() +

Question when drawing a graph in r(dodge or geom_line)

I want to express the frequency of each column (a,b,c,d,e) in a graph of (t) for each group. I don't know what to do. As shown in the figure, the data was selec

How to draw rectangle around map area in R?

I have a map of the Northern Hemisphere centered around North America. I would like to draw a red rectangle around the USA (this is part of an inset map) howeve

R: ggplot with 6 different groups: Have 5 solid lines and for one group a dashed line

I have the following data: structure(list(Date = c("01.08.2018", "02.08.2018", "03.08.2018", "04.08.2018", "01.09.2018", "02.09.2018", "03.09.2018", "04.09.201

How to make alpha (transparency) appear as continuous gradient in the ggplot legend?

Is it possible to make the transparency (alpha) appear as a continuous gradient in the ggplot legend? Currently, the plot looks like this: Here, the different

Color coding in ggplot using geome_point, while maintaining size of point

I am plotting a dataset in R using three different variables (x=PassingFilerReads, y=meanCoverage, and size distribution of alignPercentageR1 over those two thi

Automatically find the best figure dimensions in r?

I am producing many different plots in rmakrdown using ggplot2 and don't want to manually edit their fig.width() ; fig.height() or fig.asp() one by one. Some pl

R data visualization: Is there a way to plot based on emmeans using ggplot?

I am trying to visualize my data separately as a bar graph and as a dot plot connected by a line. The experimental design includes 2 treatments, 3 levels for ea

How can I make one plot from multiple variables in ggplot?

I'm trying to make a pre-post change plot for three groups. In my data frame, pre data and post data are stored as two different variables like this. pre_treat

Tried scale_linetype_manual to add legend but not successful

Following the thread from Tried p + scale_fill_discrete(name = "New Legend Title") but legend title still not changing, I now only want to generate line plot wi

gridtext::element_markdown doesn't apply margin with css selector

I'm trying to define different margins for x-axis labels in ggplot2 using css syntax, as allowed by ggtext package. I created an object with the CSS selector an

How to recursively create squares, based on previous squares?

I have a df that contains coordinates to create a square: library(ggplot2) df = data.frame(xmin = 1, xmax = 3, ymin = 10, ymax = 15) ggplot(df) + geom

Ggplot2 rearranges wrongly the bars in a plot bar when value is null

Given the following data, I compose a data frame with a factor and a numeric column. X2 <- c(4,4,3,5,4,4,2,3,4,3,5,5,4,3,3,4,2,3,3,4,3,5,3,3,4,4,3,3,5,4,5,4,

How to split negative and positive bars by zero line in barplot?

My data have 2 numerical columns (positive and negative values) and 2 categorical variables. Now I want to plot negative and positive bars on same line, instead

Divide Legend by multiple groups

In am looking a solution to a different representation of the legend to the example given here: https://rpubs.com/ageek/ggplot-adv-part2 The code below gives th

Converting character to date turning all dates to NA & x-axis of ggplot not in chronological order [duplicate]

I am using an online ONS dataset of inflation and trying to chart it, but when plotting it with ggplot the x-axis is not in chronological orde

How can I plot the intercept and coefficient of my LMM with 95% confidence interval over spagetti plots in R?

To visualize the results of my linear mixed model (LMM) I would like to plot spagetti plots that track the change in volume1 over time for all participants. I w