How Do I...
Out[1]:
Show a grid¶
In [2]:
Copied!
my_plot + Plot.grid()
my_plot + Plot.grid()
Out[2]:
Label axes¶
Add an options object to your plot, putting a "label" in the options for the "x"
or "y"
axis:
In [3]:
Copied!
my_plot + {"x": {"label": "My x axis"}, "y": {"label": False}}
my_plot + {"x": {"label": "My x axis"}, "y": {"label": False}}
Out[3]:
Hide axes¶
Pass False
for an axis label (see above), or use Plot.hideAxis
:
In [4]:
Copied!
my_plot + Plot.hideAxis() & my_plot + Plot.hideAxis(y=True)
my_plot + Plot.hideAxis() & my_plot + Plot.hideAxis(y=True)
Out[4]:
Assign colors to particular marks¶
- In a mark use
Plot.constantly(<label>)
for a color value likefill
orstroke
. The<label>
, a string, is how you will refer to this color and it will show up in the legend. - Then use
Plot.colorMap({<label>: <color>})
to specify a color for that label. - Include
Plot.colorLegend()
to show the legend. See the color page for more details.
In [5]:
Copied!
(
Plot.line(my_data, stroke=Plot.constantly("Progress"))
+ Plot.colorMap({"Progress": "orange"})
+ Plot.colorLegend()
)
(
Plot.line(my_data, stroke=Plot.constantly("Progress"))
+ Plot.colorMap({"Progress": "orange"})
+ Plot.colorLegend()
)
Out[5]: