Follow

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,1,0)
  5. Click OK. This will assign '1' to column D where B (Y1) is greater than C (Y2), and it will assign '0' if C (Y2) is greater than B (Y1).
  6. Enter "y1>y2" into the column D header if your other columns have headers. 
  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 1 plot in the Object Manager.
  10. On the Data Limits page in the Property Manager, click the Set button next to the Criteria field in the Criteria Filter section.
  11. In the Criteria dialog, check the box next to Use column criteria.
  12. Set the dropdown list at the bottom of the dialog to Column D: y1>y2 and click Add.
  13. In the Enter Criteria Value dialog, type "1" (without quotes) into the Value box. Click OK.
  14. Click OK. This plot now represents the bars where Y1>Y2, so you can rename it accordingly and change the fill properties on the Fill page in the Property Manager.
  15. With the plot or graph selected, click Home | Add to Graph | Plot.
  16. In the Select Plot Type dialog, select Vertical Floating Bar and click OK.
  17. In the Choose Axes dialog, click OK.
  18. In the Open Worksheet dialog, select your data file from the Open worksheets list and click Open.
  19. Select the new plot (Floating Bar 2) in the Object Manager
  20. On the Data Limits page in the Property Manager, click the Set button next to the Criteria field in the Criteria Filter section.
  21. In the Criteria dialog, check the box next to Use column criteria.
  22. Set the dropdown list at the bottom of the dialog to Column D: y1>y2 and click Add.
  23. In the Enter Criteria Value dialog, type "0" (without quotes) into the Value box. Click OK.
  24. Click OK. This plot now represents the bars where Y1<Y2, so you can rename it accordingly and change the fill properties on the Fill page in the Property Manager.

 

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

 

Updated September 11, 2018

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

0 Comments

Please sign in to leave a comment.