ChartDirector Support Forum Home   Search
Polar Contour Plot
Posted by Gary Hart on Oct-24-2022 10:23
Attachments:
Hi All,

I am hoping that this is possible in ChartDirector, but does anyone know if there is a way of doing polar contour plots in ChartDirector?

As background to what I am asking about, these type of plots are quite useful when analyzing ocean wave data.  They are mostly used to plot wave direction, energy and period in a very descriptive manner.  I currently use the wind rose plots to do wave direction and height plots and these work really well.  I also use 2D contour plots to plot wave energy and period, again really well.  I just cannot figure out what to do to get a combination of the two.

I know that this kind of plot can be done with Matlab and Python/Matplotlib, but I don't use either.  I normally use ChartDirector with Perl and that's what I would like to stick with at the moment.  I have attached a basic example of what I am after.  This example was done with Python and shows frequency instead of period, but it shows what I would like to achieve with ChartDirector.

Thank you for any ideas or pointers that anyone has.

Gary Hart.

Re: Polar Contour Plot
Posted by Peter Kwan on Oct-25-2022 02:53
Hi Gary,

The chart you mentioned is not difficult to do. It can be created as a normal contour chart with only the contour layer visible, and all other things hidden (no axis, grid lines, etc). We can overlay a "ring" shape mask on it to crop out the circular boundary. Finally, we can then overlay an empty polar chart on top for the polar grid lines.

If your data points are in polar coordinates, you can always convert them to cartesian coordinates to plot the contour layer.

From your previous message, it seems you are using ChartDirector 6. For that version, for the mask, we may try to use a donut chart with a white donut (or a donut with the same color as the background). The hole in the donut can be used to crop out the circular shape. (ChartDirector 7 can directly draw a "rectangle with a circular hole" on the contour layer).

I will try to create simple example for you. Please give me a day.

Regards
Peter Kwan

Re: Polar Contour Plot
Posted by Peter Kwan on Oct-25-2022 17:26
Attachments:
Hi Gary,

I managed to create the chart as attached in this post.

First, I create a contour chart with everything transparent except the contour layer. Then I use it as the background color of a polar chart plot area. Finally, I use a third chart to hold the polar chart and the color axis.

For your information, in ChartDirector 6, to use a chart as the background color of a shape, we need to save the chart as an image file first. In ChartDirector 7, this is not necessary. (The code I attached is based on ChartDirector 6.)

If what you need are just the circular grid but does not mind that the contour region is rectangular, you may also simply draw some circles and straight lines on the XY contour chart as the polar grid lines. This should be simpler and can be done with a single chart object.

Best Regards
Peter Kwan
 contour2.pl3.80 Kb

Re: Polar Contour Plot
Posted by Gary Hart on Oct-26-2022 08:46
Hi Peter,

Thank you very much for both your responses to my question.  Thank you particularly for your explanation of what to do to get this to work and mentioning what can be done with ChartDirector 7.  I have ChartDirector 7, but as a Xojo plugin from Monkeybread Software, so I didn't feel comfortable asking you about how to use that.

I will work with the example that you provided to see how I can get our wave spectral data to plot the way that I want.

Thank you again for all your help with this, I'll be in touch if I have any problems.

Gary Hart.