Questions tagged [ggalt]

Extra Coordinate Systems, Geoms, Statistical Transformations, Scales & Fonts for ‘ggplot2’

A compendium of ‘geoms’, ‘coords’, ‘stats’, scales and fonts for ‘ggplot2’, including splines, 1d and 2d densities, univariate average shifted histograms, a new map coordinate system based on the ‘PROJ.4’-library and the ‘StateFace’ open source font ‘ProPublica’.

Vignettes

ggalt examples

Github repo

https://github.com/hrbrmstr/ggalt

17 questions
8
votes
1 answer

Adding a traditional legend to dumbbell plot in `ggalt::geom_dumbbell` in `R`

How to add a traditional legend to dumbbell plot created using ggalt::geom_dumbbell in R? This question has an answer with an in-chart legend. How to map the aesthetics to get a separate legend for the points on the side/bottom ? library(ggalt) df…
Crops
  • 5,024
  • 5
  • 38
  • 65
4
votes
1 answer

How to plot smoothed line (ggalt::xspline) plot with x-axis as factor

I have the following data frame: lp_dat <- structure(list(kmeans_cluster = c("1", "2", "3", "4", "1", "2", "3", "4", "1", "2", "3", "4"), tc = structure(c(2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L), .Label = c("NT", "IBD+PBS",…
littleworth
  • 4,781
  • 6
  • 42
  • 76
4
votes
2 answers

add a legend to ggalt::geom_dumbbell plot AND sort y axis

In this SO answer, user @Crops shows how to add a legend to a ggalt::geom_dumbbell plot. Very nice. library(ggalt) df <- data.frame(trt=LETTERS[1:5], l=c(20, 40, 10, 30, 50), r=c(70, 50, 30, 60, 80)) df2 = tidyr::gather(df, group, value,…
Eric Green
  • 7,385
  • 11
  • 56
  • 102
2
votes
0 answers

Clipping ggplot2 map by longitude R

I want to make a map of the Eastern U.S., however only within the longitude range of -95 degrees to -66.5 degrees I've started using ggplot2. library(ggplot2) us_map <- map_data('usa') map <- ggplot(data=us_map, aes(x=long, y=lat, group=group)) +…
colin
  • 2,606
  • 4
  • 27
  • 57
2
votes
1 answer

geom_dumbbell with coord_trans

I am trying to generate a dumbbell plot in ggplot, while also trying to log transform the x and y axes. System throws an error that I can't understand. Looking for some help. Here is the sample code: #create the data df <- data.frame(x = c(1, 2, 3,…
MorrisseyJ
  • 1,191
  • 12
  • 19
2
votes
2 answers

ggplot color axis labels based on variable

I have a dataframe called df_plot, I am trying to create a dumbbell plot sorted by a column (medium age 2020), with the axis assigned a color based on another category). This is very close but can someone explain to me why the colors in the axis do…
SLE
  • 65
  • 1
  • 17
1
vote
1 answer

How to colour points in a dumbbell plot based on condition?

I'm trying to colour the xend points in my dumbbell plot based on whether the x_diff value is positive or negative. Essentially, if the x_diff value is positive, I'd like the xend point coloured green, and if its negative, coloured red. I've…
Ben_89
  • 249
  • 1
  • 8
1
vote
1 answer

How to add data labels to dumbbell graph?

I need to add data labels with % signs to my dumbbell plot. Any idea how to do this? I have code that attempts to do this, but get the error "Error in x * 100 : non-numeric argument to binary operator". Also is it possible to increase the font of…
freeazabird
  • 347
  • 2
  • 11
1
vote
2 answers

Issues with geom_dumbbel plot giving me multiple points instead on single points

My dumbbell plot is giving me multiple points on my graph and I am wondering why. I assumed I am supposed to be getting a single point. I have tried editing the parameters but to no avail. it is making it difficult to add other aesthetics. I will…
1
vote
0 answers

Add a legend in ggplot dumbbell plot

I have created a dumbbell plot below and I would like to add a legend based on the color of the points which display x and xend. Is that possible for dumbbell? library(ggalt) health <-…
firmo23
  • 7,490
  • 2
  • 38
  • 114
1
vote
2 answers

Blank Plot Output when using "geom_xspline" in ggalt package

When trying to use geom_xspline from ggalt in conjunction with ggarrange from ggpubr, the output is blank and no other plot can be made before clearing with dev.off(). In my use-case I wanted the geom_xspline to replace some exisitng geom_line in my…
al-obrien
  • 1,353
  • 11
  • 29
1
vote
1 answer

Ignoring unknown parameters: point.colour.1

I'm using ggplot2 and ggalt to construct a Dumbbell plot showing a the point at which different patients were diagnosed with a disease to the point at which they died from said disease. I am using the following…
Ningman
  • 89
  • 1
  • 8
1
vote
1 answer

geom_lollipop (package Ggalt) not working

I am following the tutorial on how to use geom_lollipop, from the package ggalt at the following link. The code I am trying to run is the following: df <- read.csv(text="category,pct Other,0.09 South Asian/South Asian Americans,0.12 …
thepule
  • 1,721
  • 1
  • 12
  • 22
0
votes
1 answer

How to add circle on ggbiplot plot using geom_encircle from ggalt package?

Recently, I used ggbiplot package to draw the PCA plot. For better visualization, I also added geom_encircle to get circle region on the PCA result. How, the problem I met is I don't know how to get the mapping color consistently. I tried several…
花落思量错
  • 352
  • 1
  • 11
0
votes
1 answer

How to fill area under a curve created by geom_xspline

For the follow data df and plot, I hope to smooth the line, especially for the sharp corners parts marked by the blue rectangles in the figure below: df <- structure(list(date = c("2022-2-1", "2022-2-2", "2022-2-3", "2022-2-4", "2022-2-5",…
ah bon
  • 9,293
  • 12
  • 65
  • 148
1
2