[R] violin plot help
Ismail SEZEN
sezenismail at gmail.com
Thu May 18 15:40:35 CEST 2017
> On 16 May 2017, at 17:06, Abdelrahman, Omar (RER) <Omar.Abdelrahman at miamidade.gov> wrote:
>
> I am trying to produce multiple violin plots by 3 categorical variables, each violin representing 1 year worth of data. The variables are:
>
> Watershed (7 levels: county canals)
>
> Geography (5 levels: west; central; east; mouth; bay)
>
> Parameter (8 levels: water quality chemical parameters)
>
> Year (25 levels: 1992-2017)
>
> I want to produce 1 plot for each Parameter-Watershed subdivided into Geography with a violin for each year. I used facets with the following code (not by year):
Hello Omer,
If you want violin plots for different categories, I would suggest lattice solution. For start;
https://www.r-bloggers.com/violin-and-boxplots-with-lattice-and-r/
Search terms: lattice, bwplot, panel.violin will help you find more examples.
>
> ggplot () +
>
> facet_grid (PARAMETER ~Wshed, scales="free_y") +
>
> geom_violin (data=merged, aes(x=Geo, y=RESULT))
>
>
>
> I do not want facets, they crowd the information so it is unreadable. I just started with R this week and have not been able to figure out the foreach protocol, or any other loop protocol. I tried to subset the data to do it iteratively with the following code:
>
>
>
> subdf<-subset (merged, Wshed = "AC")
>
>
>
> but got an error: Error: unexpected input in "subdf=subset (merged, Wshed == ""
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Omar Abdelrahman, Biologist II
> Miami-Dade County, Department of Regulatory and Economic Resources
> Division of Environmental Resources Management (DERM)
> Overtown Transit Village
> 701 NW 1st Court, 5th Floor
> Miami, FL 33136-3912
> (305) 372-6872
> abdelo at miamidade.gov<mailto:abdelo at miamidade.gov>
> www.miamidade.gov/environment<http://www.miamidade.gov/environment/>
>
More information about the R-help
mailing list