polar image plot, how to do it with R?


I cannot find a straightforward way to make a nice image plot in R, but in polar coordinates. I'm basically attempting to find a R equivalent for the 'polarplot3d' function in MATLAB. I've been playing around with ggplot2 package but without much luck. Am I missing a package that contains functionality for what I'm attempting? thanks in advance for any pointers.

Ok, I'm trying to be more clear about what I'm trying to do. Lets say I want to define a polar coordinate grid, increments in the radial direction are 50m and 2.5 degrees in theta. This should look like a dartboard.

My data (r and angle in below code) are correspond to a radial distance measure and an angle. My desired z-value is the counts of a bivariate histogram between r and angle within the increments described above defining the grid.

My data is like the following:

# synthetic data for angle and distance # angle <- rnorm(500,mean=90,sd=15) r <- rnorm(500,mean=700,sd=200) # bivariate histogram # observations <- table(cut(angle,breaks=c(seq(0,360,by=2.5))),cut(r,breaks=c(seq(0,1400,by=50)))) # the 'z' data are in observations for each bin of bivariate histogram # # hot to plot a polar coord image? #


It's <em>very</em> slow to render on my system, but

library(reshape2) library(ggplot2) mm <- melt(counts) ggplot(mm,aes(Var1,Var2,fill=value))+geom_tile()+coord_polar() ggsave("polar1.png")

appears to work.

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/joz6m.png" data-original="https://i.stack.imgur.com/joz6m.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />


I think the following could work. Use mapproject() from the maproj library to transform my xy coordinates acording to a polar projection (or another), Then use as.image() (from fields package) function to build a image object from my new coordiantes and my Z values. Eventually use image.plot().

library("mapproj") xyProj <- mapproject(x, y, projection="conic", parameters=-90) library("fields") im <- as.image(z, x=xyProj) image.plot(im)


  • Show chart in dialog box when a button is pressed
  • Create a query on mysql
  • Changing Node ID with every Setup in Netlogo
  • How can i add an entry to a specific index in a list?
  • Rounded DIV side
  • determine angle between two points on a circle with respect to center
  • What is the encoding type to be set while sending excel as response for download in java rest servic
  • Passing object reference using RMI
  • How to specify the location of R packages in foreach( … , .packages=“pkg”) %dopar%
  • Exceptions in Java. What for do we have more than one checkable and one uncheckable class?
  • valid way to calculate angle between 2 CLLocations?
  • “tkinter.TclError: invalid command name” error after calling root.destroy()
  • Form to perform action and passover the values
  • exponential multiplication algorithm that runs in O(n) time?
  • Getting Coordinates of a Point in a circle
  • C# - Why is Math.Atan(1) != anything near 45
  • How to setCenter mapview with location in google maps sdk for iOS
  • How to get the probabilities of classes in Spark Naive Bayes classifier?
  • python function to set accuracy of float
  • How do you open .txt file containing matrix in Matlab?
  • Easy Way to Get Averages Based on Names in List
  • Getting coordinates of a component in java
  • maven-dependency-plugin ignores outputDirectory configuration
  • how to calculate distance between two points in google maps?
  • Put percent labels next to legend instead of in the slice
  • HABTM associations in Rails : collecting and counting the categories of a model's children
  • object play not found in scala application
  • How to start server for Selenium grid Java Maven setup
  • Allocating a 2D contiguous array within a function
  • Guava how to copy all files from one directory to another
  • Dynamically load css stylesheet and wait for it to load
  • How to detect interior vertices in groups of 2d polygons? (E.g. ZIP Codes to determine a territory)
  • When to use `image` and when to use `Matrix` in Emgu CV?
  • What is the “return” in scheme?
  • Which linear programming package should I use for high numbers of constraints and “warm starts” [clo
  • embed rChart in Markdown
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize