4

I know the question was already asked, but i couldn't solve my problem. I get a graph unreadale when i choose the text argument for my graph and when i choose the identify argument it's not better.enter image description here

This is what i get whith this script :

VehiculeFunction <- function(data, gamme, absciss, ordinate, label, xlim, ylim){
  my.data <- data[data$GAMME == gamme,]
  ma.col = rgb(red = 0.1,blue = 1,green = 0.1, alpha = 0.2)
  X <- my.data[[absciss]] 
  Y <- my.data[[ordinate]] 
  Z <- my.data[[label]]
  X11()
  plot(X, Y, pch=20, las = 1, col = ma.col, xlab = absciss, ylab = ordinate, xlim = xlim, ylim = ylim)
  text(X, Y, labels = Z, pos=3, cex = 0.7, col = ma.col)
  #identify(X, Y, labels = Z, cex = 0.7)
}

VehiculeFunction(data.vehicule, "I", "GMF.24", "Cout.24", "NITG", c(0,0.2), c(0,0.2)) 

I used iplot, but i couldn't add the identify and text argument... I never used ggplot, so i don't know if it's could solve my problem.

Thank you for help.

  • Do you expect the labels to be legible if you label all of those points? Or are labels only shown on mouseover? (Also, I'm not sure how the question title reflects the question content) – jbaums Jun 03 '14 at 14:01
  • I know this is illegible for this scale but if i could zoom it will be possible to see all the points i want ? – user3527451 Jun 03 '14 at 14:04
  • Even with the identify argument, it's illigible if i had too many points. What i want is to adjust xlim and ylim with the mouse ? is-it possible with a package ? – user3527451 Jun 03 '14 at 14:13
  • Maybe you wanna export the plot into a really large png or svg – lukeA Jun 03 '14 at 20:18
  • I don't thik it's going to work, i have around 1500 dots after filtrate it! – user3527451 Jun 05 '14 at 08:22
  • googleVis could do what i want ? if someone used it ? – user3527451 Jun 05 '14 at 08:22

1 Answers1

2

A tool that might help with is facet_zoom from the ggforce package.

I don't have access to the data.vehicule object, so I will use the mtcars data.frame for an example of zooming in on a region of the graphic.

library(ggplot2)
library(ggforce)
library(dplyr)

mtcars2 <- mtcars %>% mutate(nm = rownames(mtcars))

ggplot(mtcars2) +
  aes(x = wt, y = mpg, label = nm) +
  geom_text()

last_plot() +
  theme_bw() +
  facet_zoom(x = dplyr::between(wt, 3, 4),
             y = dplyr::between(mpg, 12, 17))

enter image description here

Peter
  • 7,460
  • 2
  • 47
  • 68