-
Notifications
You must be signed in to change notification settings - Fork 45
Using Continuous Color Palettes
Continuous color ramps and color assignment files support three types of tasks:
- Color nodes or links by a numeric field.
- Apply the same continuous color ramp again from a CSV or TSV file.
- Export a view with labeled color legends that do not cover the visualization.
Use this workflow when color should show the size of a numeric value, such as risk score, age, viral load, genetic distance, contact duration, or transmission probability.
- The node or link field should contain numbers or empty values.
- Text such as
unknownmakes Auto treat the field as categorical. Remove the text or explicitly choose Continuous when that option is available. - Continuous node colors appear in 2D Network, Map, Bubble, Phylogenetic Tree, and Epi Curve.
- Continuous link colors appear in 2D Network and Map.
- Load the node data and, if needed, the link data.
- Open Settings > Styling.
- Under Color Nodes By or Color Links By, select the numeric field.
- Under Node Color Scale or Link Color Scale, select Auto (Continuous) or Continuous.
- Under Domain, keep Automatic (full data) or select Custom bounds and enter the low and high values.
- Change the color stops, select Add Stop, select Reverse, or choose a different Missing / invalid color as needed.
- Set the color legend to Show, Dock, or Hide.
MicrobeTrace applies the ramp across the selected field. Values between stops are interpolated, and values outside a custom domain use the nearest endpoint color.
The legend identifies the field being displayed, for example, Node Color: Degree or Link Color: Distance. It also shows the numeric stops and the color used for missing or invalid values.
Use this workflow when you want to reuse a specific node or link ramp without rebuilding it in the Styling panel.
Download Node Color Ramp Example (Right-click to save)
Download Link Color Ramp Example (Right-click to save)
Create a comma-separated (.csv) or tab-separated (.tsv) file. The first row contains the field name, color, and mode:
FieldName,color,modeFor a continuous ramp:
- The first header must exactly match a field in the loaded node or link data.
- Each value in the first column is a numeric color-stop position.
- Colors must use
#RGBor#RRGGBBhexadecimal format. - At least one data row must contain
continuousin themodecolumn. The remaining mode cells can be empty. - The file must contain at least two different numeric stops.
- The smallest and largest stops become the custom domain bounds.
- The rows do not need to be sorted; MicrobeTrace sorts the stops by value.
- Applying the file keeps the currently selected missing/invalid color.
Example node assignment file:
RiskScore,color,mode
5,#440154,continuous
35,#31688e,
60,#35b779,
96,#fde725,Example link assignment file:
ContactMinutes,color,mode
5,#000004,continuous
45,#721f81,
180,#f1605d,
480,#fcfdbf,- Open Settings > Styling.
- Find Apply Color Assignment File in the node color section.
- Select the CSV or TSV file.
- Confirm that MicrobeTrace selects the field named in the first column and displays its continuous ramp.
- Open Settings > Styling.
- Find Apply Link Color Assignment File in the link color section.
- Select the CSV or TSV file.
- Confirm that MicrobeTrace selects the field named in the first column and displays its continuous ramp.
If MicrobeTrace finds an invalid stop, color, mode, or field, it rejects the complete file and leaves the current colors unchanged.
Use this workflow when you want the exported visualization to explain its node and link colors.
- Configure the node and link colors.
- Set each color legend that should be included to Show or Dock.
- Select Export Screen in the view toolbar.
- Enter a filename and choose PNG or SVG.
- Select Export.
MicrobeTrace places the visible legends beside the visualization instead of covering it. Each exported legend includes its node or link field label, the complete gradient and stop values, and the missing/invalid key. SVG exports also include an accessible title that describes the ramp.
- Auto chooses continuous coloring when all populated field values are valid numbers; otherwise, it uses categorical coloring.
- Custom bounds keeps the same low and high values while filters, timelines, or visibility settings change.
- Add Stop adds an intermediate color to the ramp.
- Reverse reverses the stop colors without changing the numeric domain.
- Missing / invalid sets the fallback color for empty or nonnumeric values.
- Show opens a floating legend, Dock places it in the key tables panel, and Hide removes it from the screen and exports.
- Saving a MicrobeTrace style or session preserves the continuous node and link settings.
Existing categorical assignment files continue to work.
- A file without a
modecolumn uses categorical assignment behavior. - A file can explicitly use
categoricalin themodecolumn. - Categorical node colors, categorical link colors, continuous node ramps, and continuous link ramps are saved independently.
- iTOL color strip files remain categorical. Use CSV or TSV for a continuous ramp.
- The field is not found: Confirm that the first column header exactly matches a field in the loaded node or link data.
- Continuous is unavailable: Confirm that the field contains finite numbers or empty values. Remove text values or use categorical coloring.
-
The mode is missing: Add a
modecolumn and entercontinuousin at least one data row. -
The file reports conflicting modes: Use the same mode in every populated
modecell. -
A stop is invalid: Use a finite number such as
0,12.5,-4, or1e3. - The ramp needs more stops: Add at least two different numeric stop values.
-
A color is invalid: Use a three- or six-digit hexadecimal color beginning with
#. - A stop appears twice with different colors: Remove the duplicate or use the same color for both rows.
- An iTOL file does not create a ramp: iTOL color strip files are categorical; use a CSV or TSV assignment table.
Copyright 2017-2020 Centers for Disease Control and Prevention • Acknowledgements