256 questions
1
vote
1
answer
68
views
ggplot2 geom_point() points minimum size
Is there any way to get around ggplot2 minimum size for geom_points?
Ie here:
ggplot(df, aes(x = umap_1, y = umap_2, color = Protocol)) +
rasterise(geom_point(size = 0.0001), dpi = dpi) +
labs(x = ...
3
votes
1
answer
126
views
How to display a ggplot legend on both fill and shape [duplicate]
I am trying to create a ggplot point plot where both fill and shape are defined by additional variables. When I add shape to the aesthetic, the fill color disappears from the legend. How do I get the ...
0
votes
0
answers
90
views
How to fill half of a point (i.e., the top half or the bottom half) in a graph? [duplicate]
I want to fill only the top half or the bottom half, as shown below:
x= c(10, 20, 30, 40, 50, 60)
y= c(100, 150, 200, 220, 230, 245)
group= c("I", "I", "I", "II"...
0
votes
0
answers
53
views
how to fill markers for certain groups geom_point
HCI Graph
I am trying to highlight a group of countries among others. In particular, I want to highlight countries that are important markets to the US in Africa, while fading the others into the ...
0
votes
1
answer
53
views
Issues aligning geom_point and geom_errorbar in R ggplot2
I am trying to create a plot in R ggplot2 where my data (see below) has multiple outcomes. For each outcome there are 5 possible methods that need to be plotted (although some are NA and should leave ...
0
votes
2
answers
61
views
Why I am getting halos around some points that are plotted + Geom_Point +ggplot
I am generating boxplot overlayed with geom_points.For some of the geom_points, I see kind of halo/background around the point (See under the red and blue boxplots). What am I doing wrong and how can ...
0
votes
1
answer
46
views
How to order by totals in a combined stacked bar and scatter plot in R using ggplot
How can I sort Fuel in this chart by value_out.net i.e. the net values marked as black dots?
Please see the figure, and the code below:
fuels_out_plot_w_tot_order <- ggplot() +
geom_bar(data = ...
0
votes
1
answer
36
views
How can I align the median labels across the 4 levels of my geom_point?
I've added median lines to my geom_point and asked to attach labels to the right of them via hjust = -1.5. However, the label of the fourth level is misaligned, sitting a lot further to the right of ...
1
vote
1
answer
68
views
Plot points relative to a value in dataframe
I have plotted concentrations of phosphate at their respective sampling sites. However, I have three different depths at which phosphate was measured. Can I make the geom points a particular size to ...
1
vote
0
answers
44
views
geom_point adds extra point at y max
Creating a box plot in R using ggboxplot. Using geom_point to add individual data points and position = position_jitter(width = 0.2)) to spread them out.
The generated plot consistently adds an extra ...
0
votes
0
answers
48
views
How to reorder catgorical axis for dot plot with error bars
Here is the plot I have, the data & the code
ggplot(data = TI, aes(y = VM, x = GeoM)) +
geom_point() +
geom_errorbar(mapping = aes(xmin = L95, xmax = U95), width = .75) +
geom_vline(aes(...
1
vote
2
answers
98
views
function for geom_point to increase the scale_size
LATER EDIT: I finally figured out how to do it. It works with the following code:
legend_size <- c(6,5,4,3,2,1,0,1,2,3,4,5,6)
tt <- data.frame(x = c(27.9656, 27.1704, 26.2128 ,23.5634 ,25.3528 ...
1
vote
1
answer
59
views
Values not appearing in ggplot plot
When I made a plot using geom_point() and geom_line(), a few values in the middle didn't appear and I can't figure out why.
I have a dataframe with 3 columns (K_value, CV_error, and Run), where ...
1
vote
1
answer
48
views
Lollipop chart size and linewidth parameter failure & labels not appearing
I'm using ggplot2 to create a lollipop graph comparing US university tuitions and median household income (for all races and also for black households specifically). For the graph to be easier to read,...
0
votes
0
answers
211
views
Change point shape by group returns error "Shape aesthetic contains invalid values"
I am building a simple map with 3 points that I want to have different symbols but when I try to change the shape by group manually I get an error about shape aesthetics.
First a map:
library(ggplot2)
...
0
votes
1
answer
395
views
how to have a legend for size of geom_points() and also set the size of the dots themselves?
I am trying to plot a sort of bubble plot but i am unable to set the size of the dots and have a legend explaining how the sizing works.
These are two examples which combined give me the expected ...
0
votes
1
answer
53
views
How to increase the range of colors in a the geom_point?
I am trying the following code to make a heat map using ggplot
library(RColorBrewer)
color_palette <- brewer.pal(9, "Spectral")
ggplot(df, aes(x=x, y=y)) +
geom_point(aes(color=...
0
votes
0
answers
45
views
Is there a Shiny function to display a geom point shape palette?
I'm working on my first R Shiny application, specifically for customizable graph outputs. I'm looking for an input function similar to colourInput() from the colourpicker package, but which will ...
1
vote
1
answer
227
views
Vertical line (offset) to separate factor groups in a plot
I need help in producing a vertical line that can separate my character groups in a geom_point graph using ggplot. A simplified example is below. Ultimately, I want to produce a line that sits evenly ...
1
vote
1
answer
665
views
how to change size of symbol in ggplot2 when size, shape, and color are set through geom_point?
The problem i am having is surely trivial, and yet i am unable to solve it. What i need is to have my own shape, colour, and size for the geom_point(). However, if i set it, the size of the symbols in ...
0
votes
1
answer
83
views
Trying to turn a numeric matrix into a scatterplot with geom_point [duplicate]
I am trying to plot a 5x6 numeric vector using ggplot and geom_point (after converting the vector to a dataframe), but I can't figure out the aes mappings to make the plot correctly. I think I am ...
0
votes
0
answers
65
views
R's plotly ggplotly removing legend from a geom_point
I'm generating a simple geom_point plot with R ggplot2:
library(dplyr)
library(ggplot2)
set.seed(1)
df <- matrix(runif(16, 0, 10), nrow = 4, ncol = 4, dimnames = list(paste0("R", 1:4), ...
1
vote
1
answer
124
views
ggplot - How can I add a ":)" instead of the actual emoji of a smiley face?
I would like to add within the scale_shape_manual() of a ggplot a smiley face for a given category, but simple, so exactly as ":)".
However, I can only find an actual emoji (e.g. here or ...
0
votes
1
answer
682
views
How do I add a legend to ggplot with two scatter plots (geom_point() )
I have a table I read into R to plot with ggplots. I need to plot two sets of data points and also use an ifelse condition to be able to show specific genes.
I would like to show a legend to the plot, ...
0
votes
1
answer
164
views
Space between two dots in ggplot2
The spaces between two dots are vary, some are very far, and some are very narrow. And also, the order between two dots is likely random (Some are "non-transplan" are in the left, some are ...
0
votes
2
answers
44
views
Marking conditional geom_points with cross or outline color
I want to make a conditional geom_point , where sids that are x in the data are marked for example by a cross in the point or alternative outline color. Note that I don't want to add additional ...
0
votes
1
answer
542
views
Using custom shapes in ggplot
I want to use different degrees of fill in the shape circle to represent different variables in my data set. I have a column in my data set called 'shape' that has numbers 0,1,2,3 that correspond to ...
0
votes
1
answer
22
views
geom_path or geom_line to only take the first value to plot and not all
In my dataset below, I have a column (z) that I would like to plot by x and y. I dont want to plot all the z values though, only the first one for each line. In the first figure, you can see that ...
1
vote
1
answer
106
views
position_dodge not dodging in geom_point plot
I have a dataframe called pollen_agg.Here is its structure with dput(pollen_agg):
pollen_agg <- structure(list(taxa = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 3L,
3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L), ...
0
votes
0
answers
86
views
R plotly's ggplotly removing layers from ggplot2's geom_point
I'm creating the following fill, color, and size coded plot in R's ggplot2's geom_point:
Example dataset:
library(dplyr)
library(ggplot2)
set.seed(1)
levels.mat <- matrix(data = runif(7*6, 1, 3), ...
0
votes
1
answer
107
views
ggplot2 geom_point with both a gradient fill and border color [duplicate]
I'm trying to create an R ggplot2 geom_point plot where the points are gradient filled according to a numeric value, sized according to a numeric value, and border colored according to a boolean value....
0
votes
1
answer
75
views
overlapping colors in ggplot geom_point
I was looking to plot some points colored following 2 variables and overly colors.
thanks to this post, I have a close result like below
library(ggplot2)
data=data.frame(x=1:4,y=1:4,var1=c(1,0,0,1),...
1
vote
1
answer
79
views
How can I change position x-axis ticks in ggplot of regression
Having completed my regression equation and F-statistic I have been able to plot a regression curve with confidence limits through my set of data points which I am happy with. My x variable is number ...
1
vote
1
answer
33
views
Connecting geom_points (which are the means of different columns in a dataset) with a line
I am new to using R and I am sure there is a simple solution to this but having tried multiple methods and watched quite a few videos I wondered if someone could help give me some advice on this.
I ...
2
votes
1
answer
63
views
Assign a different fill and border colors to geom_point
I am trying to color-code points on a geom_point plot to mirror team colors of major league baseball teams (e.g. New York Mets would have a blue-filled point with an orange border). There are similar ...
0
votes
1
answer
68
views
How to plot every column of a data frame agains every other column using ggplot and geom point?
I have a data frame with 3 columns and I would like to plot every column versus the other column with geom_point. I am aware of ggpairs function but I would like to do this using regular geom_point().
...
0
votes
1
answer
438
views
geom_point colors not correct using ggplot2
I'm stumped as to why my points are incorrectly coloured. I have set my own colour palette and used this to define the colours of the geom_point() but the colours that are actually being plotted are ...
1
vote
2
answers
1k
views
How to connect geom_point and geom_line when using jittered position for points using facet_wrap in a graph with 2 subgroups?
I had a similar problem as in this post , and the solution almost worked for my data, but I'm having problems to connect the points to the lines when I add jitter. I addeded jitter to the geom_point (...
1
vote
2
answers
60
views
Apply custom model labels in ggplot2
This is likely trivial, but how can I:
Apply labels to each modelnum value on the y axis? Could just be named "Label1" for "a", "Label2" for "b" or something ...
0
votes
1
answer
2k
views
how to fix error in ggplot using geom_point null
pretty much what it says. i cant seem to create my scatterplot with the code that my prof basically hand fed to us
ggplot(df1, aes(mean, y)) +
geom_point() +
geom_errorbar(aes(ymin = lwr, ymax = upr, ...
2
votes
1
answer
203
views
How to show legend in a plot with both bars and points?
I have a dataframe the looks as follows:
COUNTRY YEAR y
AT 2019 25
AT 2020 38.0
AT 2021 23.4
BE 2019 11.1
BE 2020 18.6
BE 2021 15.0
DK 2019 ...
0
votes
1
answer
35
views
My point geometry overwrites my label geometry in my dendrogram
I am trying to create a dendrogram that conveys separate information with the label and geometry points. However, the code that I have written to make the aesthetic for the points at the end of the ...
0
votes
1
answer
57
views
Colors and Shapes in geom_point legend
Hi there I have a very simple problem I think, but I'm not sure how to fix it.
Basically, I have a geom_point plot where I have two approaches used and I wish to both differentiate shapes and colors ...
0
votes
0
answers
58
views
ggplot2 - scale color manual interfering in scale shape manual and plotting two labels (legends) [duplicate]
EDIT: Stack said my question is very similar to this one (Combine legends for color and shape into a single legend) but that person wanted to join two legends in one and I just want the wrong one to ...
0
votes
0
answers
68
views
Why is my ggplot2 map misreading input latitude and longitude data?
I am trying to add city points and labels to a ggplot2 map, and when I add a geom_point() layer to the map with a specified points drawn from a newly created dataframe with specified latitude and ...
0
votes
1
answer
96
views
R's ggplot's geom_point's label : is there any labeller-like solution for "translating" factor values?
Context:
I'm using R on RStudio to make, out of a .csv file (meu_primeiro_csv), a basic ggplot();
this .csv file was imported using read_csv(), and I manually entered the type of each column using ...
1
vote
1
answer
34
views
How to order geom's that overlap within a fill/color? Adding jitter looks too random
Let's say I have this plot illustrating some odds ratio from a main analysis:
Unfortunately, the geom's are overlapping and it is difficult to see the full range of the confidence interval.
ggplot(df,...
1
vote
1
answer
850
views
Plot the datapoints in a plot_model function
I'm trying to add the datapoints using geom_point() to the plot_model() that is showing the linear relationship between the age and left.LGN variables.
plot <- plot_model(m1, terms = c("age&...
0
votes
0
answers
108
views
geom_smooth in ggplot 2 not showing up because year are not in dates, but instead character vectors
I have the following graph (below) that I would like to add a trend line to. However, I am having the same issue as this person has previously outlined: geom_smooth in ggplot2 not working/showing up.
...
0
votes
0
answers
32
views
Group option in ggplot
I get an error in the group option:
! Problem while computing aesthetics.
ℹ Error occurred in the 2nd layer.
Caused by error in check_aesthetics():
! Aesthetics must be either length 1 or the same as ...