Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 995947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:48:05+00:00 2026-05-16T06:48:05+00:00

I’d like to create a polar plot where the data is plotted in mathematical

  • 0

I’d like to create a polar plot where the data is plotted in mathematical orientation (thus, the series starts and the east and continues counter-clockwise). The default behavior of JFreeChart’s PolarPlot is to start north and continue the series clockwise.

Is there any support for this built in the PolarPlot class? I know how to transform the data to reach the goal, but this approach is rather cumbersome, since I’d need to adapt the angle labeling too.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:48:06+00:00Added an answer on May 16, 2026 at 6:48 am

    As an aside, org.jfree.chart.plot.PolarPlot appears to have been designed for navigational and geodetic applications.

    Using the transformation θ’ = π/4 – θ and overriding refreshAngleTicks(), as suggested by @mort, produces reasonable results.

    Addendum: See also this variation using the new PolarPlot API.

    archimedes spiral

    import java.awt.Color;
    import java.awt.Dimension;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JFrame;
    import org.jfree.chart.ChartPanel;
    import org.jfree.chart.JFreeChart;
    import org.jfree.chart.axis.NumberAxis;
    import org.jfree.chart.axis.NumberTick;
    import org.jfree.chart.axis.ValueAxis;
    import org.jfree.chart.plot.PolarPlot;
    import org.jfree.chart.renderer.DefaultPolarItemRenderer;
    import org.jfree.chart.renderer.PolarItemRenderer;
    import org.jfree.data.xy.XYDataset;
    import org.jfree.data.xy.XYSeries;
    import org.jfree.data.xy.XYSeriesCollection;
    import org.jfree.ui.TextAnchor;
    
    /**
     * @see http://en.wikipedia.org/wiki/Polar_coordinate_system
     * @see https://stackoverflow.com/questions/3458824
     */
    public class ArchimedesSpiral extends JFrame {
    
        private static final String title = "Archimedes' Spiral";
    
        public ArchimedesSpiral(String title) {
            super(title);
            JFreeChart chart = createChart(createDataset());
            ChartPanel panel = new ChartPanel(chart);
            panel.setPreferredSize(new Dimension(500, 500));
            panel.setMouseZoomable(false);
            this.add(panel);
        }
    
        private static XYDataset createDataset() {
            XYSeriesCollection result = new XYSeriesCollection();
            XYSeries series = new XYSeries(title);
            for (int t = 0; t <= 3 * 360; t++) {
                series.add(90 - t, t);
            }
            result.addSeries(series);
            return result;
        }
    
        private static JFreeChart createChart(XYDataset dataset) {
            ValueAxis radiusAxis = new NumberAxis();
            radiusAxis.setTickLabelsVisible(false);
            PolarItemRenderer renderer = new DefaultPolarItemRenderer();
            PolarPlot plot = new PolarPlot(dataset, radiusAxis, renderer) {
    
                @Override
                protected List refreshAngleTicks() {
                    List<NumberTick> ticks = new ArrayList<NumberTick>();
                    int delta = (int) this.getAngleTickUnit().getSize();
                    for (int t = 0; t < 360; t += delta) {
                        int tp = (360 + 90 - t) % 360;
                        NumberTick tick = new NumberTick(
                            Double.valueOf(t), String.valueOf(tp),
                            TextAnchor.CENTER, TextAnchor.CENTER, 0.0);
                        ticks.add(tick);
                    }
                    return ticks;
                }
            };
            plot.setBackgroundPaint(new Color(0x00f0f0f0));
            plot.setRadiusGridlinePaint(Color.gray);
            plot.addCornerTextItem("r(θ) = θ; 0 < θ < 6π");
            JFreeChart chart = new JFreeChart(
                title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
            chart.setBackgroundPaint(Color.white);
            return chart;
        }
    
        public static void main(String[] args) {
            ArchimedesSpiral demo = new ArchimedesSpiral(title);
            demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            demo.pack();
            demo.setLocationRelativeTo(null);
            demo.setVisible(true);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.