Questions tagged [ggplot2]

0 votes
1 replies
Set white background with plot that includes marginals (ggExtra + ggplot2)
I want to generate a PDF with many plots, one per page. These plots contain marginal distributions on the sides, generated with ggExtra: library...
asked 1 month ago
0 votes
1 replies
Omitting NA values for legend in ggplot
TAI structure(list(year = c("2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018"), month = c(1, 2, 3...
asked 1 month ago
0 votes
1 replies
The colors in ggplot do not correspond to the colors in the legend
I created a histogram from the World Happiness Report and reorder the values. However, I´d like the colors from the plot to match the colors from...
asked 1 month ago
0 votes
1 replies
How to add titles to multiple plots of data frames within a list?
I am trying to create plots with ggplot for 20 data frames ("df1" - "df20") that are contained in a list called "list1". The list looks like this...
asked 1 month ago
-1 votes
3 replies
ymax to count values
I am trying to build a geom_linerange plot where ymax is a count of non-numerical values that appear in my data. The x axis needs to show categor...
asked 1 month ago
0 votes
1 replies
Tidyeval in a function with dplyr and ggplot2
So I create the name with :=, but I want to use it in ggplot2 as y which does not seem to work. library(tidyverse) date_group_plot_line <- f...
asked 1 month ago
0 votes
2 replies
How to plot multiple facets histogram with ggplot in r?
i have a dataframe structured like this Elem. Category. SEZa SEZb SEZc A. ONE. 1. 3. 4 B. TWO. 4. 5. 6 i want to...
asked 1 month ago
0 votes
2 replies
Plot 10 highest bars with ggplot2 instead of 70 bars
For my assignment I have a dataset of Olympic Medal Winners and need to make a stacked bar chart. I currently have the following plot. My code...
asked 1 month ago
0 votes
1 replies
Graph is not generating properly in shiny only a single bar is shown in graph
I have imported the dataset = students for generating the reactive plots but proper plot is not generated .I am using ggplot for plots so could...
asked 1 month ago
0 votes
1 replies
Breaks in scale_x_continuous doesn't seem to work
I am simply trying to show the breaks on the x axis of a plot (5,4,3,2,1,.5) but it will not show the .5. When I tried to code below, it resulted...
asked 1 month ago
-1 votes
1 replies
How to split data in column to draw box plot in R
I would like to draw a box plot splitting data in one column ("var_2" below) into two boxes from this column, based on data in another column ("v...
asked 1 month ago
0 votes
1 replies
R language: Insert a map into another using ggmap
I am trying to insert a map into another. And even when one time it worked, frequently I break R Studio. First map: Luxemburgo library(rgdal)...
asked 1 month ago
3 votes
1 replies
Override horizontal positioning with ggrepel
I'm working on a chart similar to a slopegraph, where I'd like to put labels along one or both sides with ample blank space to fit them on both s...
asked 1 month ago
0 votes
1 replies
ggplot - Keep a variable length text inside canvas
I need that the text showed by geom_text must be inside the canvas of the plot. The problem is that the content of the geom_text is dynamically a...
asked 1 month ago
0 votes
0 replies
Add second legend to ggplot
I have this data LUI structure(list(year = c("2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018"),...
asked 1 month ago
0 votes
2 replies
ggrepel labels outside (to the right) of ggplot area
library(tidyverse) library(ggrepel) df <- structure(list(Fruit = c("Yellow Pear", "Yellow Pear", "Yellow Pear", "Yellow Pear", "Yellow Pear",...
asked 1 month ago
-1 votes
1 replies
How to reorder the plotting of a ggplot scatter graph with a variable colour aesthetic
I am plotting a simple ggplot scatter plot of one variable against another, faceted into a third variable and coloured based on a fourth. It is...
asked 1 month ago
0 votes
1 replies
Edit y-axis according to registered values
Hi I have a list of dataframes, with data like this: Element 1 subset to year 2018 structure(list(year = c("2018", "2018", "2018", "2018",...
asked 1 month ago
-1 votes
0 replies
How to display multiple variables in ggplot2?
I am new in R languagr and now I am learning ggplot2 plotting and I have some problems with plotting multiple variables in one graph . I need to...
asked 1 month ago
0 votes
1 replies
plot names of columns in R?
This is a subset of my dataset: structure(list(zone = c(3L, 4L, 2L), la3 = c(1, 6, 3), la4 = c(3, -2, 5)), row.names = c("1", "2", "3"), class...
asked 1 month ago
0 votes
1 replies
Scale scatterpie plots ggplot
I have this data structure(list(year = c("2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018", "2018"), month...
asked 1 month ago
-1 votes
0 replies
In ggplot2, how to change line width in geom_line? I can't make it thinner [duplicate]
Datalink: the data used My code: ccfsisims <- read.csv(file = "F:/Purdue University/RA_Position/PhD_ResearchandDissert/PhD_Draft/GTAP-CGE/GT...
asked 1 month ago
0 votes
0 replies
Error: Aesthetics must be either length 1 or the same as the data (100000): colour [duplicate]
I am doing some analysis in ggplot2 at the moment for a project and by chance I stumbled across some (for me) weird behavior that I cannot explai...
asked 1 month ago
0 votes
0 replies
How to change color of one tick on x axis
I have a multiple points on my x axis so I am trying to plot only every 10000th of them but also add one of the numbers in series which doesn't f...
asked 1 month ago
0 votes
1 replies
Connect geom_segment to geom_point outside the plot in ggplot?
I need help to connect a geom_segment to a geom_point outside the plot. I tried looking up answers to similar questions but that did not solve my...
asked 1 month ago