Skip to content

Commit

Permalink
version 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley authored and cran-robot committed Apr 3, 2008
1 parent b3dead7 commit 62371ca
Show file tree
Hide file tree
Showing 234 changed files with 6,597 additions and 1,349 deletions.
2 changes: 1 addition & 1 deletion ANNOUNCE
Expand Up @@ -7,5 +7,5 @@ that make plotting a hassle (like drawing legends) as well as
providing a powerful model of graphics that makes it easy to produce
complex multi-layered graphics.

Find out more at http://had.co.nz/ggplot2, and check out the over 500
Find out more at http://had.co.nz/ggplot2, and check out the over 400
examples of ggplot in use.
72 changes: 72 additions & 0 deletions CHANGELOG
@@ -1,5 +1,77 @@
See NEWS for changes in latest version

ggplot 0.5.7
----------------------------------------

New geoms, scales and aesthetics

* stat_step and geom_step to draw staircase plots (like plot(type="s"))
* order aesthetic (currently only for lines/paths) allows you to control the drawing order within a group
* scale_manual makes it easier to let ggplot uses the exact colours/sizes/linetypes that you want
* scale_reverse allows you to reverse the scale of x and y axes
* scale_grey is a new black and white scale for categorical data (colour and fill)


Improved options handling

* new function opts() to allow modification of plot options by addition
* update(p, theme_bw) and p + theme_bw now work

These changes mean that you can modify plot options in the same way that you modify all other aspects of the plot, e.g. qplot(mpg, wt, data=mptcars) + opts(title = "Fuel economy vs weight")

Improved documentation

* many tweaks to the online documentation, particular including the actual code you need to run for each object!
* every page now has a link to a form where you can submit feedback on exactly you do or don't like about a page
* required aesthetics now listed in documentation
* geom_polygon now has a decent example
* numerous minor corrections suggested by Jörg Beyer
* separated plotting advice from details of plot construction (what vs how), thanks to Bert Gunter for this suggestion


Improved map projections (with coord_map)

* coord_map defaults to orientation = c(90, 0, mean(range(y))) - this ensures that multiple layers line up correctly, but means you will have to specify the orientation yourself for many projections
* coord_map now respects limits set by scales
* removed useless ticks from coord_map

If you're using ggplot to draw maps and have thought of other features that would make your life easier, please let me know.


Bug fixes

* adding data and aesthetics in separate steps should now work
* layers with set parameters will not use mapped aesthetics
* use LazyLoad: false instead of SaveData: true for better future compatability

* coord_cartesian: fixed bug that prevented you from overriding the default axis expansion
* coord_equal: now scales correctly if ratio < 1
* geom_abline: fix bug where slope was ignored
* geom_jitter now works correctly with groups and categorical values (was actually a bug in how scale_discrete deals with continuous values)
* geom_path: automatically switch between polylineGrob and segmentsGrob when drawing paths so that setting line type now works properly
* geom_segment now uses both ends of segments to calculate axis limits
* plotmatrix: fix bug in scatterplot matrix where all scatterplots were transposed!
* qplot: should now work better within functions
* quickplot added as an alias of qplot, to avoid confusion with qunif, etc
* scale_*: better error message if you add a scale without a matching aesthetic mapping in the plot
* scale_identity no longer converts everything to character
* scale_identity: grob argument renamed to guide
* stat_*: made all statistics more robust to errors
* stat_quantile: fixed bug when only drawing a single quantile
* stat_smooth: returns silently if <2 non-missing data points


Minor aesthetic improvements

* coord_polar now specifies aspect.ratio by default, and I've made a few other tweaks to make polar coordinates plot look nicer
* geom_bar no longer draws gray borders by default, but instead uses the same colour as fill (this eliminates a tiny gap between neighbouring bars)
* plotmatrix: tweaks to improve display of scatterplot matrix
* scale_brewer: added option to reverse palette
* scale_colour: colour and fill legends now look exactly the same (previously colour was missing a grey border)
* scale_discrete has slightly larger expansion (0.75 vs 0.5)
* stat_bar: only output bars with > 0 count


ggplot 0.5.6
----------------------------------------

Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
@@ -1,16 +1,16 @@
Package: ggplot2
Type: Package
Title: An implementation of the Grammar of Graphics
Version: 0.5.7
Date: 2007-08-28
Version: 0.6
Date: 2008-01-10
Author: Hadley Wickham <h.wickham@gmail.com>
Maintainer: Hadley Wickham <h.wickham@gmail.com>
Description: An implementation of the grammar of graphics in R. It combines the advantages of both base and lattice graphics: conditioning and shared axes are handled automatically, and you can still build up a plot step by step from multiple data sources. It also implements a sophisticated multidimensional conditioning system and a consistent interface to map data to aesthetic attributes. See the ggplot2 website for more information, documentation and examples.
Depends: R (>= 2.6), grid, reshape (>= 0.8.0), proto, splines, MASS,
RColorBrewer, colorspace
Suggests: quantreg, Hmisc, mapproj, maps, digest
Suggests: quantreg, Hmisc, mapproj, maps, digest, butler
License: GPL
URL: http://had.co.nz/ggplot2/
LazyLoad: false
LazyData: true
Packaged: Fri Jan 11 18:35:11 2008; hornik
Packaged: Thu Apr 3 18:28:00 2008; hornik
126 changes: 58 additions & 68 deletions NEWS
@@ -1,73 +1,63 @@
ggplot 0.5.7
ggplot 0.6
----------------------------------------

New geoms, scales and aesthetics

* stat_step and geom_step to draw staircase plots (like plot(type="s"))
* order aesthetic (currently only for lines/paths) allows you to control the drawing order within a group
* scale_manual makes it easier to let ggplot uses the exact colours/sizes/linetypes that you want
* scale_reverse allows you to reverse the scale of x and y axes
* scale_grey is a new black and white scale for categorical data (colour and fill)


Improved options handling

* new function opts() to allow modification of plot options by addition
* update(p, theme_bw) and p + theme_bw now work

These changes mean that you can modify plot options in the same way that you modify all other aspects of the plot, e.g. qplot(mpg, wt, data=mptcars) + opts(title = "Fuel economy vs weight")

Improved documentation

* many tweaks to the online documentation, particular including the actual code you need to run for each object!
* every page now has a link to a form where you can submit feedback on exactly you do or don't like about a page
* required aesthetics now listed in documentation
* geom_polygon now has a decent example
* numerous minor corrections suggested by Jörg Beyer
* separated plotting advice from details of plot construction (what vs how), thanks to Bert Gunter for this suggestion


Improved map projections (with coord_map)

* coord_map defaults to orientation = c(90, 0, mean(range(y))) - this ensures that multiple layers line up correctly, but means you will have to specify the orientation yourself for many projections
* coord_map now respects limits set by scales
* removed useless ticks from coord_map

If you're using ggplot to draw maps and have thought of other features that would make your life easier, please let me know.


Bug fixes

* adding data and aesthetics in separate steps should now work
* layers with set parameters will not use mapped aesthetics
* use LazyLoad: false instead of SaveData: true for better future compatability

* coord_cartesian: fixed bug that prevented you from overriding the default axis expansion
* coord_equal: now scales correctly if ratio < 1
* geom_abline: fix bug where slope was ignored
* geom_jitter now works correctly with groups and categorical values (was actually a bug in how scale_discrete deals with continuous values)
* geom_path: automatically switch between polylineGrob and segmentsGrob when drawing paths so that setting line type now works properly
* geom_segment now uses both ends of segments to calculate axis limits
* plotmatrix: fix bug in scatterplot matrix where all scatterplots were transposed!
* qplot: should now work better within functions
* quickplot added as an alias of qplot, to avoid confusion with qunif, etc
* scale_*: better error message if you add a scale without a matching aesthetic mapping in the plot
* scale_identity no longer converts everything to character
* scale_identity: grob argument renamed to guide
* stat_*: made all statistics more robust to errors
* stat_quantile: fixed bug when only drawing a single quantile
* stat_smooth: returns silently if <2 non-missing data points


Minor aesthetic improvements

* coord_polar now specifies aspect.ratio by default, and I've made a few other tweaks to make polar coordinates plot look nicer
* geom_bar no longer draws gray borders by default, but instead uses the same colour as fill (this eliminates a tiny gap between neighbouring bars)
* plotmatrix: tweaks to improve display of scatterplot matrix
* scale_brewer: added option to reverse palette
* scale_colour: colour and fill legends now look exactly the same (previously colour was missing a grey border)
* scale_discrete has slightly larger expansion (0.75 vs 0.5)
* stat_bar: only output bars with > 0 count
The two big changes in this release are improved documentation and legends.

* all major ggplot2 components now have their own built in documentation, so that (e.g.) ?stat_smooth or ?geom_point now give you useful information

* the legend code is now considerably more sophisticated and will attempt to merge together legends for the same variable

* also, legends are drawn based on the geoms used (instead of the scales used, as previously) so should match the plot much better (e.g. for geom_smooth, geom_boxplot, geom_vline, geom_abline, geom_pointrange).

These features are new, so there are likely to be a few bugs that I haven't discovered. Please me know if you discover any.

Other additions and corrections

* coord_equal: should now work correctly in all situations
* coord_polar: add start and direction parameters, giving more control over the layout of the polar coords
* coord_polar: added my favourite pie chart example
* coord_trans now deals with groups appropriately, at the cost of decreased speed
* geom_abline, geom_vline, geom_hline: should now behave better in a wider variety of settings
* geom_boxplot: deals with continuous x-axis and grouping much better
* geom_boxplot: now has it's own legend which actually looks like a boxplot
* geom_boxplot: reports if missing values removed
* geom_crossbar: the middle line is now display thicker than the other lines, controlled by the parameter fatten (thanks to Heike Hofmann for the suggestion)
* geom_density: fix scale adjustment bug in geom_density
* geom_line, geom_text: all size measurements (now lines and text as well) are measured in mm, lines/paths default to paths 0.5mm wide
* geom_rug: new to add marginal rug plots
* geom_smooth: added example showing how to use geom_smooth with your own models
* geom_smooth: fixed bug where if se=FALSE x axis always includes 0
* geom_vline, geom_hline: yet another rewrite which should make them more powerful and less error prone.
* ggsave reports width and height of saved image
* position_stack: fixed bug when data was empty
* qplot: allow qplot to use computed aesthetics too
* scale_continuous: tweaks to minor breaks to make appearance better on wider range of coordinate systems
* scale_discrete: all discrete scales now have labels argument which you can use to override the factor levels
* scale_discrete: now works correctly with character vectors
* scale_size: changed default range to [0.5, 3] to better reflect new sizing decisions
* scale_size: legends resize to avoid overlaps
* scale_x_continuous, scale_y_continuous: new convenience functions xlim and ylim (and zlim) that make it even easier to adjust the limits of the x, y, and z axes
* stat_bin, geom_area: fixed bug in combination of stat_bin and geom_area that made it difficult to draw frequency polygons
* stat_bin: fixed bug which resulted in increased counts when the x axis was a categorical variable with a single level (thanks to Bob Muenchen for pointing this out!)
* stat_bin: no longer incorrectly warns that binwidth is unspecified when breaks are set
* stat_bin: now takes origin argument to manually specify origin of first bin (default is round_any(min(range), bin_width, floor))
* stat_boxplot, stat_contour, stat_density2d, stat_qq, stat_density: na.rm parameter added to the following statistics (thanks to Leena Choi for suggesting this)
* stat_function: new, makes it easy to superimpose a function on the plot
* stat_qq: axes flipped to agree with base R
* stat_qq: now uses sample aesthetic to select variable for summary
* stat_quantile: updated to work with latest version of quantreg
* stat_spoke: new, to make it possible to use geom_segment parameterised by angle and radius (thanks to Jiho for the suggestion)
* stat_summary: better documentation
* stat_summary: convenient auto wrapping of simple summary functions

Miscellaneous changes:

* it's now easy to change the default scales (and their arguments) with the set_default_scale function, see ?set_default_scale for more details (thanks to Bob Muenchen for the suggestion)
* new order aesthetic which controls the order in which elements are plotted
* min and max are now scaled the same way as y
* functions are silently dropped (e.g. aes(colour=col))
* scales do not try and map variables that don't exist (fixes some rather obscure bugs)
* aes(mpg, wt) is now equivalent to aes(x = mpg, y = wt)


See CHANGELOG for changes in previous versions
73 changes: 14 additions & 59 deletions R/aaa-top-level.r → R/aaa-.r
@@ -1,5 +1,6 @@
require("proto")
require("grid")
require("reshape")

# INCLUDES <- "web/graphics"
# FILETYPE <- "html"
Expand All @@ -24,44 +25,16 @@ TopLevel <- proto(expr = {
get(paste(firstUpper(.$class()), firstUpper(name), sep=""))
}

accessors <- function(.) create_accessors(.$find_all(), .$class())
accessors_print <- function(.) invisible(lapply(.$accessors(), cat))

examples <- function(.) {
# Coming soon
}

examples_text <- function(.) {
source <- attr(get("examples", .), "source")
source <- source[-c(1, length(source))]

unlist(lapply(source, function(x) gsub("^\t\t", "", x)))
}

examples_run <- function(.) {
ggopt(auto.print=TRUE)

tryCatch(
.$examples(),
finally = invisible(ggopt(auto.print=FALSE))
)
}

all_examples_run <- function(.) {
old_opt <- options(warn = 1)
on.exit(options(old_opt))

tryapply(.$find_all(), function(x) {
cat("Running examples for", x$my_name(), "\n")
x$examples_run()
})
invisible()
}

my_name <- function(., prefix=TRUE) {
if (!prefix) return(.$objname)
paste(.$class(), .$objname, sep="_")
}
my_names <- function(.) .$my_name()

myName <- function(.) {
ps(firstUpper(.$class()), ps(firstUpper(strsplit(.$objname, "_")[[1]])))
}


doc <- TRUE

Expand Down Expand Up @@ -138,7 +111,7 @@ TopLevel <- proto(expr = {
ps(
# "<p class='hierarchy'>", .$html_parent_link(), "</p>\n",
"<h1>", .$html_img(), .$my_name(), "</h1>\n",
"<p class='call'>", .$call(), "</p>\n"
"<p class='call'>", ps(.$call(), collapse="<br />\n"), "</p>\n"
)
}

Expand Down Expand Up @@ -196,12 +169,13 @@ TopLevel <- proto(expr = {
"<p>", names(aes), ": <code>", aes, "</code> <span class='linklist'>", scale_links, "</span></p>",
"</li>\n"
),
"</ul>\n"
"</ul>\n",
"<p>Layers are divided into groups by the <strong>group</strong> aesthetic. By default this is set to the interaction of all categorical variables present in the plot</p>\n"
)
}

html_feedback <- function(.) {
ps("<p class='feedback'>What do you think of the documentation? <a href='http://hadley.wufoo.com/forms/documentation-feedback/default/field0/", .$my_name(), "'>Please let me know by filling out this short online survey</a>.</p>")
ps("<p class='feedback'>What do you think of the documentation? <a href='http://hadley.wufoo.com/forms/documentation-feedback/def/field0=", .$my_name(), "'>Please let me know by filling out this short online survey</a>.</p>")
}

html_outputs <- function(.) {
Expand Down Expand Up @@ -344,32 +318,13 @@ TopLevel <- proto(expr = {
"\n"
), .$my_name())
}


call <- function(.) {
ps(
.$my_name(), "(",
ps(
"mapping&nbsp;=&nbsp;aes(...)",
"data&nbsp;=&nbsp;NULL",
if(exists("default_stat", .))
ps("stat&nbsp;=&nbsp;'", .$default_stat()$html_abbrev_link_self(), "'"),
if(exists("default_geom", .))
ps("geom&nbsp;=&nbsp;'", .$default_geom()$html_abbrev_link_self(), "'"),
if(exists("default_pos", .))
ps("position&nbsp;=&nbsp;'", .$default_pos()$html_abbrev_link_self(), "'"),
plist(.$params()),
"...",
sep = ", "
),
")"
)
}


})

print.proto <- function(x, ...) x$pprint(...)
pprint <- function(x, ...) print(as.list(x), ...)
# name.proto <- function (...) {
# proto(print.proto = print.default, f = proto::name.proto)$f(...)
# }


0 comments on commit 62371ca

Please sign in to comment.