{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/3984cd736dbbb0a76fcdb7c5aa087f45?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"3984cd736dbbb0a76fcdb7c5aa087f45","url":"https://api.github.com/users/wch","login":"wch","id":86978},"milestone":null,"labels":[],"updated_at":"2011-11-04T05:33:36Z","assignee":null,"closed_at":null,"comments":1,"url":"https://api.github.com/repos/hadley/ggplot2/issues/258","body":"This might be two bugs.\r\n\r\nI was trying to add line segments to a graph with log scales, but instead of putting it at my specified coordinates, it puts them at 10 to the power of the coordinate. For example, if I specify x=1 and xend=3, it draws a line from x=10 to xend=1000.\r\n\r\nHere's an example using a dataset from the MASS library:\r\n\r\n```\r\nlibrary(MASS)\r\n\r\n# Diagonal line\r\nggplot(Animals, aes(x=body, y=brain)) +\r\n    geom_point() +\r\n    geom_segment(x=1, xend=3, y=1, yend=3) +\r\n    scale_x_log10() + scale_y_log10()\r\n```\r\n\r\nIt also seems to me that the expected behavior of geom_segment in this case isn't clearly specified: should it be visually straight (useful for annotations), or should it be \"numerically straight\" and thus visually curved?\r\n\r\n\r\nPotential bug 2: I tried creating my own minimal data set to illustrate the problem, but I can't even get it to draw the line segment! I tried figuring out what the difference is between this data set and the one above, but I made no progress.\r\n\r\n```\r\nset.seed(101)\r\ndat <- data.frame(x=10^rnorm(20,2,1), y=10^rnorm(20,2,1))\r\n\r\n# Works\r\nggplot(dat, aes(x=x, y=y)) +\r\n    geom_point() + \r\n    scale_x_log10() +\r\n    scale_y_log10() \r\n\r\n# Doesn't work after adding segment\r\nggplot(dat, aes(x=x, y=y)) +\r\n    geom_point() + \r\n    geom_segment(x=1, xend=3, y=1, yend=3) +\r\n    scale_x_log10() +\r\n    scale_y_log10() \r\n\r\n#Error in data.frame(evaled, PANEL = data$PANEL) : \r\n#  arguments imply differing number of rows: 0, 20\r\n```\r\n\r\n","html_url":"https://github.com/hadley/ggplot2/issues/258","title":"geom_segment doesn't work properly with log scales","number":258,"id":2140842,"created_at":"2011-11-04T05:05:25Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/3984cd736dbbb0a76fcdb7c5aa087f45?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"3984cd736dbbb0a76fcdb7c5aa087f45","url":"https://api.github.com/users/wch","login":"wch","id":86978},"updated_at":"2011-11-04T05:33:36Z","url":"https://api.github.com/repos/hadley/ggplot2/issues/comments/2627448","body":"Oddly, if I put the coordinates in a data frame, give that data frame to geom_segment, and use aes() to get the coordinates, it uses the correct numerical coordinates.\r\n\r\n```\r\nmyline <- data.frame(x=1, xend=100, y=1, yend=10)\r\n\r\nggplot(Animals, aes(x=body, y=brain)) +\r\n    geom_point() +\r\n    geom_segment(x=1, xend=3, y=1, yend=3) +\r\n    geom_segment(data=myline, aes(x=x, xend=xend, y=y, yend=yend), colour=\"blue\") +\r\n    scale_x_log10() + scale_y_log10()\r\n```\r\n\r\nThe line is straight in visual space, which suits my purposes, but this might be undesirable in some cases.","id":2627448,"created_at":"2011-11-04T05:33:36Z"}}