# Call Rose Plot from Function, Customize Axes Etc.?

I have about 5 dimensions of data* that I need to display, and I've decided to do it with a series of rose plots tiled across an image. My most basic question here is, is it possible to call the rose plot creation from a Macro or Function, setting the various waves and options from that Macro/Function, and then also doing a few tweaks on the resultant polar graph that I normally have to do on the Polar Graphs panel? A second part of this question is, is it possible to to create and lay out a bunch of rose plots in a single window (e.g., normally I would create a graph with several sets of axes spanning different % of the window)?

More details on the actual problem in case someone has a better idea for the data display or needs/wants the context: I have crater data for about two million craters on the moon, and I want to illustrate ellipticity trends (ellipticity = major/minor axis). The dimensions of the data are: latitude, longitude, diameter from a circle fit, ellipticity, and tilt angle (ellipse major axis angle relative to east-west). The way I think these data could be displayed is to first do a simple binning of the lunar surface, such as 30°x30° bins, such that there would be 72 different plots. Then, within each region, separate the data into diameter ranges, such as 10-20km, 20-40km, 40-80km (crater data tend to follow a power-law in number per diameter). Within each bin, within each diameter range, create a rose plot, where angle is ellipse tilt angle, and speed is ellipticity. In this example, there would be 72 regions of the moon, and 3 plots per region (the three diameter ranges). Hence, 216 rose plots that I'd otherwise need to create and adjust manually and copy and paste into Illustrator and arrange manually.
I've figured out the first of my three questions: I made a copy of the RosePlot.ipf file and modified the function call RosePlot() to accept input, and I got rid of the dialog box and other stuff so I can no call it from a function.

Still two left: How to customize the polar plot in a function/macro with options that I normally have to set in the Polar Graphs window, and any way to do an automatic layout with multiple rose plots tiled across where I set where they are and how large they are compared to the layout.
For your second question. The strategy I use for this is to generate the graphs (in your case Rose Plots) using the /HIDE flag, giving each a name programmatically, then add to a layout. In Igor 7 you can do multi page layouts, since I'm guessing 216 won't fit on one page. You can specify which page to add them and then you can then cycle through the pages and tile them according to the final size you want the plots. You can then cycle though all the graph windows applying any formatting you like (or do this before adding to layout). Something like:

// plotNum is the ith graph with name plotName. In a loop do:
Variable pgNum = floor(plotNum / 6) + 1 // 1st page is pg 1
AppendLayoutObject/W=summaryLayout/PAGE=(pgnum) graph \$plotName

Function TileLayout(nFiles,plotNum)
Variable nFiles,plotNum
Variable pgMax = floor((nFiles -1) / plotNum) + 1

Variable i

DoWindow /F summaryLayout
for(i = 1; i < pgMax + 1; i += 1)
LayoutPageAction/W=summaryLayout page=(i)
Execute /Q "Tile"
endfor
SavePICT/PGR=(1,-1)/E=-2 as "summary.pdf"
End
Okay, I figured out the customization by looking through the code for polar graphing. Some things I can set and call the update graph, and some WaveMetrics has some commands to call to do it. For the default named "PolarGraph0":

DoWindow/F PolarGraph0
root:Packages:WMPolarGraphs:PolarGraph0:majorAngleInc = 30
root:Packages:WMPolarGraphs:PolarGraph0:doMinorAngleTicks = 0
root:Packages:WMPolarGraphs:PolarGraph0:angleApproxTicks = 5
root:Packages:WMPolarGraphs:PolarGraph0:tickLabelOpaque = 0
root:Packages:WMPolarGraphs:PolarGraph0:angleTicksLocation = "Inside"
WMPolarUpdateButtonProc("PolarGraph0")
WMPolarSetAngleDirection("PolarGraph0", "CCW");WMPolarSetZeroAngleWhere("PolarGraph0","right");WMPolarSetAngleRange("PolarGraph0", 0, 180)

I also have my own WM_GetDistinctColor to set the colors and I created a "Tweaker" macro which sets the legend, line styles, font size, and size of the graph.

Now working on sjr15's suggestions for layout.
And, many hours later, I figured out the layout. It's not quite as simple as suggested since I need to tile with slight overlaps for some things and larger buffers for others. Needs a lot of tweaks, but I got the basics down.
JimProuty wrote:
We'd love to use this in our gallery here:

https://www.wavemetrics.com/products/igorpro/gallery/user.htm

We could adapt your posting to provide the description, or maybe you'd like to send one to support@wavemetrics.com. We'll credit you and your research if you provide details.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.

Thanks for your interest, Jim. I'm still working on this and would want to send you a more final version. This is also going in a research paper for peer-review, and the reviewer(s) may request changes. If I send it to you in the near future, would you be able to post a revision IF it needs to be revised?
astrostu wrote:
Thanks for your interest, Jim. I'm still working on this and would want to send you a more final version. This is also going in a research paper for peer-review, and the reviewer(s) may request changes. If I send it to you in the near future, would you be able to post a revision IF it needs to be revised?

We're always available to update gallery submissions; send and re-send it when you're comfortable doing so.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.