
The usual goal of a dotplot is to compare value(s) on a numerical scale over numerous categories.
#Plotly r subplot size how to
It also demonstrates how to leverage nested plotly.js attributes, like textfont and xaxis – these attributes contain other attributes, so you need to supply a suitable named list to these arguments.įIGURE 3.3: Using the generic add_trace() function to render markers, lines, and text in a single scatter trace. For example, Figure 3.3 shows how to render markers, lines, and text in the same scatter trace.

The scatter-based layers in this chapter fix the type plotly.js attribute to "scatter" as well as the mode (e.g., add_markers() uses mode='markers' etc), but you could also use the lower-level add_trace() to work more directly with plotly.js. You won’t find plotly.js attributes listed as explicit arguments in any plotly function (except for the special type attribute), but they are passed along verbatim to the plotly.js figure definition through the. These features make it easier to get started using plotly.js, but it still pays off to learn how to use plotly.js directly. See Chapter 24 for more details on scaling and performance. The cost of having those capabilities is that plots starts to be become sluggish after a few hundred traces, whereas thousands of lines can be rendered fairly easily in one trace. In this case, the benefit of having multiple traces is that we can perform interactive filtering via the legend and compare multiple y-values at a given x.

That’s because, the grouping approach (top panel of Figure 3.2) uses just one plotly.js trace (more performant, less interactive), whereas the color approach (bottom panel of Figure 3.2) generates one trace per line/year. Not only do these plots differ in visual appearance, they also differ in interactive capabilities, computational performance, and underlying implementation.


Comparatively speaking, the bottom panel has more interactive capabilities (e.g., legend-based filtering and multiple tooltips), but it does not scale as well with many lines.
