OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis     
 
Skip Navigation Links
All BooksExpand All Books
Origin HelpExpand Origin Help
Customizing Your GraphExpand Customizing Your Graph
Customizing Plot ElementsExpand Customizing Plot Elements

9.3.2 Using a Dataset to Control Plot Color

You can use a column of values in an Origin worksheet (or Excel workbook) to control data plot colors for plots of data from the same worksheet or workbook:

  • Any one of up to 155 columns on either side of the plotted data can be designated as the color control dataset.
  • If the source worksheet has more than 155 columns to the right of Y dataset, columns up to 155 can be listed as color control columns, starting from (and including) the values in plotted Y column.
  • If the worksheet has fewer than 155 columns to the right of the Y dataset, then columns located both at left and right sides of Y dataset can be used.

Setting color control by dataset is done via a data plot element's color button (for example, the Symbol Color button in the Plot Details dialog box).

Dataset Color Control.png

There are three modes of dataset color control, available from the By Points tab of the Color Chooser:

  • Indexing: This option uses a dataset of integers or text strings that index to colors in a specific Color List.
  • Direct RGB: This option uses a dataset of RGB composite values, each calculated from a separate R,G and B value.
  • Color Mapping: This option uses a dataset of real numbers that are binned and the customizable bin ranges are mapped to a customizable list of colors.


Indexing

This option uses a dataset of integers or categorical values that are indexed to colors in a specific Color List.

To use this option:

  1. Double-click on the data plot that you wish to modify. This opens the Plot Details dialog box.
  2. Select the Symbol tab, Pattern tab, etc.
  3. Click the Symbol Color button, Fill Color button, etc. When the Color Chooser opens, go to the By Points tab and select Indexing: Dataset (Dataset being the name of the column that stores the color control data).
  4. Click Apply.

Indexing Color ByPoints.png

Note: The column Format of the indexing column must be either Numeric or Text & Numeric and the column should contain integers or, in the case of categorical data, strings corresponding to categories. Any numbers to the right of a decimal point will be dropped.


To customize index colors:

When you index color to a column of worksheet values, a Color List tab is added to Plot Details. To customize the colors associated with your index column values:

  1. Click on the Color List tab and enable Use custom increment list. This loads a customizable color list.
  2. Follow procedures for customizing this color list as outlined in the topic The (Plot Details) Color List tab.

Direct RGB

To apply RGB colors to your Origin plots, you must generate an RGB composite value. The RGB composite value is calculated from:

  • Worksheet columns containing triplet components of Red, Green, and Blue. The R, G, and B component values range from 0 to 255 (e.g. (255,0,0)).
  • A Worksheet column of HTML color values (e.g. #FF0000).

To compute the RGB Composite:

  1. Use the color() function, in conjunction with the Set Values feature to calculate your composite values, as shown in the following image (note use of spreadsheet cell notation in the F(x)= row, highlighted in yellow):
RGB using SCV.png

Once you have a dataset of RGB composite values:

  1. Double-click on the data plot that you wish to modify. This opens the Plot Details dialog box.
  2. Select the Symbol tab, Pattern tab, etc.
  3. Click the color button (e.g.Edge Color), click the By Points tab, then select Direct RGB: Dataset, where Dataset contains the RGB composite values.
RGB using color plot.png

You can use the color() function to return a single RGB composite value in the Script Window or Command Window, using either HTML color codes or RGB triplets:

  1. Open the Command Window (Window: Command Window) or Script Window (Window: Script Window).
  2. Enter your values in either form, as shown in the following examples, then press <Enter>:
color(#FF0000)=
color(255,0,0)=
Origin returns:
color(#FF0000)=16777471
color(255,0,0)=16777471

Color Mapping

With this option you create a mapping relationship between ranges of 2D Y values or 3D Z values and an associated scale of colors. The 2D Y values or 3D Z values are then used to determine the data point element colors in the data plot, based on the established color map. The Y or Z values are real numbers.

  1. Double-click on the data plot that you wish to modify. This opens the Plot Details dialog box.
  2. Select the Symbol tab, Pattern tab, etc.
  3. Click the Symbol Color button, Fill Color button, etc. and select Color Mapping: Dataset.
Note: When this option is selected, a Colormap tab is added to the Plot Details dialog box. Use controls on the Colormap tab -- not those accessible from the color button -- to manipulate the colormap.
Colormap DoNotUse.png


An example:

  1. Start with a new project or a new workbook. Import the data file /Samples/Graphing/Template.dat by using "Import Single ASCII" button, Import Single ASCII.png
  2. Highlight column(A) and column(B),and then select Plot: Symbol: Scatter to create the plot.
    Color Mapping 1.png
  3. Double-click on the data line in the above graph. This opens the Plot Details dialog box.
  4. Select the Symbol tab.
  5. Click the Symbol Color button, go to By Points tab and select Color Mapping: Col("SVep").
Color Mapping 2.png
The graph should look like the picture below:
Color Mapping 3.png

Origin automatically creates a color scale with 8 colors (plus a color above and below), and maps the dataset values to these colors by finding the maximum and minimum dataset values, and an increment that results in 8 levels.

To customize this default color map:

  1. Double-click on the plot to open Plot Details, then select the Colormap tab. Click on the Level or Fill column header to assign custom Y or Z value ranges to associated colors.
  2. Select Graph: New Color Scale (or right-click in the layer and select New Color Scale) to display a color scale and the associated dataset mapping relationship in the graph.
Note: Double-click on the scale to open the Color Scale Control dialog box and modify the scale. For more information, see Color Scales.


The color mapping option is particularly useful for presenting data in which you have two independent variables and one dependent variable. You can plot the dependent variable versus one of the independent variables, and then use the second independent variable to color map your data plot. For example, suppose you measured some response of a sample at various positions along its length, while also varying the temperature of the sample along its length. Without using the color mapping option, you might present your results in a two layer graph, showing the variation of temperature along the sample length, as well as the measured response. However, by using the color mapping option, you can plot the measured response of the sample versus position, and use the temperature data to color map the data plot.

 

© OriginLab Corporation. All rights reserved.