All Questions
14
questions
0
votes
1
answer
668
views
Split legend in ggarrange
I have a problem with scale of legend, because text of legend crosses borders of plot. Any idea, how can I fix it? Split or resize?
Data cleaning:
Filtering data
df <- df %>%
filter(!(is.na(...
0
votes
0
answers
701
views
R - Set scale to (min, max) on us_maps legend across different variables in loop
I am using us_maps to graph outcome variables across states and time. These variables have vastly different ranges. For example, one variable ranges from 0 to 1 and another ranges from 0 to 1 million. ...
2
votes
2
answers
711
views
How to create a linetype legend in ggplot with different dataframes
I have been struggling with creating a legend in my ggplot for some time now, and I cannot find any answer that works.
This is the stripped down version of my ggplot:
ggplot() +
geom_smooth(data = ...
1
vote
1
answer
127
views
How to unify a legend with different types of scales in ggplot?
I have a data frame separated by 3 different factors. I want to represent this data frame with a scatter plot, using different types of scale for each factor.
I want to use shapes 21, 22 and 24, which ...
3
votes
1
answer
905
views
How to change legend title position when I have multiple scales created with ggnewscale package?
I created a plot which has 2 color scales and 2 linetype scales made with the ggnewscale package. I want the legend to appear at the bottom of the plot and the legend titles to appear above the labels....
2
votes
2
answers
1k
views
How to combine fill (columns) and color (points and lines) legends in a single plot made with ggplot2?
In a chart I have columns and points. I'm trying to unify the legend; I've already put the same name on the scales, but they still appear separate. Could someone please help me solve this issue?
...
8
votes
3
answers
6k
views
R ggplot heatmap with multiple rows having separate legends on the same graph
I'm trying to make one heatmap using ggplot2 that contains 3 types of variables where each need their own independent legend/scale.
I am able to plot them all in one heatmap (pictured below), but I am ...
2
votes
0
answers
543
views
How to combine two manual scales in ggplot? [duplicate]
I have a plot with 2 lines. Each line has its own color and type, however I failed trying to create the legend for this plot. I created 2 scale_..._manual, one for the line types, and other one for ...
10
votes
2
answers
14k
views
alpha and fill legends in ggplot2 boxplots?
I'm trying to combine alpha and fill aesthetics. It works when I'm using geom_bar (or geom_points, for color), but the alpha legend doesn't work in when I'm using geom_boxplot.
library(data.table)
...
1
vote
1
answer
2k
views
scale_y_discrete in bubble plot: how to change the font of axis labels?
I am relatively new to R and I am trying to make a bubble plot, exciting!
Most of it is working, except I don't seem to be able to do two things:
change the font size of the axis labels
change the ...
0
votes
1
answer
214
views
ggplot not adding legend. What am I missing? very new to R
I'm plotting three samples with ggplot but it's not adding a legend for the samples. It's not spitting out any error message so I'm not sure where I'm going wrong. I'd really appreicate some guidance.
...
1
vote
1
answer
4k
views
change the scale manually and legend labels to reflect intervals
I have plotted a map in ggplot and used
library(ggplot2)
library(maps)
states <- map_data("world")
test<-data.frame(Market=c("Fayzabad","Herat","Jalalabad","Kabul","Kandahar","Maymana","Mazar",...
0
votes
1
answer
972
views
diverging size scale ggplot2
I am trying to map model/obs differences at locations in space. I have color mapped to the diff but I would also like to map size to diff. i'm currently mapping size to abs(diff) but it produces two ...
0
votes
1
answer
1k
views
how to add a legend to a plot with two layers in R
Here is codes of R.
When I run the following code, it does not have a legend. Could you help me figure out how to add a legend showing blue point and smooth are alzheimer and pinks are others? Thank ...