Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 862205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T09:06:13+00:00 2026-05-15T09:06:13+00:00

Many hours of manic googling and leafing through ggplot2 documentation having brought me no

  • 0

Many hours of manic googling and leafing through ggplot2 documentation having brought me no closer, I was hoping someone could maybe nudge me in the right direction.

I have cell count data for a few thousand subjects in a data.frame with the following layout:

  • 1 subject per row.
  • 1 column per cell type (5 total, each holding the percentage value for that cell type, summing to 100%).
  • 2 extra columns, one to indicate what Group (experimental or control) the subjects belong to, 1 to indicate what experiment they belong to (1, 2, 3, 4, etc.)

I would like to generate a ggplot2 jitter plot, percentage along the Y-axis, cell type categories along the X-axis (5 total) and further color the data points based on their Group (experimental or control). It would be great if I could further color the data points from different experiments in shades of the Group color (i.e. Experiment number sort of defining a gradient from light to dark – all Experiment-1 points would be light – either red or blue based on which Group they belonged to), but I don’t know if that’s even possible.

For starters: is my data even layed out properly to attempt to create this plot? The reason I ask is I reall yfeel like I’m fighting ggplot2 in attempting to get anything plotted with the data.frame in its current layout (but the native boxplot() seems to work fine with very little modifications…)

Any help or nudges in the right direction would be greatly appreciated.


EDIT:

This is the output of dput(head(dat, 10)).

structure(list(Neutrophils = c(38, 70.7, 62.1, 90.5, 65.8, 39.2, 
89.4, 91.3, 55.4, 14.5), Lymphocytes = c(47.5, 17.1, 20.3, 2, 
25, 37.1, 6.3, 1.6, 31.3, 61.5), Monocytes = c(12.4, 11.8, 14.6, 
4.8, 7.3, 14.1, 3.7, 4.6, 8.4, 21.9), Eosinophils = c(1.4, 0.1, 
2.5, 2.4, 1.4, 9.2, 0.1, 2.5, 4.6, 1.3), Basophils = c(0.8, 0.3, 
0.5, 0.3, 0.5, 0.4, 0.5, 0, 0.3, 0.8), Group = c(1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L)), .Names = c("Neutrophils", "Lymphocytes", 
"Monocytes", "Eosinophils", "Basophils", "Group"), row.names = c("B145", 
"B196", "B212", "B246", "B250", "B286", "B343", "B355", "B369", 
"B386"), class = "data.frame")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T09:06:14+00:00Added an answer on May 15, 2026 at 9:06 am

    You first need to reshape your data using the melt function in the reshape package.

    I’m sure someone will come along with a more elegant way to color points on a gradient but you can do that manually by creating a new column with the colors matched to group and/or experiment.
    Then map that color aesthetic to that column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After many hours of googling I thought I would see if anyone knew the
Recently my team has spent too many hours setting up machines with previous product
Given that every software project only has so many programmer-hours dedicated to it, how
After spending many hours poking around trying to get an ASP .NET AJAX proxy
I've spent so many hours on this I can feel my sanity slowly slipping.
I have spent many hours working on this program that is supposed to play
going crazy now after so many hours at the screen... got this site -
Very basic, and very annoying, I have searched solution for many hours with no
Many times I have seen Visual Studio solutions which have multiple projects that share
Many times we find ourselves working on a problem, only to figure out the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.