0

So I just installed a package in R called trelliscope. It's awesome but I am having trouble with some formatting. It is fairly new and there is not too much documentation about it and wanted to hear some input. So I produced the following code (if you follow the code exactly you will be able to reproduce what I did). The default point color/format on the plots are not to my liking:

install.packages("devtools") # if not installed
devtools::install_github("tesseradata/datadr")
devtools::install_github("tesseradata/trelliscope")
devtools::install_github("hafen/housingData")   
library(housingData)
library(datadr)
library(trelliscope)    

conn <- vdbConn("vdb", name = "Zillow") 
byCounty <- divide(housing,
               by = c("county", "state"))
byCounty

# look at a subset of byCounty
byCounty[[1]]

timePanel <- function(x)
  xyplot(medListPriceSqft + medSoldPriceSqft ~ time,
     data = x, auto.key = TRUE, ylab = "Price / Sq. Ft.")
timePanel

priceCog <- function(x) {
  zillowString <- gsub(" ", "-", do.call(paste, getSplitVars(x)))
  list(
    slope = cog(coef(lm(medListPriceSqft ~ time, data = x))[2],
            desc = "list price slope"),
    meanList = cogMean(x$medListPriceSqft),
    meanSold = cogMean(x$medSoldPriceSqft),
    nObs = cog(length(which(!is.na(x$medListPriceSqft))),
           desc = "number of non-NA list prices"),
    zillowHref = cogHref(
      sprintf("http://www.zillow.com/homes/%s_rb/", zillowString),
      desc = "zillow link")
  )
}
priceCog(byCounty[[1]]$value)

# create the display and add to vdb
makeDisplay(byCounty,
            name = "list_sold_vs_time_quickstart",
            desc = "List and sold price over time",
            panelFn = timePanel,
            cogFn = priceCog,
            width = 400, height = 400,
            lims = list(x = "same"))
view()

After running this code, can someone help me determine how to change the setting of the plot such as color of points, point size, etc. just to make it look better? I am really just looking for a coding structure to change the formatting and then I can go into specifics on my own if I can get a good starting point in the code.

Thanks!

bitoiu
  • 6,893
  • 5
  • 38
  • 60
Nick
  • 833
  • 2
  • 8
  • 11
  • Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example. – bitoiu Jul 31 '15 at 22:26
  • It's not debugging, I just want to add another feature to my plot essentially. I just don't know how the language of the package works because there isn't much documentation on it. @bitoiu – Nick Aug 01 '15 at 15:53

1 Answers1

1

You can add arguments for point size and color in the timePanel function. For example, try:

timePanel <- function(x)
  xyplot(medListPriceSqft + medSoldPriceSqft ~ time,
     data = x, auto.key = TRUE, ylab = "Price / Sq. Ft.",
     par.settings = list(superpose.symbol = list(
         cex = c(1,2), col =c("black", "red"))))
timePanel
lever
  • 664
  • 1
  • 5
  • 10