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 6332891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:21:47+00:00 2026-05-24T18:21:47+00:00

Just like is being done in the following example, I want the tick mark

  • 0

Just like is being done in the following example, I want the tick mark labels on the domain of chart to be rotated 45 degrees as the are in this chart:
http://left.subtree.org/2007/08/14/rotate-labels-jfreechart/

The difference is, I want to do this on a scatter plot with a numeric axis. I can’t find an equivalent to setCategoryLabelPositions() in the class NumberAxis.

  • 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-24T18:21:48+00:00Added an answer on May 24, 2026 at 6:21 pm

    The method setVerticalTickLabels() may be an alternative. If not, I don’t see any choice but to override refreshTicksHorizontal(). See also this example.

    enter image description here

    import java.awt.Color;
    import java.awt.Dimension;
    import java.util.*;
    import org.jfree.chart.*;
    import org.jfree.chart.axis.NumberAxis;
    import org.jfree.chart.plot.PlotOrientation;
    import org.jfree.chart.plot.XYPlot;
    import org.jfree.chart.renderer.xy.XYItemRenderer;
    import org.jfree.data.xy.XYDataset;
    import org.jfree.data.xy.XYSeries;
    import org.jfree.data.xy.XYSeriesCollection;
    import org.jfree.ui.ApplicationFrame;
    import org.jfree.ui.RefineryUtilities;
    
    /**
     * @see https://stackoverflow.com/questions/7208657
     * @see https://stackoverflow.com/questions/7071057
     */
    public class ScatterTickLabels extends ApplicationFrame {
    
        public ScatterTickLabels(String s) {
            super(s);
            final ChartPanel chartPanel = createDemoPanel();
            chartPanel.setPreferredSize(new Dimension(640, 480));
            this.add(chartPanel);
        }
    
        public static ChartPanel createDemoPanel() {
            JFreeChart jfreechart = ChartFactory.createScatterPlot(
                "Scatter Plot Demo", "X", "Y", samplexydataset(),
                PlotOrientation.VERTICAL, true, true, false);
            XYPlot xyPlot = (XYPlot) jfreechart.getPlot();
            xyPlot.setDomainCrosshairVisible(true);
            xyPlot.setRangeCrosshairVisible(true);
            XYItemRenderer renderer = xyPlot.getRenderer();
            renderer.setSeriesPaint(0, Color.blue);
            NumberAxis domain = (NumberAxis) xyPlot.getDomainAxis();
            domain.setVerticalTickLabels(true);
            return new ChartPanel(jfreechart);
        }
    
        private static XYDataset samplexydataset() {
            int cols = 20;
            int rows = 20;
            XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
            XYSeries series = new XYSeries("Random");
            Random rand = new Random();
            for (int i = 0; i < rows; i++) {
                for (int j = 0; j < cols; j++) {
                    double x = rand.nextGaussian();
                    double y = rand.nextGaussian();
                    series.add(x, y);
                }
            }
            xySeriesCollection.addSeries(series);
            return xySeriesCollection;
        }
    
        public static void main(String args[]) {
            ScatterTickLabels demo = new ScatterTickLabels("Scatter Plot Demo");
            demo.pack();
            RefineryUtilities.centerFrameOnScreen(demo);
            demo.setVisible(true);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want the following behaviour: http://www.example.com/ Should go to: http://example.com/welcome ( DONE BY setting
Just like in this topic , I have a performance issue in dev mode
I have just done an html that should have some areas disabled. This areas
This sounds like a (very) silly question but I just can't find a way
Just like in the title. I got GridView control that displaying some data from
Just like I said, my winform application works properly on computers with VS installed,
Just like what happens when you click Sign in with OpenID on http://twitterfeed.com/ ,
Just like stackoverflow, there is a many-to-many relationship between Question and Tag. After running
Just like in JavaScript : opener.document.getElementByName jQuery: ?? Is there any way to get
Just like in topic I try to create a form when the elements create

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.