?
Solved

polar countour plot

Posted on 2007-09-29
29
Medium Priority
?
1,040 Views
Last Modified: 2010-05-18
i have a large table of values where each row corresponds to a radius and each column corresponds to an angle from 0 to 2pi. i'd like to plot this up in a polar coordinate surface graph where each pixel is keystone shaped, but i can't find anything to help me do this. any suggestions? preferably free ones.
0
Comment
Question by:craskin
  • 11
  • 10
  • 3
  • +2
28 Comments
 
LVL 2

Expert Comment

by:niewiap
ID: 19985278
What do you mean by pixel being keystone-shaped?
I suppose just converting the polar coordinates to x/y coordinates and plotting it on a scatter graph is not what you want. If it is then the formulas for conversion would be (assuming your angle is in column A, and your value in column b):
=B1*cos(A1*360/(2*PI()))     for X
=B1*sin(A1*360/(2*PI()))    for Y
0
 
LVL 2

Expert Comment

by:niewiap
ID: 19985287
Here's a website that shows a bunch of useful tips and tricks. There is a chart there that looks like what you're looking for:
http://www.andypope.info/charts.htm
Good luck,
Pawel
0
 
LVL 12

Author Comment

by:craskin
ID: 19985994
none of those charts are polar contour plots. what i have is something like this:

5 5 5 4 5 5 5
4 4 4 3 4 4 4
3 3 3 2 3 3 3

the columns are the theta coordinate (in this case, pi/3 intervals) and the rows are the r coordinate, 0 to 2. the pixels in the contour will be keystone shaped because the pi coord is fixed, so at each r, you can imagine breaking up a pi slice into lengthwise pieces.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Expert Comment

by:niewiap
ID: 19986286
I would like to help, but I still don't understand what you mean. What are the numbers in the table that you gave above (the one with 5s, 4s, 3s and 2s) if both the radius and the angle is fixed (determined by rows and columns, respectively)? Maybe you could hand-draw what your graph should look like or maybe find an image on the Net that corresponds to your desired outcome and upload it to ee-stuff.com? What do you mean by pixel? The definition of a pixel I am aware of is "the smallest point visible on the screen" and it is always square.

Pawel
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 19986464
This is what I understand from your explanation.

https://filedb.experts-exchange.com/incoming/ee-stuff/4867-PolarContour.zip

If you change the Pi-Interval and/or the R-values you shall have to rerun the macro.

Saqib
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19986709
Saqib,

I think a better description of your chart would be a 'cobweb' chart.

Patrick
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19986722
craskin,

Can I suggest that if you have not yet got the answer you're looking for, you draw out the chart you are wanting on a piece of paper, using the coordinates you have given, scan it, save it as a bitmap (.bmp) file and upload the file for us all to see. You will find free file upload services at these sites:

http://yourfilehost.com
http://storenow.net/
http://www.rapidupload.com/
http://rapidshare.de 
http://briefcase.yahoo.com
http://geocities.yahoo.com
http://yousendit.com
http://www.ee-stuff.com

Important: Remember to copy the  link before you leave their webpage and then quote it here.

Or

If you upload the workbook to www.ee-stuff.com you will need to do the following:

1. Zip the file
2. Login with the same details as for Experts Exchange
3. Select the Expert tab, and choose the Upload a new file link
4. Enter the question number. From a URL extract question number. For example if the URL is:

experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_22753995.html

then enter the question number as  - 22753995
5. Browse to your *zipped* file, enter a comment of some sort (it doesn't matter what) and press Upload
6. You will see a page with two links to the file - copy the second one and post it here. If there are no links, then the file failed to upload.

Patrick
0
 
LVL 12

Author Comment

by:craskin
ID: 19987909
saqib's excel sheet looks like it might be on the right track, but i can't tell what it's doing. anyway, i'm looking for something like this:

http://www.ncl.ucar.edu/Applications/Images/polar_8_lg.png

to be produced from a flat table of data like saqib's excel sheet. i can reorder the data any way i'd like since it's coming out of a vb program i wrote, so that's not a problem. i would rather not convert to x and y coords, though, because like i've said, the contour pixels are not square, and saqib's graph is more accurate to what the shape of the pixels is.
0
 
LVL 12

Author Comment

by:craskin
ID: 19987946
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19988305
Neither of those pictures gets even close to your description of 'contour will be keystone shaped' - most confusing. Perhaps you'd like to explain again.
0
 
LVL 12

Author Comment

by:craskin
ID: 19988670
the elements of this grid are keystone shaped.

http://www.intmath.com/Plane-analytic-geometry/polar-mt.gif
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19989395
That's clear - thanks
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19990276
craskin,

I believe I understand what you are wanting to do. It is not hard to create a grid but as Excel does not allow only a segment of a circle to be drawn it is not possible to fill only a segment (keystone shaped) with a colour. If you want just a line superimposed on top of the grid then that is certainly possible.

Here's a file with a grid (not yet completed) which might be a starting point. Let me know whether it's the way you want to go and if just a line plot on top would do what's wanted:

http://www.yourfilehost.com/media.php?cat=other&file=circles_02.xls

The grid is created with by a macro (not in that file).

Patrick
0
 
LVL 12

Author Comment

by:craskin
ID: 19991752
it doesn't matter if the gridlines are visible, it only matters that converting to x,y will give the wrong result.
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19991944
I still have no idea as to what is the answer to my question. It was:

Let me know whether it's the way you want to go and if just a line plot on top would do what's wanted.
0
 
LVL 12

Author Comment

by:craskin
ID: 19992020
a line plot won't really work. i'm modeling star formation in a galaxy and the contour plot is supposed to show surface brightness.
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19992076
I'm close to giving up as the feedback is not enough to make progress. However here's a radar chart of your data:

http://www.yourfilehost.com/media.php?cat=other&file=craskin_01.xls
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19992096
>a line plot won't really work.

Understood. I think you should be investigating totally different software to achieve what you want.
0
 
LVL 12

Author Comment

by:craskin
ID: 19992162
this question was cross-posted in excel and vb.net. i thought there might've been a way to do this with an excel macro, but it looks as though the biggest hurdle was just getting people to understand what a polar contour plot is. if a radar plot or a line plot on a circular grid is all that can be accomplished with excel, then yes, i'll need to use something else, like the GDI+ in vb.net.
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19992200
craskin,

As I suggested yesterday, if you had taken a little time to draw by hand an example with data, scanned and uploaded the file it would have saved you and others a lot of head-scratching.

Good luck in your search for suitable software to do what you want.

Patrick
0
 
LVL 45

Expert Comment

by:patrickab
ID: 19992342
One final shot with a donut chart:

http://www.yourfilehost.com/media.php?cat=other&file=craskin_02.xls

It does at least have keystone shaped segments.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 19992452
Craskin, Can you post input data for one of the above-posted diagrams? Those diagrams are doable with input data.

VBA can do wonders if used appropriately.

Saqib
0
 
LVL 12

Author Comment

by:craskin
ID: 19992480
that just increases the angular width of the segments by the amount in the cell. the data i have is intensity as a function of (r,theta). the intensity can be thought of as the value of the z coord in cylindrical coordinates so it would create a surface, but what i need is a contour plot. i did a search and found this software that does it with functions, but not tabular data.

http://topangasoftware.com/topanga/Default.aspx
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 19992578
Can you throw in some values please? Possibly part of your table? It is going to be much difficult for me to generate some.

Saqib
0
 
LVL 12

Author Comment

by:craskin
ID: 19993571
have a look at this csv file. it's the output of one of my simulations.

http://www.orbitfiles.com/download/id1996819589
0
 
LVL 12

Author Comment

by:craskin
ID: 19994319
and this is what happens if i convert to x,y coords.

http://www.orbitfiles.com/download/id1997121227

you'll notice a bunch of zeros in radial lines between the cells where there's data. those zeros really shouldn't be there because the data in actuality extends into those cells as well, but a simple conversion to x,y doesn't do that.
0
 
LVL 12

Author Comment

by:craskin
ID: 20026042
i figured out how to do this in vb. i just needed to interpolate from the r,theta to x,y rather than simply converting. here's my code for my own and anyone else's reference.

        Dim L As Integer = Math.Truncate(dt.Rows.Count / Math.Sqrt(2))
        Dim R As Integer = dt.Rows.Count

        Dim dtp As New DataTable
        For x As Integer = -R To R
            dtp.Columns.Add("x=" & x, System.Type.GetType("System.Single"))
        Next

        For y As Integer = -R To R
            Dim newRow As DataRow = dtp.NewRow
            For x As Integer = -R To R
                If x <> 0 And Math.Sqrt(x ^ 2 + y ^ 2) < R Then
                    newRow.Item("x=" & x) = dt.Rows(CInt(Math.Truncate(Math.Sqrt(x ^ 2 + y ^ 2)))).Item(CInt(Math.Truncate(2 * Math.PI / R * Math.Atan(y / x))))
                Else
                    newRow.Item("x=" & x) = 0
                End If
            Next
            dtp.Rows.Add(newRow)
        Next
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 20237772
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question