Created
August 16, 2016 22:08
-
-
Save cimentadaj/ad0c8de73fa452157ae1b8fe3c4e0994 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # We need to use the trans_new() function which is in the scales library. Remember to load that library. | |
| # We create a new function with the _trans suffix. Inside that function we use the trans_new | |
| # function to define the transformation name and the actual transformation. To see why I repeated the | |
| # the transformation check the documentation for trans_new. | |
| mult_trans = function() trans_new("mult", function(x) 1*x, function(x) 1*x) | |
| # If you're planning to use this code to build your own transformations remember to change | |
| # the name of the function(something_trans), the character string inside trans_new and the actual transformation. | |
| # Once that's done, simply call the function with the coord_trans function. | |
| ggplot(housing, aes(x=Land.Price.Index, y=Home.Price.Index)) + geom_point() + coord_trans(x="sqrt", y="mult") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment