Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8468301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:53:46+00:00 2026-06-10T15:53:46+00:00

I was wondering whether it is possible to get the transformed data in ggplot2

  • 0

I was wondering whether it is possible to get the transformed data in ggplot2 graphs? In particular, I am interested in getting the coordinates and size of points in dot plots to use them in another plotting library (d3.js). How can I extract that information?

Here is the plot:

g=ggplot(data.frame(x=rnorm(100)), aes(x = x)) + geom_dotplot()

Now I can get the original data using g$data but I want the transformed data (coordinates of the points in the plot).

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:53:47+00:00Added an answer on June 10, 2026 at 3:53 pm

    Use ggplot_build and then extract the data. Try this:

    gg <- ggplot_build(g)
    

    The resulting object is a list, with the first element containing the data you’re after:

    str(gg, max.level=1)
    List of 3
     $ data :List of 1
     $ panel:List of 5
      ..- attr(*, "class")= chr "panel"
     $ plot :List of 8
      ..- attr(*, "class")= chr "ggplot"
    

    This is what it looks like:

    head(gg$data[[1]])
      y         x  binwidth count ncount     width PANEL group countidx stackpos      xmin      xmax ymin ymax
    1 0 -2.070496 0.1356025     1  0.125 0.1356025     1     1        1      0.5 -2.138297 -2.002695    0    1
    2 0 -1.781799 0.1356025     2  0.250 0.1356025     1     1        1      0.5 -1.849600 -1.713998    0    1
    3 0 -1.781799 0.1356025     2  0.250 0.1356025     1     1        2      1.5 -1.849600 -1.713998    0    1
    4 0 -1.619960 0.1356025     1  0.125 0.1356025     1     1        1      0.5 -1.687761 -1.552159    0    1
    5 0 -1.403223 0.1356025     6  0.750 0.1356025     1     1        1      0.5 -1.471024 -1.335422    0    1
    6 0 -1.403223 0.1356025     6  0.750 0.1356025     1     1        2      1.5 -1.471024 -1.335422    0    1
    

    PS. AFAIK, this feature only became available in ggplot2 version 0.9.0

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering whether it's possible to get list of all applications listening to
Hi Guys [and girls] :) Just wondering whether it's possible to get the absolute
I was wondering whether it is possible to limit the number of characters we
I am wondering whether it is possible to make dynamic variables in Java. In
I was wondering whether it was possible for projects in Eclipse to have multiple
This is a very general question: I was wondering whether it is possible to
Possible Duplicate: Android ImageButton with a selected state? I was wondering whether there is
I am wondering if it is possible to detect whether the user exits the
Just wondering whether anyone knows how to get blogger labels into alt tags in
I am just wondering whether it is possible to sort by 'combined columns' now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.