Seeking help onlineAllison SussmanOctober 16, 2015Description: Sometimes (more often than not) no matter what you do, you cannot figure out what is going wrong in your code. So the solution is to reach out to others for help, typically via email or in an online forum. Showing your code is only half the information you need to post. Using sessionInfo() will spit out all the relevant information about your version of R, your operating system, and the packages you have installed. This information goes a long way for the folks willing to help you.
It’s pretty simply and will really save you and the people helping you a little bit of time and trouble.
0 Comments
Simulate spatial data and fit multiple theoretical models to the sample variogram.Description: This code snippet simulates a toy spatial dataset, permutes the dataset, sets geographic coordinates for the data, and applies a function that automatically fits multiple theoretical models to the sample variogram.
Taking control of ggplot legends and colors for multiple seriesEmily Dolson10/07/2015ggplot is pretty good at figuring out what to put in your legend if the different classes that you’re plotting are spelled out in your data frame. For instance, the R built-in dataset
It’s usually a good idea to set your dataframes up this way, anyway, because it allows for you to operate on them flexibly. Sometimes, though, you just want to make a plot of two completely different series without smushing them together. For this example we will use the built-in
By default, the legend is given the same label as the first color. This isn’t usually what you want. You can set it with any of the
Sometimes, you might want to choose the values associated with each label. This can be accomplished with
Sometimes you don’t actually want to put all of the colors that you used on your legend. A common example of this is if you want to make open-circle markers for one of your data-sets. You can accomplish this by overlaying smaller circles of the background color onto larger circles of the desired outline color. If you want to do that to all circles of a given set, you can set the color outside of
But what if you want to make some circles open based on some attribute of a given data point? Everything that will vary by point needs to go in
You probably don’t want that. You can get rid of it by listing only the colors you want in the legend in the
|
Spatial Ecology @ MSUClick on "Category" below to search for R code compiled by the Zarnetske Spatial & Community Ecology Lab and students in MSU's Spatial Ecology graduate course (FOR870/FW870) Category
All
Archive
October 2016
|