polar-coordinates

matplotlib combine polar and cartesian gridded data

一曲冷凌霜 提交于 2019-12-05 10:44:12
How do I combine gridded polar and Cartesian data on a plot? It is important to note that axes origins and scales have to match. In my application, I want to combine weather radar data ( polar ) with elevation data (Cartesian). This is the starting point : Thinking about this for a while, the answer is you need to translate you radial data into Cartesian space: import copy # fake....err, simulated... data # elevation X, Y = np.meshgrid(np.linspace(-50, 50, 1024), np.linspace(-50, 50, 1024)) elv = np.sin(np.pi * X / 50) * np.cos(2*np.pi * Y / 50) # radar R, theta = np.meshgrid(np.linspace(0, 35

Changing axis options for Polar Plots in Matplotlib/Python

*爱你&永不变心* 提交于 2019-12-05 09:14:16
I have a problem changing my axis labels in Matplotlib. I want to change the radial axis options in my Polar Plot. Basically, I'm computing the distortion of a cylinder, which is nothing but how much the radius deviates from the original (perfectly circular) cylinder. Some of the distortion values are negative, while some are positive due to tensile and compressive forces. I'm looking for a way to represent this in cylindrical coordinates graphically, so I thought that a polar plot was my best bet. Excel gives me a 'radar chart' option which is flexible enough to let me specify minimum and

convert an image from Cartesian to Polar

邮差的信 提交于 2019-12-05 07:12:21
I'm trying to convert an image with many circles with the same center, from Cartesian to Polar (so that the new image will be the circles but lines instead of the circles, see the image below), and that's working out just fine using the following code: [r, c] = size(img); r=floor(r/2); c=floor(c/2); [X, Y] = meshgrid(-c:c-1,-r:r-1); [theta, rho] = cart2pol(X, Y); subplot(221), imshow(img), axis on; hold on; subplot(221), plot(xCenter,yCenter, 'r+'); subplot(222), warp(theta, rho, zeros(size(theta)), img); view(2), axis square; The problem is, I don't understand why does it even work?

How to clip polar plot in pylab/pyplot

岁酱吖の 提交于 2019-12-05 05:05:45
I have a polar plot where theta varies from 0 to pi/2, so the whole plot lies in the first quater, like this: %pylab inline X=linspace(0,pi/2) polar(X,cos(6*X)**2) (source: schurov.com ) Is it possible by means of pyplot or matplotlib to clip the polar plot so that only first quater is shown (and therefore no space is wasted)? I want a picture like this (but properly scaled): (source: schurov.com ) I'd like to do it by means of pyplot because I have several images like this and want to arrange them into a big figure (with subplot). Is it possible? I recommend not using the polar plot but

How to wrap around the polar coordinate limits in ggplot2?

我怕爱的太早我们不能终老 提交于 2019-12-05 02:47:50
I have a circular space where angles 0 and 360 are equivalent. I want to plot rectangles in this space such that rectangles can cross this value. However, I am having trouble with ggplot2. base <- ggplot() + scale_x_continuous(breaks = seq(45, 360, 45), limits = c(0, 360)) + scale_y_continuous(breaks = seq(0, 1, 0.2), limits = c(0, 1)) + coord_polar(theta = "x", start = 1.5 * pi, direction = -1) 1. Attempt to plot with values exceeding xlim: base + geom_rect(aes(xmin = 340, xmax = 380, ymin = 0.4, ymax = 0.6), color = "darkblue", fill = "steelblue") #> Warning message: #> Removed 1 rows

Fix interpolated polar contour plot function to works with current R and (possibly) use ggplot

有些话、适合烂在心里 提交于 2019-12-04 20:02:23
The question R interpolated polar contour plot shows an excellent way to produce interpolated polar plots in R. I include the very slightly modified version I'm using: PolarImageInterpolate <- function( ### Plotting data (in cartesian) - will be converted to polar space. x, y, z, ### Plot component flags contours=TRUE, # Add contours to the plotted surface legend=TRUE, # Plot a surface data legend? axes=TRUE, # Plot axes? points=TRUE, # Plot individual data points extrapolate=FALSE, # Should we extrapolate outside data points? ### Data splitting params for color scale and contours col_breaks

Stereographic Sun Diagram matplotlib polar plot python

有些话、适合烂在心里 提交于 2019-12-04 10:59:47
I am trying to create a simple stereographic sun path diagram similar to these: http://wiki.naturalfrequency.com/wiki/Sun-Path_Diagram I am able to rotate a polar plot and set the scale to 90. How do I go about reversing the y-axis? Currently the axis goes from 0>90, how do I reverse the axis to 90>0 to represent the azimuth? I have tried: ax.invert_yaxis() ax.yaxis_inverted() Further, how would I go about creating a stereographic projection as opposed to a equidistant? My code: import matplotlib.pylab as plt testFig = plt.figure(1, figsize=(8,8)) rect = [0.1,0.1,0.8,0.8] testAx = testFig.add

Double integral in cartesian coordinate instead of (R,Theta)

限于喜欢 提交于 2019-12-04 10:02:12
my previous question ( Integral of Intensity function in python ) you can see the diffraction model in image below: I want to calculate integral of intensity in each pixel (square), so I can't use R and Theta as variable. How can I do this in X-Y coordinate. Our function: instead of sin(theta) we can use: sintheta= (np.sqrt((x)**2 + (y)**2)/(np.sqrt((x)**2 + (y)**2 + d**2))) Other constants: lamb=550*10**(-9) k=2.0*np.pi/lamb a=5.5*2.54*10**(-2) d=2.8 when you plot function, the result is something like this:(The image above is a view from top) the method in previous topic: calculate integrate

Circular Stacked Bar Plot in R

旧街凉风 提交于 2019-12-04 09:35:01
问题 I came across this awesome and relatively straightforward package seen here that can create beautiful normalized stacked bar plots in polar form like so. I hope to create a similar plot but that is not normalized and can instead have raw values as input. On his blog, he indicates that someone made a un-normalized version of his code that can produce plots like this: This is almost exactly what I need but I can't figure out how to stack the bars to produce a graph like so (sorry for quality):

Move radial tick labels on a polar plot in matplotlib

落爺英雄遲暮 提交于 2019-12-04 09:10:01
From matplotlib examples : import numpy as np import seaborn as sbs import matplotlib.pyplot as plt r = np.arange(0, 3.0, 0.01) theta = 2 * np.pi * r ax = plt.subplot(111, polar=True) ax.plot(theta, r, color='r', linewidth=3) ax.set_rmax(2.0) ax.grid(True) ax.set_title("A line plot on a polar axis", va='bottom') plt.show() How to move the radial tick labels (0.5, 1.0, 1.5, 2.0) to a different angle, say 120 deg? With version 1.4 or later, you can use "set_rlabel_position". e.g. to place the radial ticks a long a line at, say, 135 degrees: ax.set_rlabel_position(135) The relevant documentation