✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

API documentation for plotly.graph_objects.layout.Slider

I want to customize a slider for an interactive plot, the labels property for instance.

As usual, I start with an example from the documentation Python > Custom Controls > Sliders.

Since there is no indication about the slider labels, the next step is to read the API documentation.

Beginning from the top with the plotly.graph_objects.Layout, I am able to found out that the sliders argument is " A tuple of plotly.graph_objects.layout.Slider instances or dicts with compatible properties".

So let’s go with a search for plotly.graph_objects.layout.Slider, which seems not to exist.

All I can found is a page for plotly.graph_objects.layout.slider package, which is not what I want, and seems useless anyway since it only contains a description of subpackages.

I finally solved my very problem by founding out an example online using the label argument (which I was searching for, not knowing its existence before).

However, this is not the first time I encounter such a problem, ending up on a useless subpackages description page instead of the wanted one, which may even not exists at all.

So the point of this post may be more about stating a general issue of the documentation, than asking a question. But maybe I’m badly using the documentation, so :

  • Why is some pages inexistant in the API documentation (like the one for plotly.graph_objects.layout.Slider)
  • What is the point of subpackages description pages (like the one for plotly.graph_objects.layout.slider package)
  • Is there a better way to find all the property of an object of interest ?

Afterwards, I found out the existence of the Figure Reference documentation, which may have solved my problem since it stated the existence of the label property, but as child of layout.sliders[].steps[], which is quite difficult to navigate in.

  • Why is there both an API documentation and a Figure Reference, not linking one to each other ?

Thank you

@aimep

A partial answer to your many questions.

When in API docs the description of a class attributes stops, like in your case to plotly.graph_objects.layout.Slider, then you can find out the slider attributes as follows:

import plotly.graph_objs as go
help(go.layout.Slider)

Among them you’ll see:

currentvalue
 |          :class:`plotly.graph_objects.layout.slider.Currentvalue
 |          ` instance or dict with compatible properties

Now a new help(go.layout.slider.Currentvalue)
will display information on currenalue, and so on.

In other words even when the API docs do not provide the description of an attribute, they are pointing out a path from each parent class to any of its children. In this case you have to go on on that path.

Thanks for the answer, I’ll be able to navigate in the documentation this way.

And sorry for the many questions, they came up related, hence only one post, but I’ll try to be more concise next time.