Skip to content

Commit 4e33ebf

Browse files
Nicholas HamiltonNicholas Hamilton
authored andcommitted
ggtern 1.0.3.2
1 parent 4e88ccd commit 4e33ebf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+899
-902
lines changed

.DS_Store

15 KB
Binary file not shown.

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: ggtern
22
Type: Package
33
Title: An extension to ggplot2, for the creation of ternary diagrams.
44
Version: 1.0.3.2
5-
Date: 2014-01-30
5+
Date: 2014-05-30
66
Author: Nicholas Hamilton <[email protected]>
77
Maintainer: Nicholas Hamilton <[email protected]>
88
Description: ggtern is a package that extends the functionality of ggplot2, giving the capability to plot ternary diagrams for (subset of) the ggplot2 geometries. Additionally, ggtern has implemented several NEW geometries which are unavailable to the standard ggplot2 release. For further examples and documentation, please proceed to the ggtern website.

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export("%+%")
1515
export("%+replace%")
1616
export(arrow)
1717
export(element_ternary)
18-
export(geom_smooth)
1918
export(ggplot_build)
2019
export(ggtern)
2120
export(ifthenelse)
@@ -31,6 +30,7 @@ export(scale_R_continuous)
3130
export(scale_T_continuous)
3231
export(stat_density2d)
3332
export(geom_density2d)
33+
export(geom_smooth)
3434
export(geom_confidence)
3535
export(geom_errorbarT)
3636
export(geom_errorbarL)

R/.DS_Store

6 KB
Binary file not shown.

R/geom-density2d.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
#'
66
#' This can be useful for dealing with overplotting. Additional weight aesthetic (see aesthetic section below) permits better weighting if desired
77
#'
8-
#' @aliases Density2dTern
8+
#' @aliases Density2dTern GeomDensity2dtern
99
#' @section Aesthetics:
1010
#' \Sexpr[results=rd,stage=build]{ggtern:::rd_aesthetics("geom", "density2dtern")}
1111
#' @inheritParams ggplot2::geom_point
1212
#' @inheritParams ggplot2::geom_path
13-
#' @aliases GeomDensity2dtern
1413
#' @export
15-
geom_density2d <- function (mapping = NULL, data = NULL, stat = "Density2dtern", position = "identity",
16-
lineend = "butt", linejoin = "round", linemitre = 1, na.rm = FALSE, ...) {
14+
geom_density2d <- function (mapping = NULL, data = NULL, stat = "auto", position = "identity",
15+
lineend = "butt", linejoin = "round", linemitre = 1, na.rm = FALSE, ...){
16+
if(stat == 'auto') stat = iflasttern('density2dtern','density2d')
1717
GeomDensity2dtern$new(mapping = mapping, data = data, stat = stat, position = position,
1818
lineend = lineend, linejoin = linejoin, linemitre = linemitre, na.rm = na.rm,...)
1919
}
2020

2121
GeomDensity2dtern <- proto(ggint$GeomPath,{
2222
objname <- "density2dtern"
23-
#draw <- function(., data, scales, coordinates, arrow = NULL, lineend = "butt", linejoin = "round", linemitre = 1, ..., na.rm = FALSE)
24-
# GeomConfidence$draw(.=.,data=data,scales=scales,coordinates=coordinates,lineend = lineend,na.rm = na.rm,...)
2523
default_stat <- function(.) StatDensity2dtern
2624
default_aes <- function(.) aes(colour="#3366FF", size = 0.5, linetype = 1, alpha = NA,weight=NULL,fill="transparent")
25+
#draw <- function(., data, scales, coordinates, arrow = NULL, lineend = "butt", linejoin = "round", linemitre = 1, ..., na.rm = FALSE)
26+
# GeomConfidence$draw(.=.,data=data,scales=scales,coordinates=coordinates,lineend = lineend,na.rm = na.rm,...)
2727
})

R/geom-segment.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ ggint$GeomSegment <- proto(Geom, {
7070
pieces <- pieces[order(pieces$group),]
7171
GeomPath$draw_groups(pieces, scales, coordinates, arrow = arrow, ...)
7272
}
73-
default_stat <- function(.) StatIdentity
7473
required_aes <- c("x", "y")
74+
default_stat <- function(.) StatIdentity
7575
default_aes <- function(.) aes(colour="black", size=0.5, linetype=1, alpha = NA)
7676
guide_geom <- function(.) "path"
7777
})

R/ggsave.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
#' @param filename file name/filename of plot
1313
#' @param plot plot to save, defaults to last plot displayed
1414
#' @param device device to use, automatically extract from file name extension
15-
#' @param path path to save plot to (if you just want to set path and not
16-
#' filename)
15+
#' @param path path to save plot to (if you just want to set path and not filename)
1716
#' @param scale scaling factor
1817
#' @param width width (defaults to the width of current plotting window)
1918
#' @param height height (defaults to the height of current plotting window)
@@ -29,11 +28,10 @@
2928
#' plot <- ggtern(data=Feldspar,aes(An,Ab,Or)) + geom_point() + theme_rgbw()
3029
#' ggsave(plot,filename='test.png')
3130
#' }
32-
ggsave <- function(filename = default_name(plot), plot = last_plot(),
31+
ggsave <- function(filename = default_name(), plot = last_plot(),
3332
device = default_device(filename), path = NULL, scale = 1,
3433
width = par("din")[1], height = par("din")[2], units = c("in", "cm", "mm"),
3534
dpi = 300, limitsize = TRUE, ...) {
36-
3735
if (!inherits(plot, "ggplot")) stop("plot should be a ggplot2 plot")
3836

3937
eps <- ps <- function(..., width, height)
@@ -49,7 +47,6 @@ ggsave <- function(filename = default_name(plot), plot = last_plot(),
4947
grDevices::win.metafile(..., width=width, height=height)
5048
emf <- function(..., width, height)
5149
grDevices::win.metafile(..., width=width, height=height)
52-
5350
png <- function(..., width, height)
5451
grDevices::png(..., width=width, height=height, res = dpi, units = "in")
5552
jpg <- jpeg <- function(..., width, height)
@@ -59,10 +56,15 @@ ggsave <- function(filename = default_name(plot), plot = last_plot(),
5956
tiff <- function(..., width, height)
6057
grDevices::tiff(..., width=width, height=height, res = dpi, units = "in")
6158

62-
default_name <- function(plot) {
63-
paste(ggtern:::ggint$digest.ggplot(plot), ".pdf", sep="")
59+
default_name <- function(){
60+
filename="plot"
61+
suffix = NULL
62+
while(file.exists(paste(filename,suffix,".pdf",sep=""))){
63+
if(is.null(suffix)) suffix = 0
64+
else suffix = suffix + 1
65+
}
66+
paste(filename,suffix,".pdf",sep="")
6467
}
65-
6668
default_device <- function(filename) {
6769
pieces <- strsplit(filename, "\\.")[[1]]
6870
ext <- tolower(pieces[length(pieces)])
@@ -116,6 +118,4 @@ ggsave <- function(filename = default_name(plot), plot = last_plot(),
116118
print(plot)
117119

118120
invisible()
119-
}
120-
121-
#body(ggsave)[[which(as.list(body(ggsave)) == 'print(plot)')]] <- substitute(ggtern::print.ggtern(plot))
121+
}

R/global.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
#' \code{get_last_coord} is a function that returns the last coordinate system used.
1919
#' @rdname undocumented
20+
#' @keywords internal
2021
get_last_coord <- .coordinates$get
2122

2223
#' \code{set_last_coord} set the last coordinate system.
2324
#' @param new the coordinate system to set
2425
#' @rdname undocumented
26+
#' @keywords internal
2527
set_last_coord <- .coordinates$set

R/stat-density-2d.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
#' @aliases StatDensity2dtern
88
#' @export
99
#' @seealso \code{\link[ggtern]{geom_density2d}}
10-
stat_density2d <- function (mapping = NULL, data = NULL, geom = "density2dtern", position = "identity", na.rm = FALSE, contour = TRUE, n = 100, ...) {
10+
stat_density2d <- function (mapping = NULL, data = NULL, geom = "auto", position = "identity", na.rm = FALSE, contour = TRUE, n = 100, ...) {
11+
if(geom == 'auto') geom = iflasttern('density2dtern','density2d')
1112
StatDensity2dtern$new(mapping = mapping, data = data,geom=geom,geometry=geom,position = position, na.rm = na.rm, contour = contour, n = n,...)
1213
}
1314

R/strip-unapproved.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
segment = "segment",
44
polygon = "polygon",
55
text = "text",
6+
contour = "contourtern",
67
density2d = "density2dtern",
78
smooth = "smoothtern",
89
rug = "rug",

0 commit comments

Comments
 (0)