Giter Club home page Giter Club logo

ggtern's People

Contributors

michbur avatar nicholasehamilton avatar timelyportfolio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ggtern's Issues

ggtern fails to install with ggplot2 3.3.0

ggtern fails to install with ggplot2 3.3.0 but installs well with ggplot2 3.1.0 in R 3.6

  • installing source package ‘ggtern’ ...
    ** package ‘ggtern’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** data
    ** demo
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in get(x, envir = ns, inherits = FALSE) :
    object 'expand_default' not found
    Error: unable to load R code in package ‘ggtern’
    Execution halted

Automatic zooming with tern_limits()?

Often one has data that is only found in a small region of the total space. When this happens, often one wants to zoom into that particular region. This can be done with tern_limits(). However, it is currently only possible to specify the limits manually. Would it be possible to add an automatic zoom argument for tern_limits()?

By automatic, I mean so that it automatically zooms into the smallest possible triangle that contains all points. Probably, one would want to round to the nearest 5/10/20 on the axes though.

To find the limits, find the max values of the three variables. Then round these to the nearest desired number. This is easy to do with plyr's round_any(). Then set the smallest number to the second smallest number. Then use these numbers.

I note that the order of tern_limits() does not match the order of arguments in the ggtern(aes(...)) call. E.g. The first given to ggtern() is the second to tern_limits(). So one has to rearrange them. You may want to rearrange these for consistency, but it may break prior plots.

Here's an example. I use genomic admixture values from Bryc et al (2015)'s paper based on 23andme data. The data is here.

# libs --------------------------------------------------------------------
library(pacman)
p_load(plyr, psych, ggplot2, ggtern)

# data --------------------------------------------------------------------
d_23andme = read.csv("BryceAdmixNAEP.tsv", sep="\t", row.names=1)

# Ternary admix plots -----------------------------------------------------
#ternary admix plots like those in the admix paper

#normal plot
ggtern(d_23andme, aes(BlackAfricanAncestry, BlackAmericanAncestry, BlackEuropeanAncestry)) + geom_point()

#manually set limits
ggtern(d_23andme, aes(BlackAfricanAncestry, BlackAmericanAncestry, BlackEuropeanAncestry)) + geom_point() + tern_limits(.4, 1, .4)

#find max values
max_vals = describe(d_23andme[1:3])$max %>% #get max values
  `*`(100) %>% #to percent
  round_any(20, f = ceiling) #round to desired level

#set the lowest to the second lowest
max_vals[order(max_vals)[1]] = sort(max_vals)[2]

#back to fractions
max_vals = max_vals/100

#plot with automatic zoom
ggtern(d_23andme, aes(BlackAfricanAncestry, BlackAmericanAncestry, BlackEuropeanAncestry)) + geom_point() + tern_limits(max_vals[2], max_vals[1], max_vals[3])

aa_admix2
aa_admix

error in coord_tern() :could not find function "coord"

It seems some of the basic functionality of the package is not working in my setup or in general.

I can't even plot the examples from the package.
library(ggtern)
ggtern(data=Feldspar,aes(x=An,y=Ab,z=Or)) + geom_point()

gives the error:

Error in coord_tern() : could not find function "coord"

restarting the r session did not work, trace and debug give me the same error. the other example in the package also gives me this error.
Furthermore: using ggplot() + coord_tern() also gives the same error

I'm using the CRAN version 1.06.1 on a windows 64 bit installation.
here is my session info:
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 LC_NUMERIC=C
[5] LC_TIME=Dutch_Netherlands.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] ggtern_1.0.6.1 ggplot2_1.0.1.9003

loaded via a namespace (and not attached):
[1] Rcpp_0.12.2 lattice_0.20-33 MASS_7.3-43 grid_3.2.2 plyr_1.8.3 gtable_0.1.2 magrittr_1.5 scales_0.3.0
[9] stringi_1.0-1 reshape2_1.4.1 sp_1.2-1 proto_0.3-10 tools_3.2.2 stringr_1.0.0 munsell_0.4.2 polyclip_1.3-2
[17] colorspace_1.2-6

Example from vignette doesn't work with ggplot 3.2.1.9000 (Error: $ operator is invalid for atomic vectors)

I am getting an error (Error: $ operator is invalid for atomic vectors) when using ggtern and the latest ggplot dev version. Any idea?

library(ggtern)
#> Warning: package 'ggtern' was built under R version 3.6.2
#> Loading required package: ggplot2
#> Registered S3 methods overwritten by 'ggtern':
#>   method           from   
#>   +.gg             ggplot2
#>   grid.draw.ggplot ggplot2
#>   plot.ggplot      ggplot2
#>   print.ggplot     ggplot2
#> --
#> Remember to cite, run citation(package = 'ggtern') for further info.
#> --
#> 
#> Attaching package: 'ggtern'
#> The following objects are masked from 'package:ggplot2':
#> 
#>     %+%, aes, annotate, calc_element, ggplot, ggplot_build,
#>     ggplot_gtable, ggplotGrob, ggsave, layer_data, theme, theme_bw,
#>     theme_classic, theme_dark, theme_gray, theme_light, theme_linedraw,
#>     theme_minimal, theme_void
library(tidyverse)

df = data.frame(x = runif(50),
                y = runif(50),
                z = runif(50),
                Value = runif(50,1,10),
                Group = as.factor(round(runif(50,1,2))))
ggtern(data=df,aes(x,y,z,color=Group)) +
  theme_rgbw() +
  geom_point() + geom_path() +
  labs(x="X",y="Y",z="Z",title="Title")
#> Error: $ operator is invalid for atomic vectors

sessionInfo()
#> R version 3.6.1 (2019-07-05)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 18362)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_Austria.1252  LC_CTYPE=English_Austria.1252   
#> [3] LC_MONETARY=English_Austria.1252 LC_NUMERIC=C                    
#> [5] LC_TIME=English_Austria.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#>  [1] forcats_0.4.0      stringr_1.4.0      dplyr_0.8.3        purrr_0.3.3       
#>  [5] readr_1.3.1        tidyr_1.0.0        tibble_2.1.3       tidyverse_1.3.0   
#>  [9] ggtern_3.1.0       ggplot2_3.2.1.9000
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.3          lubridate_1.7.4     lattice_0.20-38    
#>  [4] assertthat_0.2.1    zeallot_0.1.0       digest_0.6.23      
#>  [7] R6_2.4.1            cellranger_1.1.0    plyr_1.8.5         
#> [10] backports_1.1.5     reprex_0.3.0        evaluate_0.14      
#> [13] httr_1.4.1          highr_0.8           pillar_1.4.2       
#> [16] rlang_0.4.2         compositions_1.40-3 readxl_1.3.1       
#> [19] rmarkdown_1.18      proto_1.0.0         munsell_0.5.0      
#> [22] broom_0.5.2         compiler_3.6.1      modelr_0.1.5       
#> [25] xfun_0.11           pkgconfig_2.0.3     htmltools_0.4.0    
#> [28] tidyselect_0.2.5    tensorA_0.36.1      gridExtra_2.3      
#> [31] fansi_0.4.0         crayon_1.3.4        dbplyr_1.4.2       
#> [34] withr_2.1.2         MASS_7.3-51.4       grid_3.6.1         
#> [37] nlme_3.1-140        bayesm_3.1-4        jsonlite_1.6       
#> [40] gtable_0.3.0        lifecycle_0.1.0     DBI_1.0.0          
#> [43] magrittr_1.5        scales_1.1.0        cli_2.0.0          
#> [46] stringi_1.4.3       fs_1.3.1            robustbase_0.93-5  
#> [49] xml2_1.2.2          vctrs_0.2.0         generics_0.0.2     
#> [52] latex2exp_0.4.0     tools_3.6.1         glue_1.3.1         
#> [55] DEoptimR_1.0-8      hms_0.5.2           yaml_2.2.0         
#> [58] colorspace_1.4-1    rvest_0.3.5         knitr_1.26         
#> [61] haven_2.2.0

Created on 2020-01-20 by the reprex package (v0.3.0)

Possible bug in interpolation?

Hi Nick,
thanks for providing ggtern. I have tried to use it for visualizing a 3D Dirichlet density with the code below. The behavior of the function should be completely symmetric with respect to the three variables. However, the code produces a non-symmetric picture. (Swapping variable names x1 and x3 leaves the anomality between x1 and x2, so it must be the interpolation that does this.) To me, this looks like a bug in the interpolation behavior. Or am I doing something wrong?
Best, Ulrike

`require(gtools)
require(ggplot2)
require(ggtern)

x1 <- c(0.0001, seq(0.01,0.99,0.01), 0.9998)
x2 <- c(0.0001, seq(0.01,0.99,0.01), 0.9998)
x3 <- c(0.0001, seq(0.01,0.99,0.01), 0.9998)

mat <- as.matrix(expand.grid(x1,x2,x3))
colnames(mat) <- c("x1","x2","x3")
mat <- mat[rowSums(mat)==1,]
dichte <- gtools::ddirichlet(x=mat, rep(0.5,3))
mat <- as.data.frame(cbind(100*mat, dichte=dichte))
ggtern(data=as.data.frame(mat), aes(x=x1,y=x2,z=x3, value=dichte)) +
stat_interpolate_tern(method = "loess", bins=2000)
`

Add secondary ticks

At the moment, the ternary axes have major and minor tcks for the primary (Apex) component, however, some ternaries, mark the ticks for the other component on each binary axis. Let these ticks be called 'Secondary Ticks'

stat_density_tern not working in v3.3.0

Trying to use the 'stat_density_tern' and 'geom_density_tern' functions but only get a blank ternary diagram. These functions worked perfectly in a previous version.

See attached example using code from the help file.

image

How should you disable your {ggtern} package to continue using the ggplot2::labs (caption = 'Text') function?

How should you disable your {ggtern} package to continue using the ggplot2::labs (caption = 'Text') function?

ggplot2 3.3.5 2021-06-25 [1] CRAN (R 4.0.3)
ggtern 3.3.5 2021-07-21 [1] CRAN (R 4.0.3)

# Work
library(ggplot2)
ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(color = class)) +
  geom_smooth(se = FALSE, method = "loess") +
  labs(
    caption = "Data from fueleconomy.gov"
  )

and

# DO NOT Work

library(ggtern)

ggplot(mpg, aes(displ, hwy)) +
  geom_point(aes(color = class)) +
  geom_smooth(se = FALSE, method = "loess") +
  labs(
    caption = "Data from fueleconomy.gov"
  )

And the error I get with the code above is:

geom_smooth() using formula 'y ~ x' Error in titleGrob(label, x, y, hjust = hj, vjust = vj, angle = angle, : unused argument (expand_y = TRUE).

BG Rendering

At the moment, in coord-tern.R, the rendering of the major and minor ticks do not consider conversion to native units, from some other unit.

Commands like this should be used:

convertUnit(unit(0.02, "npc"), "native",valueOnly=TRUE)

at the moment, no conversion is used, so in effect it is doing this

convertUnit(unit(0.02, "native"), "native",valueOnly=TRUE)

so therefore, if the user specifies a different tick size as a 'unit' it has no effect at the moment.

On loading ggtern theme(legend.position="none") has error in ggplot2 plots

Regardless of whether ggtern is loaded before or after ggplot2, any ggplot graphs that have

theme(legend.position="none")

will throw the error:

Error:object of type 'closure' is not subsettable

detaching ggtern (detach("package:ggtern", unload=TRUE)) solves the problem with the ggplot graphs.

Error when using ggsave

Calling print(plot) method from ggplot2 package, not the patched print function from ggtern

error in library(ggtern)

Error: package or namespace load failed for ‘ggtern’: loadNamespace()'ggtern'.onLoad is fali,: (function (el, elname) error: "tern.panel.background" is not a valid theme element name.

Better theme standardization (to that of ggplot2)

Corrections should be made so that:
theme_tern_bw() changed to theme_bw()
theme_tern_gray() changed to theme_gray()

Themes should be created like theme_minimal(), theme_classic()

Caution should be made to make distinction between the ggplot2::theme_XYZ() and ggtern::theme_XYZ(), if, the former is called (which it is in the current code) at some point (as a starting base point) by the latter.

how to increase font size and change face || bring title to the center

Hi Nicholas,

Thanks for awesome library.

I'm interested to use to to create ancestry related graphics. The plot is constructed beautifully. However, I'm looking to enhance the graphics by two further things: 1) a) make the axis ticks in bold, increase their font size, and b) the ancestries (anc1, anc2, and anc3 in this case) font bigger and bold.
2) I'd like to bring the plot title in the middle, that is right above the triangle, which at the moment is sort of left aligned.


set.seed(4)
sample_data<-data.table( anc1= c(rep(10,3),rep(20,4), rep(30,3)) , anc2=c(rep(50,3),rep(10,4), rep(65,3)) , anc3=c(rep(40,3),rep(70,4), rep(5,3)))

CairoTIFF(filename = "sample.tiff", height=800, width=900)

## theme_void is good
ggtern::ggtern(data=sample_data,aes(x=anc1,y=anc2, z=anc3))  +  theme_rgbw( ) + ggtern::theme_nogrid()  + geom_point(color="black",size=3.5,alpha=0.4)+
 labs(title="Ternary plot for ancestry")  
 
dev.off()


I've tried tinkering with geom_text but that doesn't help, I've tried to play within the theme_rgbw but it doesn't allow changes.

Thanks~

I'm using ggtern_3.3.0, ggplot2_3.3.2 and R v4.0

ggtern makes ggplot2 axes disappear

When I install ggtern, then try to plot in ggplot, the axes now disappear. I cannot make them come back unless I remove the ggtern package. I'm working in RStudio 1.3.959 and R 4.0.2 on MacOS 10.15.5.

Importing Error

Hello,

I'm facing an issue using the library now that I didn't have before. I even updated to R 3.6.1, but this persisted:

> library(ggtern)
Error: package or namespace load failed for ‘ggtern’:
 .onLoad failed in loadNamespace() for 'ggtern', details:
  call: modify_list(vals, list(..., ... = NULL))
  error: could not find function "modify_list"

Any clue of how to overcome this?

Best,
Renan

plotly::ggplotly()

I'm wondering if I can put my two cents for a feature request for plotly support. If ggtern could work with ggplotly, that would be amazing.

aes_string() is missing

Sometimes one wants to use a function that takes variables as strings and then pastes them into ggplot(). This can easily be done with aes_string(). However, aes_string() is missing from ggtern, so it falls back to using the ggplot2 version. This however means that the z variable is not found.

Example function I was trying to use:

plot_tern = function(df, vars){
  #minimal example
  browser()
  ggtern(df, aes_string(vars[1], vars[2], vars[3])) + geom_point()
}

Calling this gives something like:

Error in value[[3L]](cond) : 
  coord_tern requires the following missing aesthetics: z

Workaround:

One has to declare the name of the z variable explicitly, like this:

plot_tern = function(df, vars, tern_limits){
  ggtern(df, aes_string(vars[1], vars[2], z = vars[3])) + geom_point()
}

ggtern will not run with the latest ggplot2

There seems to be an issue with ggtern running with the new ggplot2. I have tried to load earlier versions of R, ggtern, and ggplot2 but cannot get them working. With the latest versions I get the following error:

Error: geom_point requires the following missing aesthetics: x and y

rlang::last_error()
<error/rlang_error>
geom_point requires the following missing aesthetics: x and y
Backtrace:

  1. (function (x, ...) ...
  2. ggtern:::print.ggplot(x)
  3. ggtern:::ggplot_build.ggplot(x)
  4. ggtern:::by_layer(function(l, d) l$compute_geom_1(d))
  5. ggtern:::f(l = layers[[i]], d = data[[i]])
  6. l$compute_geom_1(d)
  7. ggplot2:::f(..., self = self)
  8. ggplot2:::check_required_aesthetics(...)

rlang::last_trace()
<error/rlang_error>
geom_point requires the following missing aesthetics: x and y
Backtrace:
x

  1. +-(function (x, ...) ...
  2. -ggtern:::print.ggplot(x)
  3. +-ggtern::ggplot_build(x)
  4. -ggtern:::ggplot_build.ggplot(x)
  5. \-ggtern:::by_layer(function(l, d) l$compute_geom_1(d))
    
  6.   \-ggtern:::f(l = layers[[i]], d = data[[i]])
    
  7.     \-l$compute_geom_1(d)
    
  8.       \-ggplot2:::f(..., self = self)
    
  9.         \-ggplot2:::check_required_aesthetics(...)
    

BG Padding

The padding around the background does not consider the amount required to fit the entire ternary axis titles.

Plotting points at the ternary diagram border

Is it possible to completely plot a point close to the border? When I try

ggtern() + geom_point(aes(x = 1, y = 0, z = 0), size=10)

the point appears partially. I've tried to modifiy option tern.discard.external to FALSE
but the point is still partially plotted.

Next release of ggplot2

Hi

I'm preparing the next release of ggplot2 and our reverse dependency checks show that ggtern is failing with the new version. Looking into it we see that ggtern is importing internal ggplot2 functions that have been removed due to refactoring. We plan to submit ggplot2 by the end of October and hope you can have a fix ready by then.

You can install the release candidate of ggplot2 using devtools::install_github('tidyverse/[email protected]')

Thanks
Thomas

Inside ticks

Axes ticks are on the outside of the axis at the moment, let there be an option for these ticks to go on the inside.

ggtern no longer works with latest version of ggplot2

If you update ggplot2 to v2.2.0, ggtern no longer works.
I figure this is because the new_panel function is no longer available in ggplot2; the API changed. I'd be happy to look into this myself and make a PR, if that is an option.

Issue with long labels

Hi

First, I would like to thank you for your very useful work on this package.

I have a little issue with the labels I would like to print on my plot.
With this code, everything is ok:

# Data
granu <- data.frame(T = 0.2,
                    L = 0.3,
                    R = 0.5)
# Legend
type.sol <- data.frame(T = c(0.6, 0.35, 0.33, 0.25, 0.075,0.125,
                             0.125, 0.075, 0.2),
                       L = c(0.15, 0.42, 0.15, 0.65, 0.8, 0.52,
                             0.33, 0.13, 0.1),
                       R = c(0.15, 0.23, 0.52, 0.1, 0.125, 0.355,
                             0.545, 0.795, 0.7),
                       txt = c('Argile', 'Argile\nlimoneuse',
                               'Argile sableuse', 'Limon\nargileux',
                               'Limon', 'Limon\nsableux',
                               'Sable\nlimoneux', 'Sable',
                               'Sable\nargileux'))

# Limites
lim.demolon <- data.frame(x = c(0.5, 0.4, 0.4, 0.4, 0.25, 0.15, 0,
                                0.25, 0.15, 0.15),
                          y = c(0.5, 0.3, 0.3, 0.6, 0.5, 0.85, 0.75,
                                0.2, 0.2, 0.2),
                          z = c(0, 0.3, 0.3, 0, 0.25, 0, 0.25,
                                0.55, 0.65, 0.65),
                          xend = c(0.4, 0.4, 0, 0.25, 0.25, 0.15, 0.25,
                                   0.15, 0.15, 0),
                          yend = c(0.3, 0, 0.5, 0.5, 0, 0.6, 0.5,
                                   0.2, 0, 0.35),
                          zend = c(0.3, 0.6, 0.5, 0.25, 0.75, 0.25, 0.25,
                                   0.65, 0.85, 0.65))
#Build
plot <- ggtern(data = granu, aes(y = T, x = L, z = R)) +
        geom_segment(data = lim.demolon,
                     aes(x = y, y = x, z = z,
                         xend = yend, yend = xend, zend = zend),
                     size = 0.5) +
        geom_text(data = type.sol, aes(x = L, y = T, z = R, label = txt),
                  size = 4) +
        geom_point(color = 'red') +
        labs(title = "Classification de Demolon",
             T = "Argile",
             L = "Limon",
             R = "Sable") +
        theme_showarrows() +
        theme_arrowlong() +
        theme_hidetitles()
plot

But when I want to print:

plot <- ggtern(data = granu, aes(y = T, x = L, z = R)) +
        geom_segment(data = lim.demolon,
                     aes(x = y, y = x, z = z,
                         xend = yend, yend = xend, zend = zend),
                     size = 0.5) +
        geom_text(data = type.sol, aes(x = L, y = T, z = R, label = txt),
                  size = 4) +
        geom_point(color = 'red') +
        labs(title = "Classification de Demolon",
             T = "Argile(< 2µm)",
             L = "Limon (2 à 20µm)",
             R = "Sable (> 20 µm)") +
        theme_showarrows() +
        theme_arrowlong() +
        theme_hidetitles()
plot

Nothing is printed...

Do I make something wrong ?

Regards
Gilles

geom_confidence_tern seems to plot prediction regions?

In using ggtern, I think the region plotted by geom_confidence_tern may be what is more normally termed a prediction region, rather than a confidence region? i.e. probabilities relate to a new data point, rather than to a population parameter?

My reasoning is analogous to this discussion for stat_ellipse in ggplot2. In particular, they don't get tighter with increasing sample size, and seem to roughly contain the proportion of the data points indicated by the probability values.

References
https://en.wikipedia.org/wiki/Prediction_interval
tidyverse/ggplot2#2776

CRAN warning update

Hi @nicholasehamilton ,

I've received a warning from CRAN that ggtern will be archived until 5.7.2023.

Are you planning to release a hotfix? I have looked into it and it seems to be caused by the documentation:

checking Rd files ... [3s/5s] WARNING
theme_elements.Rd:21: the condition has length > 1
problem found in ‘theme_elements.Rd’

Developing new stats and geoms

For people trying to develop new stats and geoms- is there any way to override the stripping of unapproved layers?

OR would you recommend just cloning this repository and removing the requirement line in ggtern-build.R (line 32: plot$layers <- strip_unapproved(plot$layers))?

Thanks

Conflict with ggplot

Hi Nicolas,

In fact, this is not an issue of your package, but perhaps, you could give me some advice.

I have create a function that use your package in my one 'private' package.
My package intensively use ggplot2 in many function, so I use

@import ggplot2

to globaly import it.

I first do the same thing with ggtern :

@import ggtern

with consequence that my function that create the ternary plot work perfectly. But other function that use only ggplot2 consequently do not anymore...
I have some

object of type 'closure' is not subsettable

error that I have not if I do not build my function using ggtern in my package.

So, a thing that could I suppose solve the problem is to stop using @import ggtern in my function and to call all the specific ggtern function with "ggtern::".

I have tried to to do so in the following code (sorry its not reproductible, but I can give you my all code if necessary):

  plot.demol <- ggplot() + ggtern::coord_tern() +
    ggtern::geom_segment(data = lim.demolon,
                 ggtern::aes(x = y, y = x, z = z,
                     xend = yend, yend = xend, zend = zend),
                 size = 0.5) +
    geom_text(data = type.sol, ggtern::aes(x = L, y = T, z = R, label = txt),
              size = 2.5, lineheight = 0.75) +
    geom_point(data = granu,
               mapping = ggtern::aes(y = T, x = L, z = R, shape = sect),
               colour = formcoul, fill = formcoul, size = 2) +
    ggtern::scale_T_continuous(name = expression("Argile (< "*2*" µm)")) +
    ggtern::scale_L_continuous(name = expression("Limon ("*2*" à "*20*" µm)")) +
    ggtern::scale_R_continuous(name = expression("Sable (> "*20*" µm)")) +
    ggtern::theme_showarrows() +
    ggtern::theme_arrowlong() +
    ggtern::theme_hidetitles() +
    ggtitle(element_blank()) +
    ggtern::theme(axis.tern.title = element_text(size = 8, face = "bold"),
          axis.tern.text = element_text(size = 7),
          legend.title = element_blank(),
          legend.text = element_text(size = 6),
          legend.background = element_blank(),
          legend.key = element_blank(),
          legend.direction = "horizontal",
          legend.position = c(0.5, 1),
          legend.justification = c(0.5, 0.35),
          plot.margin= ggtern::unit(c(0.05, 0, 0, 0), "null")) +
    scale_shape_manual(values = sect_concerne[[3]],
                       breaks = sect_concerne[[1]])

Infortunately I have the error that come I think from ggplot2 that do not interpret a function:

Error in UseMethod("scale_clone") :
no applicable method for 'scale_clone' applied to an object of class "c('tern_T',
'continuous_ternary', 'scale')"

Could you have any idea to help me about it ?
My apologies if I'm not in the best place to ask my question...

Regards,
Gilles

New version of ggplot2

Hi

We are preparing the next release of ggplot2 and ggtern seems to fail installation when running our reverse dependency tests. The next release is being developed in the v3.3.4-rc branch. Can I get you to have a look and see whether there are any real issues and how long it would take to fix them?

with best wishes
Thomas

[Installation error] object 'coord_transform.cartesian' not found

Hi Nicolas,
I have some trouble with ggtern installation, with the below error message:

install.packages("ggtern") 
Installing package into~/R/i686-pc-linux-gnu-library/3.2’
(aslibis unspecified)
--2016-01-12 15:52:53--
[...]
Error in get(x, envir = ns, inherits = FALSE) : 
  object 'coord_transform.cartesian' not found
Error : unable to load R code in packageggternERROR: lazy loading failed for packageggtern* removing~/R/i686-pc-linux-gnu-library/3.2/ggternWarning in install.packages :
  installation of packageggternhad non-zero exit status

The downloaded source packages are in/tmp/RtmpnwEqnh/downloaded_packages

Here is my sessionInfo():

R version 3.2.3 (2015-12-10)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu 14.04.3 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] ggplot2_2.0.0 shiny_0.12.2  rgpui_0.1-2  

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.3      digest_0.6.9     rgp_0.4-1       
 [4] mime_0.4         plyr_1.8.3       grid_3.2.3      
 [7] R6_2.1.1         xtable_1.8-0     jsonlite_0.9.19 
[10] gtable_0.1.2     magrittr_1.5     scales_0.3.0    
[13] httr_1.0.0       stringi_1.0-1    emoa_0.5-0      
[16] curl_0.9.4       devtools_1.9.1   tools_3.2.3     
[19] stringr_1.0.0    munsell_0.4.2    httpuv_1.3.3    
[22] parallel_3.2.3   colorspace_1.2-6 memoise_0.2.1   
[25] htmltools_0.3  

I'm looking forward to your reply.
Thank you for this awesome package.
Regards,
Yassine

geom_density_tern() uses deprecated NULL-with-attributes

As of R 3.4.0, NULL variables can no longer have attributes.

From the NEWS:

structure(NULL, ..) is now deprecated as you cannot set attributes on NULL.

This means that using geom_density_tern() results in lots of errors.

To reproduce, run example(geom_density_tern) and look at the warnings().

Can't see plot grids

Hi, I am using the package, and it is really useful. However, even with some basic examples, I can't seem to be able to get grids, no matter the theme I use. A colleague of mine tried and also obtained the same result, the plots are ok, but the grids are not visible. Any clue on how I can solve this? R version is 4.1.2

Package does not work with latest version of ggplot2

If you update ggplot2 to v2.2.0, ggtern no longer works.
I figure this is because the new_panel function is no longer available in ggplot2; the API changed. I'd be happy to look into this myself and make a PR, if that is an option.

Broken after lastest update

I updated all of my packages (and R to 3.5.1) which seems to have broken ggtern. I get the following error with both the CRAN and development version when trying to run the examples.

Error in f(..., self = self) : unused argument (plot$coordinates)

Error for installing ggtern

Hi Nicholas!
I'm having some problems with installing the ggtern package. This is the error that I'm receiving:

Warning: package 'ggplot2' was built under R version 3.2.5
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : 
  there is no package called 'stringr'
ERROR: lazy loading failed for package 'ggtern'

I've tried downloading the package stringr, but am getting a non-zero exit status. I've also tried installing the DBI package, as I've read from other posts online that it could potentially help, but I'm still not having much luck with it. Any ideas?
I'm fairly new to Rstudio, so I'm not sure if I'm missing something painfully obvious. Thanks so much in advance!

ggtern does not work with latest version of ggplot2

If you update ggplot2 to v2.2.0, ggtern no longer works.
I figure this is because the new_panel function is no longer available in ggplot2; the API changed. I'd be happy to look into this myself and make a PR, if that is an option.

Using ggtern in a package

Nicolas,

I'm do not understand an error I have when using ggtern in a function of the package I built.
In my DESCRIPTION file, I'm calling ggtern in the Imports.
In my function, with roxygen, I'm calling @import ggtern to.
But if I only load my package, without loading ggtern in the global environnement through library(ggtern) I have the following error:

Error in UseMethod("scale_clone") : 
  no applicable method for 'scale_clone' applied to an object of class "c('tern_T', 'continuous_ternary', 'scale')"

Could you have any idea to help me about it ?

Thanks !
Gilles

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.