polar-coordinates

examples to convert image to polar coordinates do it explicitly - want a slick matrix method

爱⌒轻易说出口 提交于 2019-11-28 22:07:55
I am trying to convert an image from cartesian to polar coordinates. I know how to do it explicitly using for loops, but I am looking for something more compact. I want to do something like: [x y] = size(CartImage); minr = floor(min(x,y)/2); r = linspace(0,minr,minr); phi = linspace(0,2*pi,minr); [r, phi] = ndgrid(r,phi); PolarImage = CartImage(floor(r.*cos(phi)) + minr, floor(r.sin(phi)) + minr); But this obviously doesn't work. Basically I want to be able to index the CartImage on a grid. The polar image would then be defined on the grid. given a matrix M (just a 2d Gaussian for this example

r - ggplot2: connecting points in polar coordinates with a straight line

不想你离开。 提交于 2019-11-28 13:54:39
I have a plot in polar coordinates. I used geom_path to connect the points, but I'd like the paths to be straight lines. Here's what I have so far: example <- data.frame(c(5,4,3),c(0.9,1.1,0.6)) colnames(example) <- c("r", "theta") myplot <- ggplot(example, aes(r, theta)) + geom_point(size=3.5) + coord_polar(theta="y", start = 3/2*pi, direction=-1) + scale_x_continuous(breaks=seq(0,max(example$r)), lim=c(0, max(example$r))) + scale_y_continuous(breaks=round(seq(0, 2*pi, by=pi/4),2), expand=c(0,0), lim=c(0,2*pi)) + geom_text(aes(label=rownames(example)), size=4.4, hjust=0.5, vjust=-1) + geom

How to use polar axes with Matlab warp?

戏子无情 提交于 2019-11-28 13:14:58
I want to use polaraxes on the warp object on the half circumference of the polar presentation. Code without polaraxes but with warp close all; clear all; clc; % https://stackoverflow.com/a/7586650/54964 load clown; img = ind2rgb(X,map); [h,w,~] = size(img); s = min(h,w)/2; [rho,theta] = meshgrid(linspace(0,s-1,s), linspace(0,pi)); [x,y] = pol2cart(theta, rho); z = zeros(size(x)); f1=figure(); hax=axes('Parent', f1); imagesc(img, 'Parent', hax); box(hax, 'off'); axis(hax, 'off'); set(hax, 'yTickLabel', []); set(hax, 'xTickLabel', []); % for polar presentation set(hax, 'Ticklength', [0 0]); %

Matplotlib - Drawing a smooth circle in a polar plot

萝らか妹 提交于 2019-11-28 11:18:31
I really like the polar plot of matplotlib and would love to keep working with it (since my data points are given in polar coordinates anyway and my environment is circular). However, in the plot, I would like to add circles of given radii at specific points. Usually, I would do: ax = plt.subplot(111) ax.scatter(data) circle = plt.Circle((0,0), 0.5) ax.add_artist(circle) plt.show() However, in polar coordinates, I cannot use circle, since it assumes rectangular coordinates. Ideas I have come up with are: generating an array of points with constant radial coordinate and an angular coordinate in

Polar plot of a function with negative radii using matplotlib

寵の児 提交于 2019-11-28 06:15:49
问题 The following python code should plot r(theta) = theta on the range [-pi/2, pi/2]. import matplotlib.pyplot as plt import numpy theta = numpy.linspace(-numpy.pi / 2, numpy.pi / 2, 64 + 1) r = theta plt.polar(theta, r) plt.savefig('polar.png') This produces the plot: However, I would expect it to produce: The negative values of r(theta) seem to be clipped. How do I make it so that matplotlib plots the negative values of r(theta)? 回答1: The first plot seems correct. It just doesn't show the

Plot a heart in R [duplicate]

 ̄綄美尐妖づ 提交于 2019-11-28 02:52:54
Possible Duplicate: Equation-driven smoothly shaded concentric shapes How could I plot a symmetrical heart in R like I plot a circle (using plotrix) or a rectangle? I'd like code for this so that I could actually do it for my self and to be able to generalize this to similar future needs. I've seen even more elaborate plots than this so it's pretty doable, it's just that I lack the knowledge to do it. This is an example of plotting a "parametric equation", i.e. a pairing of two separate equations for x and y that share a common parameter. You can find many common curves and shapes that can be

How do I limit a gnuplot polar to a 180 degree range?

时光毁灭记忆、已成空白 提交于 2019-11-28 01:26:01
问题 I am attempting to use gnuplot to plot the off axis response of a loudspeaker in the range +/- 90 degrees. I have this working nicely, almost entirely as a result of Creating a microphone polar pattern plot in gnuplot I would like to extend this so it presents the forward" 180 range only however I don't know how to do this & would appreciate some pointers. This is my code so far gnuplot <<EOF set terminal pngcairo size ${WIDTH}/2,${HEIGHT}/2 font ',10' set polar set angle degrees set size

How to rotate tick labels in polar matplotlib plot?

怎甘沉沦 提交于 2019-11-27 22:36:27
I have long identifiers and I would like to make a radial plot where ticks are all at different angles. For example, the first tick on the right at 0 degrees should have a 0 degree angle. The one at the top should be 90 degrees. The one at 270 degrees on the left should be 0 degrees. I want it to look reminiscent of a radial dendrogram. Using matplotlib 2.0.2 and python 3.6.2 Is this possible in matplotlib to rotate individual tick labels or add text labels separately? NOTE: I have updated the plot in response to @ImportanceOfBeingErnest below. Setting ax.set_rticks([]) distorts the plot when

How to change an image from Cartesian to Polar coordinates in Matlab?

会有一股神秘感。 提交于 2019-11-27 14:33:32
I am trying to convert the pixels of an image from x-y coordinate to polar coordinate and I have problem with it, as I want to code the function by myself. Here is the code I did so far: function [ newImage ] = PolarCartRot % read and show the image image= imread('1.jpg'); %%imshow(image); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %change to polar coordinate [x y z]= size(image); r = sqrt(x*x+y*y); theta = atan2(y,x); for i =0:r for j= 0:theta newpixel = [i; j]; newImage(newpixel(1), newpixel(2),:) = image(i,j,:); end end figure; imshow (newImage); Amro It is not

examples to convert image to polar coordinates do it explicitly - want a slick matrix method

会有一股神秘感。 提交于 2019-11-27 14:26:31
问题 I am trying to convert an image from cartesian to polar coordinates. I know how to do it explicitly using for loops, but I am looking for something more compact. I want to do something like: [x y] = size(CartImage); minr = floor(min(x,y)/2); r = linspace(0,minr,minr); phi = linspace(0,2*pi,minr); [r, phi] = ndgrid(r,phi); PolarImage = CartImage(floor(r.*cos(phi)) + minr, floor(r.sin(phi)) + minr); But this obviously doesn't work. Basically I want to be able to index the CartImage on a grid.