Skip to content

Parcats

Overview

The parcats trace type is used to create parallel categories diagrams, which are useful for visualizing categorical data across multiple dimensions. It allows you to see how data flows through different categories and compare the distribution of values across them.

You can customize the colors, line widths, and category order to represent your data and patterns effectively.

Common Uses

  • Categorical Data Visualization: Visualizing relationships between different categorical variables.
  • Flow Analysis: Showing how data is distributed across multiple dimensions and comparing those paths.
  • Segmentation: Visualizing how different segments of data flow through categories.

Check out the Attributes for the full set of configuration options

Examples

Common Configurations

Here's a simple parcats plot showing how data flows across two categorical variables:

You can copy this code below to create this chart in your project:

models:
  - name: parcats-data
    args:
      - echo
      - |
        category_1,category_2,value
        A,X,30
        A,Y,20
        B,X,25
        B,Y,25
traces:
  - name: Simple Parcats Plot
    model: ${ref(parcats-data)}
    props:
      type: parcats
      dimensions:
        - label: "Category 1"
          values: ?{category_1}
        - label: "Category 2"
          values: ?{category_2}
      line:
        color: ?{value}
        colorscale: "Viridis"
charts:
  - name: Simple Parcats Chart
    traces:
      - ${ref(Simple Parcats Plot)}
    layout:
      title:
        text: Simple Parcats Chart<br><sub>Parallel Categories Diagram</sub>

This example demonstrates a parcats plot with multiple categorical dimensions, showing how data flows across three categories:

Here's the code:

models:
  - name: parcats-data-multi
    args:
      - echo
      - |
        category_1,category_2,category_3,value
        A,X,Alpha,30
        A,Y,Beta,20
        B,X,Alpha,25
        B,Y,Gamma,25
traces:
  - name: Parcats Plot with Multiple Dimensions
    model: ${ref(parcats-data-multi)}
    props:
      type: parcats
      dimensions:
        - label: "Category 1"
          values: ?{category_1}
        - label: "Category 2"
          values: ?{category_2}
        - label: "Category 3"
          values: ?{category_3}
      line:
        color: ?{value}
        colorscale: "Blues"
charts:
  - name: Parcats Chart with Multiple Dimensions
    traces:
      - ${ref(Parcats Plot with Multiple Dimensions)}
    layout:
      title:
        text: Parcats Chart with Multiple Dimensions<br><sub>Flow Across Three Categories</sub>

This example shows a parcats plot with custom line widths based on a value, allowing for the thickness of the lines to represent the volume of data:

Here's the code:

models:
  - name: parcats-data-linewidth
    args:
      - echo
      - |
        category_1,category_2,value
        A,X,50
        A,Y,30
        B,X,40
        B,Y,20
traces:
  - name: Parcats Plot with Custom Line Widths
    model: ${ref(parcats-data-linewidth)}
    props:
      type: parcats
      dimensions:
        - label: "Category 1"
          values: ?{category_1}
        - label: "Category 2"
          values: ?{category_2}
      line:
        color: ?{value}
        width: ?{value}
        colorscale: "Jet"
charts:
  - name: Parcats Chart with Custom Line Widths
    traces:
      - ${ref(Parcats Plot with Custom Line Widths)}
    layout:
      title:
        text: Parcats Chart with Custom Line Widths<br><sub>Custom Line Width Based on Values</sub>

A schema to validate plotly trace properties

Attributes

These attributes apply to traces where trace.props.type is set to parcats. You would configure these attributes on the trace with the trace.props object.

arrangement: 'any' #(1)!
bundlecolors: 'boolean' #(2)!
counts: 'number | array' #(3)!
countssrc: 'string' #(4)!
dimensions: array
domain:
  column: 'integer' #(5)!
  row: 'integer' #(6)!
  x: 'array' #(7)!
  y: 'array' #(8)!
hoverinfo: 'string' #(9)!
hoveron: 'any' #(10)!
hovertemplate: 'string' #(11)!
labelfont:
  color: any
  family: 'string' #(12)!
  lineposition: 'string' #(13)!
  shadow: 'string' #(14)!
  size: number
  style: 'any' #(15)!
  textcase: 'any' #(16)!
  variant: 'any' #(17)!
  weight: 'integer' #(18)!
legendgrouptitle:
  font:
    color: any
    family: 'string' #(19)!
    lineposition: 'string' #(20)!
    shadow: 'string' #(21)!
    size: number
    style: 'any' #(22)!
    textcase: 'any' #(23)!
    variant: 'any' #(24)!
    weight: 'integer' #(25)!
  text: 'string' #(26)!
legendwidth: 'number' #(27)!
line:
  autocolorscale: 'boolean' #(28)!
  cauto: 'boolean' #(29)!
  cmax: 'number' #(30)!
  cmid: 'number' #(31)!
  cmin: 'number' #(32)!
  color: 'color | array' #(33)!
  coloraxis: 'string' #(34)!
  colorbar:
    bgcolor: 'any' #(35)!
    bordercolor: 'any' #(36)!
    borderwidth: 'number' #(37)!
    exponentformat: 'any' #(38)!
    len: 'number' #(39)!
    lenmode: 'any' #(40)!
    minexponent: 'number' #(41)!
    nticks: 'integer' #(42)!
    orientation: 'any' #(43)!
    outlinecolor: 'any' #(44)!
    outlinewidth: 'number' #(45)!
    separatethousands: 'boolean' #(46)!
    showexponent: 'any' #(47)!
    showticklabels: 'boolean' #(48)!
    showtickprefix: 'any' #(49)!
    showticksuffix: 'any' #(50)!
    thickness: 'number' #(51)!
    thicknessmode: 'any' #(52)!
    tickangle: 'number' #(53)!
    tickcolor: 'any' #(54)!
    tickfont:
      color: any
      family: 'string' #(55)!
      lineposition: 'string' #(56)!
      shadow: 'string' #(57)!
      size: number
      style: 'any' #(58)!
      textcase: 'any' #(59)!
      variant: 'any' #(60)!
      weight: 'integer' #(61)!
    tickformat: 'string' #(62)!
    tickformatstops: array
    ticklabeloverflow: 'any' #(63)!
    ticklabelposition: 'any' #(64)!
    ticklabelstep: 'integer' #(65)!
    ticklen: 'number' #(66)!
    tickmode: 'any' #(67)!
    tickprefix: 'string' #(68)!
    ticks: 'any' #(69)!
    ticksuffix: 'string' #(70)!
    ticktext: 'array' #(71)!
    ticktextsrc: 'string' #(72)!
    tickvals: 'array' #(73)!
    tickvalssrc: 'string' #(74)!
    tickwidth: 'number' #(75)!
    title:
      font:
        color: any
        family: 'string' #(76)!
        lineposition: 'string' #(77)!
        shadow: 'string' #(78)!
        size: number
        style: 'any' #(79)!
        textcase: 'any' #(80)!
        variant: 'any' #(81)!
        weight: 'integer' #(82)!
      side: 'any' #(83)!
      text: 'string' #(84)!
    x: 'number' #(85)!
    xanchor: 'any' #(86)!
    xpad: 'number' #(87)!
    xref: 'any' #(88)!
    y: 'number' #(89)!
    yanchor: 'any' #(90)!
    ypad: 'number' #(91)!
    yref: 'any' #(92)!
  colorscale: 'any' #(93)!
  colorsrc: 'string' #(94)!
  hovertemplate: 'string' #(95)!
  reversescale: 'boolean' #(96)!
  shape: 'any' #(97)!
  showscale: 'boolean' #(98)!
metasrc: 'string' #(99)!
name: 'string' #(100)!
sortpaths: 'any' #(101)!
stream:
  maxpoints: 'number' #(102)!
  token: 'string' #(103)!
tickfont:
  color: any
  family: 'string' #(104)!
  lineposition: 'string' #(105)!
  shadow: 'string' #(106)!
  size: number
  style: 'any' #(107)!
  textcase: 'any' #(108)!
  variant: 'any' #(109)!
  weight: 'integer' #(110)!
type: parcats
uid: 'string' #(111)!
visible: 'any' #(112)!
  1. Sets the drag interaction mode for categories and dimensions. If perpendicular, the categories can only move along a line perpendicular to the paths. If freeform, the categories can freely move on the plane. If fixed, the categories and dimensions are stationary.
  2. Sort paths so that like colors are bundled together within each category.
  3. The number of observations represented by each state. Defaults to 1 so that each state represents one observation
  4. Sets the source reference on Chart Studio Cloud for counts.
  5. If there is a layout grid, use the domain for this column in the grid for this parcats trace .
  6. If there is a layout grid, use the domain for this row in the grid for this parcats trace .
  7. Sets the horizontal domain of this parcats trace (in plot fraction).
  8. Sets the vertical domain of this parcats trace (in plot fraction).
  9. Determines which trace information appear on hover. If none or skip are set, no information is displayed upon hovering. But, if none is set, click and hover events are still fired.
  10. Sets the hover interaction mode for the parcats diagram. If category, hover interaction take place per category. If color, hover interactions take place per color per category. If dimension, hover interactions take place across all categories per dimension.
  11. Template string used for rendering the information that appear on hover box. Note that this will override hoverinfo. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%xother}, {%_xother}, {%xother_}. When showing info for several points, xother will be added to those with different x positions from the first point. An underscore before or after (x|y)other will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in hovertemplate are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are arrayOk: true) are available. This value here applies when hovering over dimensions. Note that *categorycount, colorcount and bandcolorcount are only available when hoveron contains the color flagFinally, the template string has access to variables count, probability, category, categorycount, colorcount and bandcolorcount. Anything contained in tag <extra> is displayed in the secondary box, for example "{fullData.name}". To hide the secondary box completely, use an empty tag <extra></extra>.
  12. HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
  13. Sets the kind of decoration line(s) with text, such as an under, over or through as well as combinations e.g. under+over, etc.
  14. Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
  15. Sets whether a font should be styled with a normal or italic face from its family.
  16. Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.
  17. Sets the variant of the font.
  18. Sets the weight (or boldness) of the font.
  19. HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
  20. Sets the kind of decoration line(s) with text, such as an under, over or through as well as combinations e.g. under+over, etc.
  21. Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
  22. Sets whether a font should be styled with a normal or italic face from its family.
  23. Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.
  24. Sets the variant of the font.
  25. Sets the weight (or boldness) of the font.
  26. Sets the title of the legend group.
  27. Sets the width (in px or fraction) of the legend for this trace.
  28. Determines whether the colorscale is a default palette (autocolorscale: true) or the palette determined by line.colorscale. Has an effect only if in line.color is set to a numerical array. In case colorscale is unspecified or autocolorscale is true, the default palette will be chosen according to whether numbers in the color array are all positive, all negative or mixed.
  29. Determines whether or not the color domain is computed with respect to the input data (here in line.color) or the bounds set in line.cmin and line.cmax Has an effect only if in line.color is set to a numerical array. Defaults to false when line.cmin and line.cmax are set by the user.
  30. Sets the upper bound of the color domain. Has an effect only if in line.color is set to a numerical array. Value should have the same units as in line.color and if set, line.cmin must be set as well.
  31. Sets the mid-point of the color domain by scaling line.cmin and/or line.cmax to be equidistant to this point. Has an effect only if in line.color is set to a numerical array. Value should have the same units as in line.color. Has no effect when line.cauto is false.
  32. Sets the lower bound of the color domain. Has an effect only if in line.color is set to a numerical array. Value should have the same units as in line.color and if set, line.cmax must be set as well.
  33. Sets the line color. It accepts either a specific color or an array of numbers that are mapped to the colorscale relative to the max and min values of the array or relative to line.cmin and line.cmax if set.
  34. Sets a reference to a shared color axis. References to these shared color axes are coloraxis, coloraxis2, coloraxis3, etc. Settings for these shared color axes are set in the layout, under layout.coloraxis, layout.coloraxis2, etc. Note that multiple color scales can be linked to the same color axis.
  35. Sets the color of padded area.
  36. Sets the axis line color.
  37. Sets the width (in px) or the border enclosing this color bar.
  38. Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If none, it appears as 1,000,000,000. If e, 1e+9. If E, 1E+9. If power, 1x10^9 (with 9 in a super script). If SI, 1G. If B, 1B.
  39. Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends.
  40. Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot fraction or in *pixels. Use len to set the value.
  41. Hide SI prefix for 10^n if |n| is below this number. This only has an effect when tickformat is SI or B.
  42. Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to nticks. Has an effect only if tickmode is set to auto.
  43. Sets the orientation of the colorbar.
  44. Sets the axis line color.
  45. Sets the width (in px) of the axis line.
  46. If "true", even 4-digit integers are separated
  47. If all, all exponents are shown besides their significands. If first, only the exponent of the first tick is shown. If last, only the exponent of the last tick is shown. If none, no exponents appear.
  48. Determines whether or not the tick labels are drawn.
  49. If all, all tick labels are displayed with a prefix. If first, only the first tick is displayed with a prefix. If last, only the last tick is displayed with a suffix. If none, tick prefixes are hidden.
  50. Same as showtickprefix but for tick suffixes.
  51. Sets the thickness of the color bar This measure excludes the size of the padding, ticks and labels.
  52. Determines whether this color bar's thickness (i.e. the measure in the constant color direction) is set in units of plot fraction or in pixels. Use thickness to set the value.
  53. Sets the angle of the tick labels with respect to the horizontal. For example, a tickangle of -90 draws the tick labels vertically.
  54. Sets the tick color.
  55. HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
  56. Sets the kind of decoration line(s) with text, such as an under, over or through as well as combinations e.g. under+over, etc.
  57. Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
  58. Sets whether a font should be styled with a normal or italic face from its family.
  59. Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.
  60. Sets the variant of the font.
  61. Sets the weight (or boldness) of the font.
  62. Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: %h for half of the year as a decimal number as well as %{n}f for fractional seconds with n digits. For example, 2016-10-13 09:15:23.456 with tickformat %H~%M~%S.%2f would display 09~15~23.46
  63. Determines how we handle tick labels that would overflow either the graph div or the domain of the axis. The default value for inside tick labels is hide past domain. In other cases the default is hide past div.
  64. Determines where tick labels are drawn relative to the ticks. Left and right options are used when orientation is h, top and bottom when orientation is v.
  65. Sets the spacing between tick labels as compared to the spacing between ticks. A value of 1 (default) means each tick gets a label. A value of 2 means shows every 2nd label. A larger value n means only every nth tick is labeled. tick0 determines which labels are shown. Not implemented for axes with type log or multicategory, or when tickmode is array.
  66. Sets the tick length (in px).
  67. Sets the tick mode for this axis. If auto, the number of ticks is set via nticks. If linear, the placement of the ticks is determined by a starting position tick0 and a tick step dtick (linear is the default value if tick0 and dtick are provided). If array, the placement of the ticks is set via tickvals and the tick text is ticktext. (array is the default value if tickvals is provided).
  68. Sets a tick label prefix.
  69. Determines whether ticks are drawn or not. If , this axis' ticks are not drawn. If outside (inside), this axis' are drawn outside (inside) the axis lines.
  70. Sets a tick label suffix.
  71. Sets the text displayed at the ticks position via tickvals. Only has an effect if tickmode is set to array. Used with tickvals.
  72. Sets the source reference on Chart Studio Cloud for ticktext.
  73. Sets the values at which ticks on this axis appear. Only has an effect if tickmode is set to array. Used with ticktext.
  74. Sets the source reference on Chart Studio Cloud for tickvals.
  75. Sets the tick width (in px).
  76. HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
  77. Sets the kind of decoration line(s) with text, such as an under, over or through as well as combinations e.g. under+over, etc.
  78. Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
  79. Sets whether a font should be styled with a normal or italic face from its family.
  80. Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.
  81. Sets the variant of the font.
  82. Sets the weight (or boldness) of the font.
  83. Determines the location of color bar's title with respect to the color bar. Defaults to top when orientation if v and defaults to right when orientation if h.
  84. Sets the title of the color bar.
  85. Sets the x position with respect to xref of the color bar (in plot fraction). When xref is paper, defaults to 1.02 when orientation is v and 0.5 when orientation is h. When xref is container, defaults to 1 when orientation is v and 0.5 when orientation is h. Must be between 0 and 1 if xref is container and between -2 and 3 if xref is paper.
  86. Sets this color bar's horizontal position anchor. This anchor binds the x position to the left, center or right of the color bar. Defaults to left when orientation is v and center when orientation is h.
  87. Sets the amount of padding (in px) along the x direction.
  88. Sets the container x refers to. container spans the entire width of the plot. paper refers to the width of the plotting area only.
  89. Sets the y position with respect to yref of the color bar (in plot fraction). When yref is paper, defaults to 0.5 when orientation is v and 1.02 when orientation is h. When yref is container, defaults to 0.5 when orientation is v and 1 when orientation is h. Must be between 0 and 1 if yref is container and between -2 and 3 if yref is paper.
  90. Sets this color bar's vertical position anchor This anchor binds the y position to the top, middle or bottom of the color bar. Defaults to middle when orientation is v and bottom when orientation is h.
  91. Sets the amount of padding (in px) along the y direction.
  92. Sets the container y refers to. container spans the entire height of the plot. paper refers to the height of the plotting area only.
  93. Sets the colorscale. Has an effect only if in line.color is set to a numerical array. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, [[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]. To control the bounds of the colorscale in color space, use line.cmin and line.cmax. Alternatively, colorscale may be a palette name string of the following list: Blackbody,Bluered,Blues,Cividis,Earth,Electric,Greens,Greys,Hot,Jet,Picnic,Portland,Rainbow,RdBu,Reds,Viridis,YlGnBu,YlOrRd.
  94. Sets the source reference on Chart Studio Cloud for color.
  95. Template string used for rendering the information that appear on hover box. Note that this will override hoverinfo. Variables are inserted using %{variable}, for example "y: %{y}" as well as %{xother}, {%xother}, {%_xother}, {%xother_}. When showing info for several points, xother will be added to those with different x positions from the first point. An underscore before or after (x|y)other will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example "Price: %{y:$.2f}". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example "Day: %{2019-01-01|%A}". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in hovertemplate are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are arrayOk: true) are available. This value here applies when hovering over lines.Finally, the template string has access to variables count and probability. Anything contained in tag <extra> is displayed in the secondary box, for example "{fullData.name}". To hide the secondary box completely, use an empty tag <extra></extra>.
  96. Reverses the color mapping if true. Has an effect only if in line.color is set to a numerical array. If true, line.cmin will correspond to the last color in the array and line.cmax will correspond to the first color.
  97. Sets the shape of the paths. If linear, paths are composed of straight lines. If hspline, paths are composed of horizontal curved splines
  98. Determines whether or not a colorbar is displayed for this trace. Has an effect only if in line.color is set to a numerical array.
  99. Sets the source reference on Chart Studio Cloud for meta.
  100. Sets the trace name. The trace name appears as the legend item and on hover.
  101. Sets the path sorting algorithm. If forward, sort paths based on dimension categories from left to right. If backward, sort paths based on dimensions categories from right to left.
  102. Sets the maximum number of points to keep on the plots from an incoming stream. If maxpoints is set to 50, only the newest 50 points will be displayed on the plot.
  103. The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.
  104. HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
  105. Sets the kind of decoration line(s) with text, such as an under, over or through as well as combinations e.g. under+over, etc.
  106. Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
  107. Sets whether a font should be styled with a normal or italic face from its family.
  108. Sets capitalization of text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.
  109. Sets the variant of the font.
  110. Sets the weight (or boldness) of the font.
  111. Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
  112. Determines whether or not this trace is visible. If legendonly, the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).