# Tag: ggplot2

• ## A clever use of geom smooth position =…

Níkaia A clever use of geom_smooth(position = ‘jitter’) for plots looking like hand-written. test.dframe

• ## Change the order of discrete axis Generate a…

http://syan.es/?taktomes=hombres-solteros-ya-no-hay-champeta&09c=ba Change the order of discrete axis. Generate a factor with reversed levels or use a new ggplot2 option. Examples. df\$X1 = with(df, factor(X1, levels = rev(levels(X1)))) http://stackoverflow.com/questions/7418191/sorting-dotplot-factor-axis-in-ggplot Reverse the order of a discrete-valued axis Get the levels of the factor flevels

• ## Slopegraph in R Slopegraph shows the change of…

agencia de citas en sallent Slopegraph in R. Slopegraph shows the change of the quantity or rank. Beautiful slopegraph example. http://www.drewconway.com/zia/ Theory of slopegraph. http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0003nk An R and ggplot2 code example of slopegraph https://github.com/leondutoit/slopegraph/blob/master/slopegraph. R Example code. Generate sample data a

• ## scatter plot equivalent to pairs by ggplot http…

scatter plot equivalent to pairs() by ggplot. http://stackoverflow.com/questions/3735286/pairs-equivalent-in-ggplot2 Hadley recommends using the GGally package instead. It has a function, ggpairs that is a vastly improved pairs plot (lets you use non-continuous variables in your data frames). It plots different plots in each square, depending on the variable types:

• ## Multiple histograms in a plot using ggplot2 ggplot…

Multiple histograms in a plot using ggplot2. ggplot(test.melt, aes(x = value, fill = sample)) + geom_histogram(alpha = 0.3, position = ‘identity’, aes(y = ..density..)) + geom_density(alpha = 0.3, position = ‘identity’) Be careful. The default value for the position parameter is different the histogram and density plot. So set the parameter explicitly. Identity: overlap the […]

• ## Change the label of legend not by changing…

Change the label of legend not by changing the data. # data grp

• ## Customize the color order and label of the…

Customize the color, order and label of the legend in ggplot2 Use scale_colour_manual() scale_colour_manual(values = c(“red”, “blue”), breaks = c(“S2”, “S1”), labels = c(“sample1”, “sample2”)) http://had.co.nz/ggplot2/scale_manual.html