ggplot2 Questions

2

Solved

Say if have the following plot. library(ggplot2) n <- 1169 df22 <- data.frame(x = 1:n, val = seq(0, 0.5, length.out = n), type = 1) ggplot(df22, aes(x = x, y = val)) + geom_ribbon(aes(ymax...
Vivie asked 20/11, 2018 at 16:13

3

Solved

My goal is to reproduce this plot, and my problem is reproducing the gradient fill in each bar. ADDED after COMMENT The good comment of @PavoDive directs us to a question that basically says "You...
Doyle asked 3/8, 2015 at 16:8

4

Solved

I'm creating a facetted plot to view predicted vs. actual values side by side with a plot of predicted value vs. residuals. I'll be using shiny to help explore the results of modeling efforts using...
Affect asked 4/8, 2013 at 18:17

3

I can get a "filled" geom_line with either geom_ribbon or geom_area. Is there an equivalent for geom_step that doesn't require messing with polygons/barplots or creating the actual step points? Her...
Cydnus asked 19/2, 2014 at 16:54

1

2 ggplot objects that produce the same visual output are not necessarily identical, yet it's sometimes useful to assess their equivalence. How can we do this ? It looks like the feature won't be su...
Incidence asked 9/2 at 9:54

1

Solved

I am trying to make a Robinson-projection map that is not centered at longitude 0, and crosses both sides of the 180° line. My code is below: library("rnaturalearthdata") world <- ne_c...
Sible asked 5/2 at 19:22

5

Solved

I am using using plot(), matplot() and ggplot(). I am guessing the answer will be the same for all of them. I want to specify the thickness of the y-axis, the x-axis, and the other two lines that ...
Ceruse asked 2/5, 2013 at 10:20

8

Solved

How can I can remove the letter 'a' from the legend generated by this code? If I remove the geom_text, then the 'a' letter will not show in the legend. I want to keep geom_text, though. ggplot(data...
Offoffbroadway asked 20/8, 2013 at 14:29

2

I looked for a while, and was unable to locate a post discussing a similar issue. I am having an issue with date-scaling in ggplot, which I think is related to the way ggplot is handling dates. I a...
Overfill asked 9/11, 2015 at 18:48

3

Solved

I've hit a stumbling block in writing a ggplot function. I'm trying to change the facet labels in a ggplot facet_wrap plot.... but its proving trickier than I though it would be.... The data I am u...
Decay asked 12/12, 2015 at 16:0

2

Solved

there must surely be another way of removing trailing zeros in y axis tick labels than specifiying each label indivdiually with labels=c("0",...). I have a number of graphs plotted in a grid and t...
Damselfish asked 26/6, 2019 at 10:58

2

I'd like to use Unicode shapes in ggplot2 geom_point() (specifically, arrows like ↘, Unicode "\u2198", or LaTeX \searrow), as in shape = "\u2198", that are not in the default font. In this unanswer...
Dorladorlisa asked 25/2, 2019 at 16:43

2

Solved

I have a barplot with labels in white. Sometimes the color of background is too light and the white label becomes illegible. I'm looking for a function that takes a color value and returns whether ...
Realtor asked 22/3, 2018 at 19:49

3

Solved

Lets say, in R, I have a data frame letters, numbers and animals and I want to examine the relationship between all three graphically. I could do something like. library(dplyr) library(ggplot2) li...
Alms asked 10/1, 2018 at 3:9

2

Solved

I'm using this code to plot a map of temperature change in North America: ggplot(maps, aes(y=Latitude, x=Longitude, z=variable)) + ggtitle(title)+ scale_fill_brewer(palette = "Spectral")+ geom_...
Aquilegia asked 19/6, 2020 at 1:51

6

ggpairs in the GGally package seems pretty useful, but it appears to fail when there NA is present anywhere in the data set: #require(GGally) data(tips, package="reshape") pm <- ggpairs(tips[,1...
Secession asked 26/10, 2012 at 20:26

6

Solved

I'm trying to resize a plot to fit into my document, but I'm having difficulties getting the plotted diagram do be a square. Example: pdf(file = "./out.pdf", width = 5, height = 5) p <- ggplot...
Heteromorphic asked 14/8, 2011 at 12:36

4

Solved

I would like to plot some different data items using ggplot2, using two different colour scales (one continuous and one discrete from two different df's). I can plot either exactly how I would like...
Roturier asked 16/7, 2012 at 16:53

3

Solved

I have a list of ggplots that may be too complex to arrange using facet_wrap. All plots must share the same legend and should be arranged in a grid. Each column of the grid needs a different title,...
Prindle asked 21/2, 2020 at 23:40

3

Solved

On this page, they give the following example library(ggplot2) library(reshape2) ggplot(data=tips, aes(x=day)) + geom_bar(stat="bin") Instead of a count I'd like to have a frequency in y-axis. H...
Salado asked 7/11, 2013 at 12:29

6

Solved

I would like to associate sample size values with points on a plot. I can use geom_text to position the numbers near the points, but this is messy. It would be much cleaner to line them up along th...
Farrish asked 13/9, 2012 at 15:38

9

Solved

I have the following data (temp.dat see end note for full data) Year State Capex 1 2003 VIC 5.356415 2 2004 VIC 5.765232 3 2005 VIC 5.247276 4 2006 VIC 5.579882 5 2007 VIC 5.142464 ... and I ca...
Liles asked 30/3, 2015 at 22:41

4

Solved

I am plotting some multivariate data where I have 3 discrete variables and one continuous. I want the size of each point to represent the magnitude of change rather than the actual numeric value. I...
Grandaunt asked 8/12, 2021 at 1:59

3

Solved

This post describes a method to create a two-line x-axis (year below months) on a time series plot. Unfortunately, the method that I use from this post (option 2) is not compatible with ggsave(). ...
Nieshanieto asked 28/9, 2018 at 11:56

6

Solved

How can I remove the white margins in ggsave? My question is exactly the same as Remove white space (i.e., margins) ggplot2 in R. However, the answer there isn't ideal for me. Instead of trial and...
Abhenry asked 11/2, 2016 at 17:29

© 2022 - 2024 — McMap. All rights reserved.