Break or kink // in x axis in ggplot2 [duplicate] - r

This question already has answers here:
Using ggplot2, can I insert a break in the axis?
(10 answers)
Put a break in the Y-Axis of a histogram
(2 answers)
Closed 2 years ago.
ggplot(data= data,aes=(x=parameter,y= Count,fill=value)) + geom_bar(position="dodge",stat="identity")+ cord_flip()
I want to get break in x-axis like initially, I want scales to be 1,2,3,4,5 then a break followed by 5,10,15. Please refer the below figure for break or kink I am talking about

Related

Expanding the X-axis using R [duplicate]

This question already has answers here:
How do I show all boxplot labels
(3 answers)
How to save a plot as image on the disk?
(11 answers)
Closed 2 years ago.
there has some issue with my axis, I want to show the full data at the axis but I am not sure how to expand it. This my code.
boxplot(Complied_Data$`Stress (N/m2)` ~ Complied_Data$Category,
main="Stress Distribution of different rates", ylab="Stress (Pa)",
xlab="Specimens", notch=TRUE, col="brown1", cex=10)

R remove names and order ggplot by frequency [duplicate]

This question already has answers here:
Order Bars in ggplot2 bar graph
(16 answers)
Remove all of x axis labels in ggplot [duplicate]
(1 answer)
Closed 2 years ago.
I have a dataframe DiatomFiltered containing the column species. I want to have a ggplot (ggplot2) of all species and their frequency ordered from highest to lowest. The below code works, but the names are a mess (because of way too many species names) so I want to remove that and i want the frequencies ordered. How do i do this?
ggplot(DiatomFiltered, aes(species)) +
geom_bar(fill = "#0073C2FF")

How to remove value from a plot on R [duplicate]

This question already has answers here:
Boxplot sees values that aren't there
(1 answer)
How to remove ticks and labels of dropped off factors in a box plot
(1 answer)
Closed 5 years ago.
You can see my plot in this link.
I want to remove the first three points from the x axis, so I only display data from "2.31-52k", "1.52-100k", "3.18-31k", "4.<18k", "0.>100k". And not -1.0,-3.1 etc.
I have managed to remove the data to produce this graph, by creating a subset in dAll$income and assigning it to a new data frame with the following code.
new_df = subset(dAll, subset = dAll$income %in% c("2.31-52k", "1.52-100k", "3.18-31k", "4.<18k", "0.>100k"))
However when I plot this, the values remain on the x axis.

R, ggplot2: reverse alphabetical order [duplicate]

This question already has answers here:
Order Bars in ggplot2 bar graph
(16 answers)
Closed 6 years ago.
I use ggplot2 to create a graph using
dat <- data.frame(xx=c("IND","AUS","USA"), yy=c(1,5,2))
ggplot(data=dat, aes(x=reorder(xx,xx), y=yy))
and this nicely sorts my x-axis alphabetically. However, I want to sort the string variable xx in reverse alphabetical order but cannot seem to get it. While reorder(yy,-yy) can sort my numeric variable, reorder(xx,-xx) does not work.
How about:
ggplot(data=dat, aes(x=forcats::fct_rev(reorder(xx,xx)), y=yy))

% in barplot() instead of count [duplicate]

This question already has answers here:
How can I change the Y-axis figures into percentages in a barplot?
(4 answers)
Closed 8 years ago.
I did a script to have a good barplot with barplot() on R
Is it possible to have on the y-axis the % and not the quantity (number of observations) ?
I would love to have the % without to change all of the script...
Thanks a lot
ggplot has this option, but for barplot() I believe you will have to make a new variable that represents the percent and then feed that into barplot()

Resources