Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create templates (or similar) for gsplot plotting defaults #5

Closed
jordansread opened this issue Jun 24, 2015 · 15 comments
Closed

create templates (or similar) for gsplot plotting defaults #5

jordansread opened this issue Jun 24, 2015 · 15 comments
Assignees
Milestone

Comments

@jordansread
Copy link
Member

Things like default tick lengths, colors, line weights, font sizes, font types, legend placement, etc.

yaml within the package?

See ggplot2 themes for inspiration http://docs.ggplot2.org/current/theme.html

@ldecicco-USGS
Copy link
Member

Look at ggplot2 themes:

Example:
https://github.com/jrnold/ggthemes/blob/master/R/economist.R#L194

We might want to (way down the road) create a function to read a ggplot2 theme, and convert it to gsplot config.

@ldecicco-USGS ldecicco-USGS self-assigned this Jun 24, 2015
@lindsayplatt
Copy link

@ldecicco-USGS is this referring to the guidelines set by the USGS plotting guidelines you sent me earlier this week?

@jordansread
Copy link
Member Author

@ldecicco-USGS is this supposed to be a yaml?

@ldecicco-USGS
Copy link
Member

yeah, this is an old Issue, but once @jiwalker-usgs makes the yaml, let's start populating it with things that make sense....ie stuff in the plotting guidelines. If the yaml isn't ready (or won't be soon), the same parameters can be added to the graphTemplate in config.R:

https://github.com/USGS-R/gsplot/blob/master/R/config.R#L19

@lindsayplatt
Copy link

Ok, makes sense. Could you send the guidelines again? It was in my shared folder, but now it's not

@jiwalker-usgs
Copy link
Contributor

I have the yaml working, but the way it deals with options is a problem right now. I'll try to wrap that up and make a PR.

@jordansread
Copy link
Member Author

thanks w

@lindsayplatt
Copy link

There are some defaults that are specified in the function call and in the default.yaml file. Do we want to be consistent with where default features are defined?

Example: callouts

@lindsayplatt
Copy link

Guidelines to add to yaml:

  • legend title should always default to "EXPLANATION"
    • change line 14 in the yaml file to code below
    • this does not work right now, but changing defaults in the legend.R file do
    legend:
        title: "EXPLANATION"
        location: "bottomleft"

Guidelines that should be added elsewhere:

  • commas for numbers > 999, produce this:
    x <- c(1000, 2000, 3000)
    y <- c(2000, 1000, 2000)
    labs <- prettyNum(x, big.mark=",", scientific=FALSE)
    gs <- gsplot() %>% 
          points(x, y) %>%
          axis(side=1, at=x, labels=labs)
    gs
  • font types (USGS fonts #39)
    • specify type, size, and style (bold, italicized)
    • Axes captions: Univers 57 Condensed, 8 or 9 pt
    • Axes labels: Univers 57 Condensed, 7 or 8 pt
    • Legend title: Univers 67 Condensed Bold, 8 or 9 pt, uppercase
    • Title: Univers 67 Condensed, 8 or 9 pt (Bold Oblique for letters, Bold for words following letter)
    • ps=12 specifies the pointsize, but only for the overall graph in par()
    • should be able to specify different pointsizes for title or axis labels
        x <- c(1000, 2000, 3000)
        y <- c(2000, 1000, 2000)
        gs <- gsplot(ps=10) %>% 
            points(x, y, legend.name="Some Points") %>%
            legend() %>%
            title(main="GRAPH")
        gs
  • grid graphs with the same parameters should have only one x- and y-axis label
  • numeric scale for axes must be able to extend to zero (e.g. 1,3,5.. would not work because it extends to -1)
  • arithmetic grids must be square (see bottom of page 18 of the plotting guide))
  • single-column, double-column, and sidetitle figures (save as specific size for reports in the print.R file?)

@ldecicco-USGS
Copy link
Member

My suggestion for the next sprint is to have someone re-create the (appropriate for gsplot) graphs in smwrGraphs using only the config.yaml file and the data. The relevant files are here:

https://github.com/USGS-R/smwrGraphs/blob/master/inst/doc/LineScatter.pdf
https://github.com/USGS-R/smwrGraphs/blob/master/inst/doc/GraphAdditions.pdf
https://github.com/USGS-R/smwrGraphs/blob/master/inst/doc/DateAxisFormats.pdf
https://github.com/USGS-R/smwrGraphs/blob/master/inst/doc/GraphGallery.pdf
maybe:
https://github.com/USGS-R/smwrGraphs/blob/master/inst/doc/ProbabilityPlots.pdf

For example, the first graph in the first link:

set.seed(2576)
X <- runif(33)
Y <- runif(33)
Z <- rep(c("A","B","C"),11)
X12 <- X[1:12]
Z12 <- LETTERS[1:12]

library(gsplot)

gsplot() %>%
  points(X, Y, col="darkblue")

So, just futzing with config.yaml, can we get:

2016-06-20_15-37-23

@ldecicco-USGS
Copy link
Member

  1. Write gsplot code to reproduce graph
  2. Edit config.yaml to see how close the style can get.

@lindsayplatt lindsayplatt added this to the Sprint 3 milestone Jun 22, 2016
@lindsayplatt lindsayplatt self-assigned this Jun 22, 2016
@lindsayplatt
Copy link

@wdwatkins maybe break this out into multiple issues (for each template type)

@wdwatkins
Copy link
Contributor

We need to be able to get every graph in each of the pdfs above?

@jordansread
Copy link
Member Author

I think the main point is just that it not be extremely painful to create those w/ gsplot

@lindsayplatt
Copy link

Separated into multiple issues: #361, #362, #363, and #364

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants