Jump to content

Line connection in scatter plot


Santosh Kumar Davuluri

Recommended Posts

I have trouble connecting the lines correctly in a scatter plot.

 

A bit of background: I have a few subject Ids who have taken a drug over a period of time (treatment period). Some days they don't take any dosage during the treatment period. There are few adverse events ( side effects due to or not due to the drug) that occurred in these subjects. I want the following line connections :

 

A line connecting across the treatment days where the subject received the drug.

No line connection if there is no drug given to that subject during the period of treatment days. If the subject didn't receive the drug.

If there is an adverse event I want to show them as a marker on the line connected.(both start and end of the adverse events)

I have tried different ways. I have created a column that would be changed as the dosing changes across the subjects. similarly, I have tried to have a column which will have a unique value for each set of start and end of adverse events.

If I use treatment start days as the X-axis variable I will get the line connecting the dosage days and a gap when no dosage for a given subject.

If I use the transposed column obtained after transposing start and end days of an adverse event I get a line connecting the start and end of those adverse events. But, i am not getting both, the line connection as per dosage and the markers of AE (both start and end respectively) on the dosage line connection.

 

 

I am getting either the line connection for the dosage during treatment days or the start and end of adverse events but not both. But, I want both on the plot. Can anyone please help Thank you

If you see in the below image (plot) I have attached, it is colored by dose. The line connection color is also as per dose. But you see that only start (shape without a fill) and end (a shape with a fill) are connected. I also want a line connection that starts from day 1(starting day of dosage) to the end of the dosage whose line color should change as per the dosage. Please note that I have used the transposed column (col1 is the resultant after transposing start and end day of adverse events)as the variable on X-axis

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...