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 8395725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:22:24+00:00 2026-06-09T20:22:24+00:00

I am a graphics programmer from the GKS days trying to use R graphics.

  • 0

I am a graphics programmer from the GKS days trying to use R graphics. I have two questions that relate to transformations in R:

  1. I was wondering if there is an equivalent for building a viewing pipeline in R where one could map a window in world coordinates [wc] to a viewport in device coordinates [dc]. For example I could specify a transofrmation t which maps a window of (wcxmin, wcxmax, wcymin, wcymax) to (vpxmin, vpxmax, vpymin, vpymax) where wc is (1000, -50, 40, 90) and vp is (0, 800, 0, 600). The objective being that all graphics calculations are done in wc but the graphics engine renders it in dc. In this case it would scale the coordinates appropriately and also flip the x-axis as wcxmin > wcxmax.

  2. Is there an equivalent of graphics segments which could then be transformed [sclae, shift, rotate, and possibly shear] via a transformation matrix.

I am sure I am missing something very basic in R graphics. I could successfully build such transforms in SVG without any issues. I have been looking at packages like grid, lattice, ggplot2 but have not been able to make much progress.

Thanks.

Here’s some sample code for something I am trying to do:

distn<-rnorm(100)
distw<-rweibull(100, shape=2)
dret<-stack(list(norm=distn, weib=distw))
n<-0
for (idx in levels(dret$ind)) {
        pct<-dret[dret$ind == idx,c('values')]
        # scale and shift the data
        pct<-(pct-min(pct))/(max(pct) - min(pct))
        if (n == 0) {
                # top left
                par(fig=c(0,0.5,0.5,1))
                limx<-c(0,1)
        } else  {
                # bottom right
                par(fig=c(0.5,1,0,0.5), new=TRUE)
                limx<-c(1,0)
        }
        fp<-density(pct)
        sfx<-fp$x
        sfy<-(fp$y-min(fp$y))/(max(fp$y)-min(fp$y))
        sortpct<-sort(pct)
        ecdfpct<-(1:length(sortpct))/length(sortpct)
        plot(sortpct, ecdfpct, xlim=limx, type="l", col="green")
        lines(sfx, sfy, xlim=limx, type="l", col="red")
        n<-n+1
}

I would like to rotate the figure in the bottom right quadrant by -90 degrees.

  • 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-09T20:22:25+00:00Added an answer on June 9, 2026 at 8:22 pm

    The ‘grid’ package does that all the time. The viewports are represented as [0, 1] in both X and Y directions(and sometimes Z) and the functions convertX and convertY are called to move from user-coordinates to grid-coordinates. Type help(grid) for a full list of facilities. A third dimension is also represented when using wireframe or levelplot. Transformations via homogeneous coordinates are accomplished via 4 x 4 matrices stored as an item accessed as current.transform( current.viewport()). You can get more detail regarding how those transformation matrices are handled in R by looking at the code in trans3d. I see that @nograpes has already pointed you to the high-level rotation facility in the grid::pushViewport function.

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

Sidebar

Related Questions

Using core graphics , I am trying to draw a line, in that when
I have a graphics editing cocoa app on Mac OSX that produces 32 by
I have a Graphics object of JPanel and that is working fine: import java.awt.Color;
These days there are two main hardware environments for parallel programming, one is multi-threading
I have made two attempts in trying to access a website with authentication, and
I have some existing code in C# that I'm trying to move to an
I have a noobish question for any graphics programmer. I am confused how some
Is there a software that would enable graphic designer to use JSF GUI components
I have a simple graphics application which draws some stuff on the screen. Before,
I took a Computer Graphics exam a couple of days ago which had extra

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.