Okay
  Public Ticket #3811429
Customizing Scatter Plot
Open

Comments

  • Mark Olbert started the conversation

    I want to create a scatter plot using two different series of data, each of which share the same X values. In other words, there are three columns of data in my CSV file, X, Y1 and Y2. I want Y1 and Y2 to display in different colors.

    The image shown in the UI for creating a scatter plot implies this can be done. But while I successfully created a wpDataTable to hold the data (imported from a CSV file I uploaded), creating a scatter chart from that data table failed.

    Specifically, I could not find any way in the UI to indicate which series held the X values and which two series held the Y1 and Y2 values. The plugin just seems to pick a couple of series "at random".

    How do I specify which series/columns should be X, Y1 and Y2?

  •   Miloš replied privately
  • Mark Olbert replied

    Hi Miloš,

    That's not what I'm seeing on my system. I've attached a screenshot of what I'm seeing after picking three columns from a dataset, Polarization (float), Avg Red Per Capita (float) and Avg Blue Per Capita (float). Polarization is the first column in the selected list, and it should be the X value series.

    I'm wondering if the data set structure is messing things up. It's a bit complicated/nuanced. I've attached a screenshot of the dataset as well.

    The structural oddity of the dataset is that, for both the Avg Red Per Capita and Avg Blue Per Capita columns, some values are undefined/empty. That's so there won't be a value shown in the chart for that series at certain X values.

    The reason I structured the CSV file that way is because the average per capital value is the average (US) Federal subsidy a given (US) state receives (i.e., the net of Federal taxes paid, and Federal outlays made in that state). The Polarization value defines how politically polarized a particular state is (negative numbers mean more Republican, positive numbers mean more Democratic).

    Any given state has just a single data pair (Polarization and average per capita subsidy) associated with it (e.g., it makes no sense to talk about California's Republican-leaning subsidy because California is a Democratically-leaning state).

    I defined the data this way so I could assign different colors to the two different average per capital subsidies (i.e., red for Republican-leaning states and blue for Democratic-leaning states).

    But that may be bollixing up the chart logic.

    Conceptually, "all" I'm trying to do is have points with a Polarization value < 0 be colored red, while points with a Polarization value >= 0 should be colored blue (I wouldn't mind being able to have different icons, say a triangle and a circle, to differentiate the < 0 and >= 0 Polarization values, but that's a nice to have, not a got to have).

    If there's another way to control the color of the data points, or to ensure 0 values don't appear in the chart, I'm happy to switch approaches.

    Attached files:  scatter plot screenshot.png
      scatter plot data screenshot.png

  • Mark Olbert replied

    Hi Miloš,

    Some further information...

    I decided to try a different charting provider to see if the problem existed there, too. I chose to use Google Charts.

    And guess what? The problem completely disappeared! I just selected the three series -- one for X values, two separate Y values (each of which had blanks for certain X values) -- and the chart displayed precisely the way it should have.

    I think this makes it pretty clear there's a problem with either Highcharts, or with how your plugin is interfacing with Highcharts.

    - Mark

  •   Miloš replied privately
  • Mark Olbert replied

    No worries, Miloš. I know you (or at least your company :)) operates on Central European Time, and, frankly, I'm glad you're not required to work on weekends. Sure, it delays responses, but there's more to life than work :).

    Here is a link to what the google chart version looks like (I used google charts to create all the charts on this page):

    Federal Subsidies of States - Make America Smart Again

    I've attached the source CSV file to this reply.

    Attached files:  rockefeller-upload.csv

  •   Miloš replied privately
  •   Miloš replied privately
  •   Mark Olbert replied privately