Closed nicolaskruchten closed 4 years ago
@jdamiba let's try to knock this one out this week please.
Open to ideas about the phrasing and the exact code being shown. maybe the code needs to be page-specific, so as to reuse one of the simpler cells, to make it an actual copy-pasteable example... that would be labour-intensive but worth it IMO.
@chriddyp @emmanuelle @alexcjohnson input is welcome on this first pass!
The idea here is that all doc pages get the same little block (for now) and then in some near future we can do per-page blocks that don't show an empty figure.
@jdamiba and I figured out that actually we can append a little bit of Markdown to the notebooks right before rendering them in the CI step, so that this block will get formatted just like any other doc, without having to be manually pasted everywhere. Here is the R PR for this https://github.com/plotly/plotly.r-docs/pull/41 and the Python bit can just go in here somewhere once we agree on the details: https://github.com/plotly/plotly.py/blob/master/doc/Makefile#L32
Nice! I might change the first line to be:
fig = go.Figure() # or the output of any Plotly Express function, like `fig = px.scatter(...)`
and also:
app.layout = html.Div([
dcc.Graph(figure=fig)
])
Since most folks working in plotly are working in jupyter, maybe let's also do this until we fix this in the library level
app.run_server(debug=True, use_reloader=False) # Turn off reloader if inside Jupyter
We need to add, to every R and Python page other than the "Is Plotly Free?" pages, a section at the bottom that reads something like:
What about Dash?
Dash is an open-source framework for building analytical applications, with no Javascript required, and it is tightly integrated with the Plotly graphing library. Everywhere in this page that you see
fig.show()
, you can display the same figure in a Dash application by passing it to thefigure
argument of theGraph
component from the built-indash_core_components
package like this: