1.183 FAQ-874 How to color regions in a line plot?

Last Update: 7/31/2023


To color some regions in a line plot, you can use

to group the regions into categories and then color-map line plot by the categorical data.

Note: the Cluster gadget is for Pro only.


Cluster Gadget

For example, to highlight peak A and B with different colors in the following line plot,

How to color regions in lineplo 01.png

  1. With the graph active, select Gadgets: Cluster.
  2. In the dialog, select Circle for Shape on ROI Box tab since a circle ROI is more flexible to cover the peak region. Click OK and a ROI circle is put to the graph.
  3. Move the ROI area peak A. Drag the 8 anchors to adjust the size and shape of the ROI so it can cover the region of peak A as desired.
  4. Click the Create Categories button Button Create Categories.png on the Cluster Gadget: Editing Inner Points dialog.
  5. In the Create Categorical Value dialog, name your category group and give a categrocial value to the data points in the ROI region. Check Color Data by Category checkbox, then this categrocial value will be set as the data plot color index.
    How to color regions in lineplo 02.png
  6. Repeat steps 3 to 5 to select region of Peak B and set the categorical value.
  7. You can click the Go to Source Worksheet button Cluster Gadget Go to Source Worksheet button.png to go to the source data. A "Group" column is added, containing the categorical values you just specified.

Finally we get the following plot.

How to color regions in lineplo 04.png


Data Highlighter

Above tutorial can also be done by Data Higlighter. That is,

  1. With the graph active, select Data Highlighter button Button Data Highlighter.png from Tools toolbar at the left side.
    The mouse cursor will then change to "data higlight" mode and a Data Highlighter mini toolbar will pop up at the top-right corner of the Graph window.
  2. Drag a rectangle area to fully cover the region of peak A as desired. Data points inside this region will be highlighted.
  3. Click the Create Categories button Popup Create Categories.png from the mini toolbar. This will open the Create Categorical Value dialog.
  4. Name your category group and give a categrocial value to the highlighted data points. Check Color Data by Category checkbox, then this categrocial value will be set as the data plot color index.
  5. Repeat steps 2 to 4 to select region of Peak B and set the categorical value.
    How to color regions in lineplot 03.gif
  6. If you go to the source data worksheet, a "Group" column is added, containing the categorical values you just specified.



Keywords:line curve, colormap, region of plot, color peaks