plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
16.22k stars 2.55k forks source link

Using "variable" in plotly.express functions not documented in docstrings #3414

Open maegul opened 3 years ago

maegul commented 3 years ago
facet_row: str or int or Series or array-like
    Either a name of a column in `data_frame`, or a pandas Series or
    array_like object. Values from this column or array_like are used to
    assign marks to facetted subplots in the vertical direction.
facet_col: str or int or Series or array-like
    Either a name of a column in `data_frame`, or a pandas Series or
    array_like object. Values from this column or array_like are used to
    assign marks to facetted subplots in the horizontal direction.
facet_col_wrap: int
    Maximum number of facet columns. Wraps the column variable at this
    width, so that the column facets span multiple rows. Ignored if 0, and
    forced to 0 if `facet_row` or a `marginal` is set.
facet_row_spacing: float between 0 and 1
    Spacing between facet rows, in paper units. Default is 0.03 or 0.0.7
    when facet_col_wrap is used.
facet_col_spacing: float between 0 and 1
    Spacing between facet columns, in paper units Default is 0.02.
linux4life798 commented 2 years ago

I agree. Another instance of this should be documented in the Patterns, Hatching, Texture in Python.

I couldn't find any examples of simply adding patterns/hatching to a basic bar plot where the entire dataframe was plotted.

Bad Example:

years = np.arange(2000, 2022)
values = np.linspace(10000, 100000, 22)
df = pd.DataFrame({
    'Year': years,
    'Company 1 Value': values,
    'Company 2 Value': values * 3,
}).set_index('Year')
px.bar(df,
       pattern_shape='variable',
       pattern_shape_sequence=['/', '\\'],
       barmode='overlay',
       opacity=0.5)
shubhamkulkarni01 commented 1 year ago

Second this. I only discovered this parameter via a recommendation from ChatGPT while trying to debug a plotly.express function. This definitely needs to go into docs somewhere.