Housing = read.csv("http://www.mosaic-web.org/go/datasets/Income-Housing.csv")
library(mosaicCalc)
## Loading required package: mosaic
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## The 'mosaic' package masks several functions from core packages in order to add 
## additional features.  The original behavior of these functions should not be affected by this.
## 
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following object is masked from 'package:ggplot2':
## 
##     stat
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
##     quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
## Loading required package: mosaicCore
## 
## Attaching package: 'mosaicCore'
## The following objects are masked from 'package:dplyr':
## 
##     count, tally
## 
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
## 
##     D
gf_point( 
  CrimeProblem ~ Income, data=Housing ) %>%
  slice_plot(
    40 - Income/2000 ~ Income, color = "red")

Housing$Income
## [1]  3914 10817 21097 34548 51941 72079
library(mosaicCalc)
m = -3
b = -2
slice_plot(m * x + b ~ x, domain(x = range(0, 10)))

library(mosaicCalc)
A = 100
slice_plot( A * x ^ 2 ~ x, domain(x = range(-2, 3))) 

A = 5
slice_plot( A * x ^ 2 ~ x,  domain(x = range(0, 3)),  color="red" )

slice_plot( cos(t) ~ t, domain(t = range(0,4*pi) ))

library(mosaicCalc)
s = read.csv(
  "http://www.mosaic-web.org/go/datasets/stan-data.csv")
gf_point(temp ~ time, data=s)

h = read.csv(
  "http://www.mosaic-web.org/go/datasets/hawaii.csv")
gf_point(water ~ time, data=h)

Utilities <- read.csv(
  "http://www.mosaic-web.org/go/datasets/utilities.csv")

gf_point( 
  temp ~ month, data=Utilities) %>% 
  gf_labs(x = "Month (Jan=1, Dec=12)",
          y = "Temperature (F)",
          main = "Ave. Monthly Temp.")

gf_point(
  gasbill ~ temp, data=Utilities) %>%
  gf_labs(xlab = "Temperature (F)",
          ylab = "Expenditures ($US)",
          main = "Natural Gas Use") %>%
  slice_plot( 300 - 5*temp ~ temp, color="blue")

gf_point(
  gasbill ~ temp, data=Utilities) %>%
  gf_labs(xlab = "Temperature (F)",
          ylab = "Expenditures ($US)",
          main = "Natural Gas Use") %>%
  slice_plot( 300 - 5*temp ~ temp, color="green")

slice_plot(
  95 - 73*exp(-.2*t) ~ t, 
  domain(t = 0:20) )

library(mosaicCalc)
contour_plot(
  sin(2*pi*t/10)*exp(-.2*x) ~ t & x, 
  domain(t = range(0,20), x = range(0,10)))

interactive_plot(
   sin(2*pi*t/10)*exp(-.5*x) ~ t & x, 
   domain(t = 0:20, x = 0:10))
library(mosaicCalc)
interactive_plot(
   sin(2*pi*t/10)*exp(-.5*x) ~ t & x, 
   domain(t = 0:20, x = 0:10))
g <- makeFun(
  sin(2*pi*t/10)*exp(-.2*x) ~ t & x)
contour_plot(
  g(t, x) ~ t + x,  
  domain(t=0:20, x=0:10))

contour_plot(
  sqrt( (v-3)^2 + 2*(w-4)^2 ) ~ v & w, 
  domain(v=0:6, w=0:6))

contour_plot(
  sqrt( (v-3)^2 + (w-4)^2 ) ~ v & w, 
  domain(v=0:6, w=0:6))

contour_plot(
  6*v - 3*w + 4 ~ v & w, 
  domain(v=0:6, w=0:6))