Comments (3)
It can be solved by new_df <- df |> arrange(desc(cost)) |> mutate(x=fct_reorder(x,desc(y)).
I love ggQC package and use it recently. I found the same issue and the most convinent way is just prepare the input data frame by arrange + fct_reorder.
Below is the full cost to demo purpose:
`library(ggQC)
library(ggplot2)
library(forcats)
library(tidyverse)
set.seed(0)
df <- data.frame(
x = c('a', 'd', 'c', 'H1', 'Y1',
'B', 'AAA', 'Xy', '2A', '12'),
y = as.integer(runif(
n = 10, min = 0, max = 100
))
)
print(str(df |> arrange(desc(y))))
when x= Xy',y = 94, which is biggest.
Bug code from the Render Pareto Plot from ggQC onine help -------------
which put H1 in the 1st place incorrectly.
ggplot(df, aes(x = x, y = y)) +
stat_pareto(
point.color = "red",
point.size = 3,
line.color = "black",
#size.line = 1,
bars.fill = c("blue", "orange")
)
Fixed cost from Render Pareto Plot from ggQC onine help ---------------
arrange y value by desc, and mutate the x by fct_recorder
which put Xy in the 1st place incorrectly.
new_df <- df |>
arrange(desc(y)) |>
mutate(x = fct_reorder(x, desc(y)))
ggplot(new_df, aes(x = x, y = y)) +
stat_pareto(
point.color = "red",
point.size = 3,
line.color = "black",
#size.line = 1,
bars.fill = c("blue", "orange")
)
`
from ggqc.
It works! thank you so much for that !
library(tidyverse)
library(ggQC)
df <- tibble(type_nc = c("scratch","spots","folds","holes","rips"),
qty = c(201,78,47,31,15),
cost = c(4287,2423,1119,8947,1864))
df %>%
arrange(desc(cost)) %>%
mutate(type_nc = fct_reorder(type_nc, desc(cost))) %>%
ggplot(aes(x = type_nc,
y = cost))+
stat_pareto(point.color = "darkgray",
point.size = 2,
line.color = "darkgray",
bars.fill = c("gray","lightblue"))
from ggqc.
glad to know that. I slove it because I faced the issue as well last week.
from ggqc.
Related Issues (18)
- qtukey error D5
- violation_point.color HOT 3
- stat_pareto mislabels the x axis unless x data are alphabetized HOT 2
- secondary axis
- Unequal subgroup sizes
- Unequal Values QC_Lines vs Stat_QC
- stat_QC issue warning `fun.y` deprecated
- P Charts do not carry limits through
- Regarding Levey-Jennings-Chart?
- Message "fun.y deprecated" Still Appears When Using "fun" Argument Instead of "fun.y"
- Residual Points Persist in X-bar Chart
- "lineWidth" Argument in stat_summary() Not Recognized
- Multiple lines HOT 1
- Scaling of the control limits
- The `fun.y` argument of `stat_summary()` is deprecated as of ggplot2 3.3.0
- The Cpk value seems not correct for the one-sided specification when using the function of CapabilityAnaylsis HOT 1
- replacement has 10 rows, data has 20
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ggqc.