Comments (10)
Also, it would be great to allow people to manipulate the plot the way they choose. So add a ...
argument to the outer function and pass it on to ggplot
.
from rgbif.
Pointtype and jitter fixed.
The problem I'm having with passing options into the function is that I don't want the options passed in to override all of the options we specify within the function. For example, in our block of code for plotting:
ggplot(world, aes(long, lat)) + # make the plot
geom_polygon(aes(group=group), fill="white", color="gray40", size=0.2) +
geom(data=tomap, aes(decimalLongitude, decimalLatitude, colour=taxonName),
alpha=0.4, size=3, position=jitter) +
labs(x="", y="") +
theme_bw(base_size=14)
where would we allow users to pass in different options? We could let people do something like specify a set of ggplot options in a function, then pass it in to gbifmap
mycustom <- function(){
list(geom_point(size=9),
etc....)
}
out <- occurrencelist(scientificname = 'Accipiter erythronemius', coordinatestatus = TRUE, maxresults = 100)
gbifmap( out, customize = mycustom() )
And then modify our above plotting block to add whatever options the user wants
ggplot(world, aes(long, lat)) + # make the plot
geom_polygon(aes(group=group), fill="white", color="gray40", size=0.2) +
geom(data=tomap, aes(decimalLongitude, decimalLatitude, colour=taxonName),
alpha=0.4, size=3, position=jitter) +
labs(x="", y="") +
theme_bw(base_size=14) +
customize
But then the user options override the previous options in the ggplot code block
from rgbif.
I just realized that this is a non-issue. Once a ggplot2
object is returned, anyone can override your settings or add more. For example, I could do a + geom_point(size = 14)
and it will override the one inside. So we can just tell users that they can customize however they like after the fact (no need to pass arguments via the function call).
from rgbif.
not sure that's true. If you do geom_point(size = 14)
then the geom(data=tomap, aes(decimalLongitude, decimalLatitude, colour=taxonName), alpha=0.4, size=3, position=jitter)
code is ignored, and screws up the plot.
from rgbif.
Hmm. See this question for reference: http://stackoverflow.com/questions/13831717/how-does-one-pass-additional-parameters-to-a-ggplot-generated-inside-a-function/13832162#13832162
Perhaps we should work on this some more to make the theme part general but not break core functionality.
On Wednesday, December 12, 2012 at 11:47 AM, Scott Chamberlain wrote:
not sure that's true. If you do geom_point(size = 14) then the geom(data=tomap, aes(decimalLongitude, decimalLatitude, colour=taxonName), alpha=0.4, size=3, position=jitter) code is ignored, and screws up the plot.
—
Reply to this email directly or view it on GitHub (#11 (comment)).
from rgbif.
Another bug, the legend should show up even if there is only one species. Don't you agree? If so I can code that fix.
from rgbif.
I tend to not think so, but perhaps it makes sense for greater consistency in map output
from rgbif.
scratch that. You are right. plots with only one type don't need legends.
On Wednesday, December 12, 2012 at 2:18 PM, Scott Chamberlain wrote:
I tend to not think so, but perhaps it makes sense for greater consistency in map output
—
Reply to this email directly or view it on GitHub (#11 (comment)).
from rgbif.
okay, cool
from rgbif.
think this is done
from rgbif.
Related Issues (20)
- Lower and/or upper case during name_backbone HOT 2
- problem with pred_within() - results outside polygon in the download HOT 6
- Download of wrong species list HOT 16
- check_inputs function in zzz.R seems to mangle valid inputs HOT 1
- Why occ_download return a CSV file contains only one column and different rows? HOT 5
- support occ_download eraseAfter HOT 1
- Add support for extension downloads
- support gbifid downloads
- fix tests associated with new GBIF polygon interpretation
- GitHub actions likely rtools build error HOT 1
- consider deprecating some out of date gbif_citation functions
- Deprecate the "axe" feature in occ_data
- Give user friendly warning about full downloads using occ_download()
- Add support for describe download formats
- add guidance for reversing WKT winding order HOT 1
- add constituentKey to name_lookup
- update occ_data documentation
- Add entry to taxonomic_names vignettes to obtain a more concise list of similar taxa HOT 1
- CRAN check fix HOT 1
- occ_download not returning all possible variables HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rgbif.