Questions tagged [geom-vline]

59 questions
0
votes
1 answer

If else in ggplot + switching values between character and numeric for geom_vline

I need to integrate if else block in ggplot, where depending on value for variable_to_switch it will: if value is numeric -> plot line value is text -> do NOT plot line I provide my code in the most complete version to take in account possible…
Iraleksa
  • 155
  • 1
  • 9
0
votes
1 answer

draw geom_vlines with different colors relative to the modalities of a variable

I have several geom_vline() in my plot coresponding to the date where the variable "cas" changes value and I want them to have a different colors relatively to the variable "cas". Is there a way to do that? Here's my codes: df <-…
Stella
  • 69
  • 1
  • 10
0
votes
1 answer

Set geom_vline line types and sizes with aes mapping in ggplot2

I'm trying to create a histogram with vertical lines overlaid on top of it. One of the vertical lines shows a target, the rest show percentiles. I would like the line representing the target to be different than the other lines. I have the data for…
TomAdair
  • 321
  • 1
  • 10
0
votes
2 answers

Wrong legend in ggplot output

The output of this code gives a distribution and two vertical lines, one red and one blue. But in the legend the blue line is marked "red" and vice versa. What might be the reason? Distribution and 2 vertical lines variances <-…
dhruvak_a
  • 31
  • 7
0
votes
1 answer

Ggplot with a separate geom_vline for each group

I have around 160 countries (output$ccname), log GDP (output$lnrgdpch), output$endyear as year variable and a binary variable for when a leader died (1= died) output$natural2. I am trying to create plots in 2-3 figures (doesn't matter how they are…
0
votes
0 answers

geom_vline and scale_x_discrete dont fit with each other

I am a newbie here. 1, The aim is to plot a graph about the mean NDVI value during a time period (8 dates were chosen from 2019-05 to 2019-10) of my study site (named RB1). And plot vertical lines to show the date with a grass cutting event. 2, Now…
0
votes
1 answer

geom_vline doesn't work after the scale_x_discrete in R

I am a newie here, sorry for not writing the question right :p 1, the aim is to plot a graph about the mean NDVI value during a time period (8 dates were chosen from 2019-05 to 2019-10) of my study site (named RB1). And plot vertical lines to show…
0
votes
1 answer

ggplot geom_vline on x-axis of class date

I am trying to add a geom_vline in a function where the x-axis consists of dates. The plot shows NOK vs EUR, and the vertical lines are supposed to show up on dates with policy rate changes. The following code shows no vertical lines: nok_eur_plot…
ElToro1966
  • 831
  • 1
  • 8
  • 20
0
votes
1 answer

How can I add a vertical line to a ts_plot?

I have downloaded a timeline from a twitter user and try to visualise the number of tweets over time. I'm doing it with rtweets ts_plot. Now I'm trying to add a vertical line in my graph. As far as I know ts_plot allows you to work with it as if it…
bgf
  • 11
  • 3
0
votes
2 answers

How to color code multiple lines in geom_vline and maintain the ordering?

I want to highlight the metric mean and median in Histogram plot using vertical lines. red to denote mean and blue to denote median. I am able to draw tow different kines however unable to order the color codes as per metrics. I have created a…
0
votes
0 answers

How to add labels at the top of vlines in ggplot2 and add these in separate legends

I have created a dummy dataframe representative of my data- SQ AgeGroup Prop LCI UCI 2010-1 0 to 18 4.3 4.2 4.4 2010-1 19 to 25 5.6 5.3 5.6 2010-1 26 and over 7.8 7.6 7.9 2010-2 0 to 18 …
HM8689
  • 143
  • 1
  • 1
  • 10
0
votes
1 answer

geom_vline() dateRangeInput()

I have set up a line graph in shiny. The x axis has dates covering 2014 to current date. I have set up various vertical lines using geom_vline() to highlight points in the data. I'm using dateRangeInput() so the user can choose the start/end date…
Steve
  • 625
  • 2
  • 5
  • 17
0
votes
2 answers

Why doesn't my geom_vline object show up on my plot?

I have looked at a number of solutions to others' problems relating to the same issues, but nothing thus far has worked for me. I want a vertical line to appear on "2018-07-23" and this code is the closest I have gotten (in that it doesn't produce…
Mus
  • 7,290
  • 24
  • 86
  • 130
-1
votes
1 answer

Control ggplot parameter in asthetics from geom_vline - legend names and colors

I'd like to know HOW I can edit the legend title. It were really hard to control the name displayed in geom_vline, and yet it is wrong since somehow it's change the legend of color scheme. I'm using ggplot from tidyverse. Thanks in…
Aureliano Guedes
  • 767
  • 6
  • 22
1 2 3
4