How can I fill my floating bars in Grapher with different colors depending on whether Y1 is greater or less than Y2?

While it is not currently possible to automatically choose different fill colors for a floating bar chart based on whether the difference between Y1 and Y2 is positive or negative, it is still possible to accomplish the desired result by following the steps below.

  1. Click File | Open.
  2. Select your data file and click Open.
  3. Click Data Tools | Data | Transform.
  4. In the Transform dialog, assuming you just have three columns for X, Y1, and Y2, enter this into the Transform equation box:
    D = IF(B>C,"Red","Blue")
  5. Click OK. This will enter the color name Red in column D where B (Y1) is greater than C (Y2), and it will enter the color name Blue if C (Y2) is greater than B (Y1). Any predefined colors can be used in this equation. To use a custom color, see the article How Can I Rearrange or Add My Own Colors to the Color Presets Drop Down Menu in Grapher?.
  6. If desired, enter "y1>y2" into the column D header. 
  7. If your project file will be saved as a GRF file rather than a GPJ file, save this data file now to the same (File | Save) or a new (File | Save As) name.
  8. Highlight columns A-C and click Home | New Graph | Bar | Vertical Floating Bar Chart.
  9. Select the floating bar plot in the Object Manager.
  10. On the Fill page in the Property Manager, click in the Color variable column and select Column D or the appropriate column from step 5.

Please contact us if you would like to add your vote for this feature to our suggestion file.


Updated October 10, 2018

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.