I have five columns with numbers. I want to plot the frequency distribution of five columns in one graph with different colors in R. Can some one help me out how i can do this with an example. I am very new to R.
相关问题
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
- split data frame into two by column value [duplica
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
Using the sample data from @eddi, you can also consider the "lattice" package:
This will yield:
If you have many columns, you can also create your plot by first creating a
formula
:You should also explore the various options available for
densityplot
, such asplot.points
(which can be set toFALSE
if you don't want the points at the bottom of the density plots) andauto.key
to add a legend.Another obvious option is to use "ggplot2", but for this, you need to first convert your data into a "long" format:
The result:
Here's a base R solution: