Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
1 answer
35 views

Multiple columns in legend using ggplot

I have a dataframe (wi_hist_df) that contains three columns (below I have printed a part of it): weights Frequency Criterion 1 0.2425 2 Criterion_1 2 0.2475 15 Criterion_1 3 0....
0 votes
1 answer
45 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 ...
gabt's user avatar
  • 774
0 votes
1 answer
19 views

ggplot manually adjusting attributes

I am trying to change the legend on this plot in ggplot. I want it to have both the appropriate linetype and color in the one legend. However, I would be satisfied if I could just fix the linetype ...
kpr62's user avatar
  • 563
1 vote
1 answer
121 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 ...
gabt's user avatar
  • 774
2 votes
0 answers
47 views

Add p-value breaks to a gene oncology dot plot [closed]

I am so close to finishing up a gene oncology-gene ratio figure for a lab assignment, but I am struggling with adjusting my p-value breaks. I'd like to have control to having p-value range from 0.001 ...
KenH's user avatar
  • 31
0 votes
0 answers
41 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), ...
dan's user avatar
  • 6,242
1 vote
2 answers
42 views

Separate Legend Entries for Individual Outlined Overlapping Bars

I am creating a ggplot with multiple overlapping bar plots. The first underlying bar is filled with color and then I overlay one more set of bars with just an outline to show sub-components. I would ...
fowlermw's user avatar
0 votes
1 answer
78 views

How to show values next to bars in tornado chart using ggplot in R [closed]

I have this table (T_Tornado_Total_EM_HM_sort): And these are the lines that I used to make the tornado chart: ggplot(T_Tornado_Total_EM_HM_sort, aes(Tipovi_troškova, RSD, fill=Populacija)) + ...
newtoR's user avatar
  • 35
0 votes
0 answers
28 views

ggplot legend in R not recognising aesthetic changes for label category with no data points

Consider the following image: Although the underlying dataset does not contain values below 0.1 degrees Celsius, I want to and still can force the legend to display the label and box for 'Below 0.1', ...
shogi's user avatar
  • 65
0 votes
1 answer
37 views

ggplot2 - how to keep the legend items with the same size, when geom_segment() has different sizes? [duplicate]

I'm plotting several segments as once using ggplot2, with two different sizes. An example of what I want to do is provided in one of the answers here. Here's the example they provide: ggplot2::ggplot()...
mto23's user avatar
  • 391
0 votes
3 answers
63 views

Having different shapes of points for each line and making them shown on the legends

My goal is to make the graph look something like this My Goal. The problem I'm having is that ggplot won't let me use more than 6 kinds of shapes for the points, so my graph looks something like this ...
Jason Liu's user avatar
0 votes
2 answers
37 views

Overlapping legend of a line plot

I want to show each line as having a different color and shape, and that should be reflected on the legend. Basically, it should look something like this My Goal. I could make the color and point ...
Jason Liu's user avatar
1 vote
0 answers
35 views

How to align legend elements in the middle when they are on two rows using ggplot2?

In the MWE below, the caption appears separated into two rows. I want the item corresponding to gear 5 to be aligned in the middle in relation to gears 3 and 4 above it. How can I do this? library(...
Daniel Valencia C.'s user avatar
0 votes
1 answer
98 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, ...
Assa Yeroslaviz's user avatar
1 vote
1 answer
76 views

Title and legend adjustment with `grid.arrange`

I have 6 different plots in R that I want to arrange in one plot with grid.arrange. They share the same legend, but whenever I want to put a common legend, the sizes of the plots are adjusted ...
Masal Gezici's user avatar

15 30 50 per page