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

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.

Related

plot 3 continuous variables against each other in one plot [duplicate]

This question already has answers here:
Plot each column against each column
(2 answers)
Plot all pairs of variables in R data frame based on column type [duplicate]
(1 answer)
Closed 17 days ago.
I have the output of 3 different algorithms as a continuous vector. Instead of comparing their correlation 1 by 1, I would like to plot them all simuntaionusly in the same plot, but in different panels. The dataframe looks like this (but contains >10k ids):
df <- data.frame(id=1:5,
feature1=runif(5),
feature2=runif(5,min = 3,max=5),
feature3=runif(5, min = 5,max=8))
Ideally, the resulting plot should looks something like this:
I am fairly sure that there is some simple tidyr function, which expands my dataframe in such a way that I can simply use ggplot2 in combination with facet_grid, but I searched and coudn't find anything..
Any help is much appreciated!

ggplot2 to create boxplots to all columns of a dataset [duplicate]

This question already has answers here:
creating a boxplot for two different column of data frame using ggplot [duplicate]
(2 answers)
Making a ggplot boxplot where each column is it's own boxplot
(2 answers)
Closed 13 days ago.
I have a dataset composed of 10 columns and I want to create a boxplot for each column using ggplot2. They idea is to see if there are outliers in any column
I know how to use to the package to create a boxplot for each column individually but I would like to know if it is possible to make it directly to all columns of the data set

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")

Manually order ggplot2 legend when overlaying multiple plots of multiple data.frames [duplicate]

This question already has answers here:
How to reorder a legend in ggplot2?
(2 answers)
Reorder levels of a factor without changing order of values
(9 answers)
Closed 5 years ago.
I am making CDF plots using this line of code:
library(ggplot2)
ExpDF <- data.frame(x=c('gene1','gene2','gene3','gene4'),"FC"=c(1,2,3,4))
ts_miR_15 <- data.frame(x=c('gene1','gene3','gene4'),"FC"=c(1,3,4))
ahc_miR_15_3UTR <- data.frame(x=c('gene1','gene4','gene12'),"FC"=c(1,4,12))
g <- ggplot(data = NULL)
g + geom_step(aes(x=ExpDF$FC, color="All_genes"),stat="ecdf") +
geom_step(aes(x= ts_miR_15$FC, color="Targetscan_miR-15/16"), stat="ecdf") +
geom_step(aes(x= ahc_miR_15_3UTR$FC, color="3UTR_miR-15/16_seed"), stat="ecdf") +
scale_colour_manual("Subsets", values = c("All_genes"='black',
"Targetscan_miR-15/16"='orange',
"3UTR_miR-15/16_seed"='red'))
...(etc. for each additional data.frame
I would like to be able to reorder the labels for the legend such that "All_genes" is on top (and preferably have it in any oder I want). I would prefer to keep the data.frames separate because they have different numbers of genes (which mark the rows) in them and some of them are subsets of the other.

Sorting data on X axis [duplicate]

This question already has answers here:
Reorder levels of a factor without changing order of values
(9 answers)
Closed 9 years ago.
I have created a plot of coverage vs gene. I would like to plot the genes (x axis) from lowest coverage value (y axis) to largest. I used the function "plot" but it automatically sorts the gene names from lowest to highest. How do I arrange them from lowest coverage to highest instead?
Maybe switch the ylim:
plot(1:10, ylim=c(10,1))

Resources