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 8093763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:34:24+00:00 2026-06-05T20:34:24+00:00

This should be a pretty straightforward question. I have the following code, which forms

  • 0

This should be a pretty straightforward question. I have the following code, which forms the plot I want:

library(reshape)
library(ggplot2)
require(ggplot2)
split1_data<-structure(list(Loci = structure(1:8, .Label = c("Baez", "Blue", 
"C147", "C204", "C21", "C278_PT", "C294", "C316"), class = "factor"), 
    All = c(0.3357, 0.4166, 0.0242, 0.9708, 0.4518, 0.0666, 0, 
    0.5925), X1_only = c(0.4758, 0.3188, 0.1465, 0.3209, 1, 0.0278, 
    0.2065, 0.6187), X78_only = c(0.3379, 0.4102, 0.2134, 0.6807, 
    0.8242, 1, 0.0046, 0.279), X8_removed = c(0.0967, 0.5831, 
    0.058, 0.9268, 0.3518, 0.0629, 0, 0.6229), X8_only = c(0.1169, 
    0.8327, 0.2169, 0.0907, 1, 1, 0.07, 0.486), X7_removed = c(0.2989, 
    0.7268, 0.0087, 0.8874, 0.5853, 0.0568, 0, 0.7622), X7_only = c(1, 
    0.5714, 0.2825, 0.8673, 0.5557, 0.6861, 0.0044, 0.1146), 
    X5_removed = c(1, 0.1453, 0.0176, 0.8428, 0.2277, 0.2563, 
    0, 0.5326), X5_only = c(0.0642, 0.631, 0.5193, 0.979, 0.5348, 
    0.1304, 0.02, 0.0217), X4_removed = c(0.4492, 0.3821, 0.0121, 
    0.9957, 0.5158, 0.0498, 0, 0.718), X4_only = c(0.6485, 0.0709, 
    0.1639, 0.6908, 1, 1, 0.4469, 0.639), X3_removed = c(0.3009, 
    0.3414, 0.02, 0.9935, 0.4216, 0.1273, 0, 0.6406), X3_only = c(1, 
    0.9325, 0.772, 0.5505, 1, 0.2068, 0.0829, 0.17), X2_removed = c(0.6335, 
    0.349, 0.2095, 0.9777, 0.8928, 0.0571, 0, 0.4285), X2_only = c(0.191, 
    0.4397, 0.0403, 0.3606, 0.0089, 1, 0.0033, 0.659), X1_removed = c(0.1653, 
    0.7658, 0.0718, 0.7705, 0.4193, 0.1894, 0, 0.5167)), .Names = c("Loci", 
"All", "X1_only", "X78_only", "X8_removed", "X8_only", "X7_removed", 
"X7_only", "X5_removed", "X5_only", "X4_removed", "X4_only", 
"X3_removed", "X3_only", "X2_removed", "X2_only", "X1_removed"
), row.names = c(NA, 8L), class = "data.frame")

split1_datam<-melt(split1_data,id="Loci")

p1<- ggplot(split1_datam, aes(x =Loci, y = value, color = variable, width=.15)) +  
         scale_fill_grey() + 
         geom_bar(position="dodge")+ 
         geom_hline(yintercept=0.05)+ 
         opts(axis.text.x  = theme_text(angle=90, size=8)) +
         scale_y_discrete(breaks=seq(0,1)) + 
         ylab(NULL)
p1

However, I was hoping to make the plot greyscale, but can’t seem to figure out how to accomplish this (note: the scale_fit_grey() depicted above is not working for me). Any suggestions? Thanks so much!

  • 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-06-05T20:34:26+00:00Added an answer on June 5, 2026 at 8:34 pm

    One thing that commonly trips people up at the start with ggplot2 is the difference between color and fill. For 2D objects like bars, rectangles, basically any filled area, color affects the border color and fill affects the interior color.

    In your plot, you map color = variable, but there is no mapping for fill in aes. I wonder if you meant fill = variable inside aes() and then to use scale_fill_grey.

    Otherwise, you’d use color = variable and scale_color_grey, but that would only “color” the borders of the bars, not the filled areas.

    For instance, with fill = variable and scale_fill_grey() I get something like this:

    enter image description here

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

Sidebar

Related Questions

This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]
This should be a pretty straightforward classes and interfaces question, but please bear with
This should have been pretty straightforward using the DOM but I seem to be
This should be pretty simple, but I can't seem to get it. I have
This should be pretty simple, but I am new at LINQ. I have a
Not sure what the correct title for this question should be. I have the
This is a pretty straightforward architectural question, however it's been niggling at me for
This should be a pretty straightforward issue -- I'm trying to compile Lua (or
This should be pretty straightforward, but I can't seem to find an explanation anywhere
I've got a pretty straightforward jQuery AJAX piece of code that should submit 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.