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)
- Is it intended that occ_count() can not take multiple facet arguments like occ_search can? HOT 1
- Suggestion to output tsv with scientificName match for taxonkey query HOT 1
- isocodes spelling HOT 3
- Retrieve dataset information from DOI HOT 1
- Review and refresh static data files
- occ_search multiple facets returns too many facets
- Consider deprecating dataset_suggest() HOT 1
- add suport for lit_export()
- add missing occ_search terms
- Consider adding support for gadm search HOT 1
- Examples in the documentation are wrapped in ยดif(FALSE){}`, use `@examplesIf` instead
- eleveation Error: Unauthorized (HTTP 401) HOT 1
- Add support for speciesProfiles
- 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
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.