Home > database >  Specifying geom_path by y-axis
Specifying geom_path by y-axis

Time:02-02

Struggling with specifying geom_path such that the line connection below is avoided. I want the path to be going down the y-axis alone.

Here is the dataset:

xer_filename    task_code   unpivot_val
DD20210630.xer  HBA-DPE-1000020 2022-08-30 08:00
DD20210725.xer  HBA-DPE-1000020 2022-08-30 08:00
DD20210830.xer  HBA-DPE-1000020 2022-08-30 08:00
DD20210919.xer  HBA-DPE-1000020 2022-02-17 08:00
DD20211104.xer  HBA-DPE-1000020 2022-01-27 08:00
DD20211128.xer  HBA-DPE-1000020 2022-04-22 08:00
DD20211226.xer  HBA-DPE-1000020 2022-07-07 08:00

Using ggplot and unpivot_value as date

library(ggplot2)
dataset$unpivot_val <- as.Date(dataset$unpivot_val, "%Y-%m-%d")

This is my current command:

ggplot(data = dataset, aes(y = xer_filename, x = unpivot_val, group = task_code,colour=task_code))   geom_line()   geom_point()   guides(x="axis",x.sec="axis")   scale_y_discrete(limits=rev)   geom_path(aes(group=task_code))

Help appreciated!

enter image description here

CodePudding user response:

Found out the solution was to simply remove geom_line() from my equation. Seems geom_line and geom_path must plot additive to eachother.

enter image description here

  •  Tags:  
  • Related