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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:10:17+00:00 2026-06-01T20:10:17+00:00

I have been using the pareto.chart function from the qcc package in R and

  • 0

I have been using the pareto.chart function from the qcc package in R and I really like it. Now I would like to port all my graphics to utilize the ggplot2 package instead. However, my knowledge of ggplot2 is very limited despite the excellent documentation so I cannot figure out all the details. Basically I want a plot looking like this

A simple pareto chart made by the pareto.chart function in the qcc package

but made with the ggplot2 package instead. The code for producing the plot is listed below:

    library(qcc)
    defect <- c(80, 27, 66, 94, 33)
    names(defect) <- c("price code", "schedule date", "supplier code", "contact num.", "part num.")
    pareto.chart(defect, ylab = "Error frequency", col=heat.colors(length(defect)))

Does anyone have a solution for this? The pareto chart has been discussed before here but the result does not look anything similar to what I want.

  • 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-01T20:10:17+00:00Added an answer on June 1, 2026 at 8:10 pm

    Here you go:

    library(ggplot2)
    
    counts  <- c(80, 27, 66, 94, 33)
    defects <- c("price code", "schedule date", "supplier code", "contact num.", "part num.")
    
    dat <- data.frame(
      count = counts,
      defect = defects,
      stringsAsFactors=FALSE
    )
    
    dat <- dat[order(dat$count, decreasing=TRUE), ]
    dat$defect <- factor(dat$defect, levels=dat$defect)
    dat$cum <- cumsum(dat$count)
    dat
    
    ggplot(dat, aes(x=defect)) +
      geom_bar(aes(y=count), fill="blue", stat="identity") +
      geom_point(aes(y=cum)) +
      geom_path(aes(y=cum, group=1))
    

    enter image description here

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

Sidebar

Related Questions

I have been using these files all day... And then suddenly this is now
I have been struggling with how to make a Pareto Chart in R using
I have been using Haskell's STM library and I really like the ability to
I have been using C# for a while now, and going back to C++
I have been using Ruby for a while now and I find, for bigger
I have been using IoC for a little while now and I am curious
I have been using the CSLA framework for couple of years now for windows
I have been using WPF with all the tunneling and bubbling events and I
I have been using json.NET successfully in projects for some time now without any
I have been using the Scanner object to take in input until now and

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.