Browse Source

text size

master
Bob Rudis 10 years ago
parent
commit
0341e0be4a
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 4
      R/statebins.R
  2. 75
      _README.md
  3. BIN
      _README_files/figure-markdown_github/unnamed-chunk-31.png
  4. BIN
      _README_files/figure-markdown_github/unnamed-chunk-32.png

4
R/statebins.R

@ -42,7 +42,7 @@ statebins <- function(state_data, state_col="state", value_col="value",
gg <- ggplot(st.dat, aes(x=col, y=row, label=abbrev))
gg <- gg + geom_tile(aes(fill=fill_color))
gg <- gg + geom_tile(color=state_border_col, aes(fill=fill_color), size=3, show_guide=FALSE)
gg <- gg + geom_text(color=text_color)
gg <- gg + geom_text(color=text_color, size=2)
gg <- gg + scale_y_reverse()
gg <- gg + scale_fill_brewer(palette=brewer_pal, name=legend_title)
gg <- gg + coord_equal()
@ -112,7 +112,7 @@ statebins_continuous <- function(state_data, state_col="state", value_col="value
gg <- gg + geom_tile(aes_string(fill=value_col))
gg <- gg + geom_tile(color=state_border_col,
aes_string(fill=value_col), size=3, show_guide=FALSE)
gg <- gg + geom_text(color=text_color)
gg <- gg + geom_text(color=text_color, size=2)
gg <- gg + scale_y_reverse()
gg <- gg + continuous_scale("fill", "distiller",
gradient_n_pal(brewer_pal(type, brewer_pal)(6), NULL, "Lab"), na.value = "grey50", name=legend_title)

75
_README.md

@ -0,0 +1,75 @@
statesquares is ...
The following functions are implemented:
- `statebins` -
### News
- Version `1.0.0` released
### Installation
``` {.r}
devtools::install_github("hrbrmstr/statebins")
```
### Usage
``` {.r}
library(statebins)
```
## Loading required package: ggplot2
## Loading required package: grid
## Loading required package: scales
## Loading required package: gridExtra
``` {.r}
# current verison
packageVersion("statebins")
```
## [1] '1.0'
``` {.r}
dat <- read.csv("http://www.washingtonpost.com/wp-srv/special/business/states-most-threatened-by-trade/states.csv?cache=1", stringsAsFactors=FALSE)
gg <- statebins(dat, "state", "avgshare94_00", breaks=4,
labels=c("0-1", "1-2", "2-3", "3-4"),
legend_title="State Groups",
brewer_pal="Blues", text_color="black",
plot_title="1994-2000", title_position="bottom")
gg
```
![plot of chunk unnamed-chunk-3](./_README_files/figure-markdown_github/unnamed-chunk-31.png)
``` {.r}
gg2 <- statebins_continuous(dat, "state", "avgshare01_07",
legend_title="States", legend_position="none",
brewer_pal="OrRd", text_color="black",
plot_title="1994-2000", title_position="bottom")
gg2
```
![plot of chunk unnamed-chunk-3](./_README_files/figure-markdown_github/unnamed-chunk-32.png)
### Test Results
``` {.r}
library(statebins)
library(testthat)
date()
```
## [1] "Mon Aug 25 22:22:55 2014"
``` {.r}
test_dir("tests/")
```
## basic functionality :

BIN
_README_files/figure-markdown_github/unnamed-chunk-31.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
_README_files/figure-markdown_github/unnamed-chunk-32.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Loading…
Cancel
Save