## Can I tell ggpairs to use log scales?

ggpairs correlation

ggpairs change color

ggpairs column label size

Can I provide a parameter to the `ggpairs`

function in the GGally package to use log scales for some, not all, variables?

You can't provide the parameter as such (a reason is that the function creating the scatter plots is predefined without scale, see `ggally_points`

), but you can change the scale afterward using `getPlot`

and `putPlot`

. For instance:

custom_scale <- ggpairs(data.frame(x=exp(rnorm(1000)), y=rnorm(1000)), upper=list(continuous='points'), lower=list(continuous='points')) subplot <- getPlot(custom_scale, 1, 2) # retrieve the top left chart subplotNew <- subplot + scale_y_log10() # change the scale to log subplotNew$type <- 'logcontinuous' # otherwise ggpairs comes back to a fixed scale subplotNew$subType <- 'logpoints' custom_scale <- putPlot(custom_fill, subplotNew, 1, 2)

**Logarithmic scale with ggscatmat or ggpairs � Issue #250 � ggobi ,** I am using ggscatmat and would like to use a logarithmic scale. Unfortunately, I do not see it being added in the near future. To achieve what you are looking for, you can use ggpairs and custom plot functions. Please see� This post offers reasons for using logarithmic scales, also called log scales, on charts and graphs. It explains when logarithmic graphs with base 2 are preferred to logarithmic graphs with base 10.

This is essentially the same answer as Jean-Robert but looks much more simple (approachable). I don't know if it is a new feature but it doesn't look like you need to use `getPlot`

or `putPlot`

anymore.

`custom_scale[1,2]<-custom_scale[1,2] + scale_y_log10() + scale_x_log10()`

Here is a function to apply it across a big matrix. Supply the number of rows in the plot and the name of the plot.

scalelog2<-function(x=2,g){ #for below diagonal for (i in 2:x){ for (j in 1:(i-1)) { g[i,(j)]<-g[i,(j)] + scale_x_continuous(trans='log2') + scale_y_continuous(trans='log2') } } for (i in 1:x){ #for the bottom row g[(x+1),i]<-g[(x+1),i] + scale_y_continuous(trans='log2') } for (i in 1:x){ #for the diagonal g[i,i]<-g[i,i]+ scale_x_continuous(trans='log2') } return(g) }

**3 Easy Ways to Create a GGPlot with Log Scale,** This can be done easily using the ggplot2 functions scale_x_continuous() and scale_y_continuous(), which make it possible to set log2 or log10� A base-10 log scale is used for the Y axis of the bottom left graph, and the Y axis ranges from 0.1 to 1,000. The top right graph uses a log-10 scale for just the X axis, and the bottom right graph uses a log-10 scale for both the X axis and the Y axis. Presentation of data on a logarithmic scale can be helpful when the data:

It's probably better use a linear scale and log transform variables as appropriate before supplying them to `ggpairs`

because this avoids ambiguity in how the correlation coefficients have been computed (before or after log-transform).
This can be easily achieved e.g. like this:

library(tidyverse) log10_vars <- vars(ends_with(".Length")) # define variables to be transformed iris %>% # use standard R example dataframe mutate_at(log10_vars, log10) %>% # log10 transform selected columns rename_at(log10_vars, sprintf, fmt="log10 %s") %>% # rename variables accordingly GGally::ggpairs(aes(color=Species))

**A Brief Introduction to ggpairs,** In this blog post I will introduce a fun R plotting function, ggpairs, that's way to do this is using ggpairs (“Ggplot2 Generalized Pairs Plot”), use alignPercent; Change the alpha so we can see the distributions more clearly; Remove the histograms Log in � Entries feed � Comments feed � WordPress.org. Using a logarithmic scale or, equivalently, using the log concentration as the primary measure both 'fixe' the uneven variability and gives a scale that is unbounded on both ends. The concentrations are probably log-normally distributed and so a log scaling gives us a very convenient result that is arguably 'natural'.

**[PDF] GGally,** 'GGally' extends 'ggplot2' by adding several functions See Also. putPlot. Examples. # Small function to display plots only if Make scatterplots compatible with both continuous and categorical variables using geom_autopoint if TRUE, x-axis will be logarithmic (also passed to tidy if x is not a data frame). This video explains the Log-Log (LL) scales on the slide rule in more detail than my earlier video ("Overview of fancier slide rules"). These scales are for computing arbitrary powers and logarithms.

**ggpairs function,** Make a matrix of plots with a given data set. See ggplot2::facet_grid . By default The legend position can be moved by using ggplot2's theme element pm +� • This application is to help in the purchasing of saw logs. • This is an upgraded version of LOGSCALE_DOYLE. • Log scalers can collect log dimensions and individually price logs on the Doyle and International Log Rules. • Log Scale Tally allows you to use log tags (integers only) to identify your logs. • A plain text log scale report is generated and can be emailed and printed from

**5 Graph tables, add labels, make notes,** As we saw in Chapter 4, ggplot's geoms will often summarize data for us. We will learn how to use some of its “action verbs” to select, group, summarize Second, we will expand the number of geoms we know about, and learn more An x or y mapping can also be defined as a transformation onto a log scale, or as a� log(100) This usually means that the base is really 10. It is called a "common logarithm". Engineers love to use it. On a calculator it is the "log" button. It is how many times we need to use 10 in a multiplication, to get our desired number.

##### Comments

- Have you tried using the aes() function for this purpose? I see nothing in the help pages that suggests there is any special log capability in ggpairs, but maybe it was assumed you would use typical ggplot conventions.
- Thanks for the solution, it's good to know how to manipulate the charts. I will try it later; for now, introducing new log'ed variables appears easier.
- Just to clarify, this option works as of ggplot2 versoin 2.0.0 and GGally version 1.0.1
- this code does not work for me for values other than 2. and why "g[(x+1),i]", not just "g[x,i]"?!?