• [^] # Re: R

    Posté par . En réponse au journal Faire des graphiques à partir de données : comparaison. Évalué à 2.

    Ce commentaire est un aveu d'incompétence : "Je ne suis pas X".

    Pas physicien nucléaire. Dans l'incapacité de générer des données de test après avoir regardé les diverses quantités et relations de la Physique, je me suis fait des données bidons, histoire d'illustrer ggplot2. On y va :

    invisible(sapply(c("ggplot2", "tikzDevice", "gridExtra"), function(xxx) {
     library(xxx, character.only = TRUE)
    }))
    intervals <- seq(-40, 40)
    celerity <- 299792458
    hbar <- 1054571726e-34
    sampleData <- expand.grid(x = intervals, y = intervals)
    fakeQuantumRadius <- hbar * celerity / exp(sin(sampleData$x) * cos(sampleData$y))
    sampleData$z1 <- 2 * fakeQuantumRadius
    sampleData$z2 <- fakeQuantumRadius / 2
    shapeChar <- 20
    lowCol <- "chocolate4"
    highCol <- "yellow"
    fig1 <- ggplot(sampleData, aes(x, y, colour = z1)) +
     geom_point(shape = shapeChar) +
     scale_colour_gradient(low = lowCol, high = highCol, name = "$R = 2R_q$",
     label = seq(from = 0, to = 20, by = 5)) +
     xlab("$\\hbar\\omega / E_B$") +
     ylab("$\\hbar\\omega_{dc} / E_B$") +
     theme(panel.background = element_blank(), legend.position = "top")
    fig2 <- ggplot(sampleData, aes(x, y, colour = z2)) +
     geom_point(shape = shapeChar) +
     scale_colour_gradient(low = lowCol, high = highCol, name = "$R = R_q / 2$",
     label = seq(from = 1, to = 5)) +
     xlab("$\\hbar\\omega / E_B$") +
     theme(panel.background = element_blank(), legend.position = "top",
     axis.title.y = element_blank(), axis.text.y = element_blank())
    tikz("exemple_bidon.tex", standAlone = TRUE, width = 8, height = 5.33)
    grid.arrange(fig1, fig2, ncol = 2)
    dev.off()

    Le fichier exemple_bidon.pdf fait 838.8 kB. Avec ImageMagick :

    convert -density 150 exemple_bidon.pdf -quality 100 exemple_bidon.png

    RienÀVoirAvecLaPysiqueNucléaire

    Pas graphiste. Concernant la rasterisation, je me contente de citer quelques bibliothèques en R qui pourraient t'intéresser même si le langage n'est pas vraiment l'outil adéquat pour faire du Traitement d'Image avancé. Les bibliothèques alors : raster, rasterVis, adehabitatMA, Cairo, readbitmap