Skip to content

Conversation

@nicolaskruchten
Copy link
Contributor

@LiamConnors here are some tweaks to the docs you recently wrote, just FYI.

@nicolaskruchten nicolaskruchten changed the base branch from master to doc-prod May 11, 2022 12:38
_new in 5.8_

You can position and style minor ticks on a Cartesian axis using `minor`. This takes a `dict` of properties to apply to minor ticks. Available properties include: `tickmode`, `tickvals`, `tickcolor`, `ticklen`, `tickwidth`, `dtick`, `tick0`, `nticks`, `ticks`, `showgrid`, `gridcolor`, `griddash`, and `gridwidth`.
You can position and style minor ticks on a Cartesian axis using the `minor` attribute. This takes a `dict` of properties to apply to minor ticks. See the [figure reference](https://plotly.com/python/reference/layout/xaxis/#layout-xaxis-minor) for full details on the accepted keys in this dict.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general I don't like listing options in the prose docs, as these lists get stale. It's better to link to the reference if needed


fig.update_xaxes(minor=dict(ticklen=6, tickcolor="black", showgrid=True))
fig.update_yaxes(minor=dict(ticks="inside"))
fig.update_yaxes(minor_ticks="inside")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when updating a single attribute or two, I try to favour 'magic underscores' like this, to remind folks this exists

fig = px.scatter(df, x="sepal_width", y="sepal_length", facet_col="species")
fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='LightPink', griddash='dot')
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='LightPink')
fig.update_xaxes(gridcolor='black', griddash='dash', minor_griddash="dot")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the pink was not very attractive, and was hard to see IMO. also, showgrid is on by default in xaxes and gridwidth=1 by default. I try not to explicitly set the defaults in the docs, so folks don't think it's necessary.


fig = px.scatter(df, x="sepal_width", y="sepal_length", facet_col="species")
fig.update_xaxes(showgrid=True, gridwidth=1, gridcolor='LightPink', griddash='dot')
fig.update_yaxes(showgrid=True, gridwidth=1, gridcolor='LightPink')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line wasn't really doing much for the docs so I dropped it


fig = px.line(df, x='Date', y='AAPL.High')
fig.update_xaxes(ticks= "outside", ticklabelmode= "period", tickcolor= "black", tickwidth=2, ticklen=10, minor=dict(ticks="outside", dtick=7*24*3.6e6, tick0="2016-07-04", griddash='dot', gridcolor='pink'))
fig.update_xaxes(ticks= "outside",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was one huuuuge line that needed breaking up into indented code.

minor=dict(
ticklen=4,
dtick=7*24*60*60*1000,
tick0="2016-07-03",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to sundays so that when you zoom in you don't get major ticks on sundays AND minor ticks on mondays ;)

@nicolaskruchten nicolaskruchten merged commit 384a400 into doc-prod May 11, 2022
@LiamConnors
Copy link
Member

Thanks for the feedback @nicolaskruchten

@nicolaskruchten nicolaskruchten deleted the minor_tweaks branch May 11, 2022 18:44
@nicolaskruchten nicolaskruchten restored the minor_tweaks branch May 11, 2022 18:44
@nicolaskruchten nicolaskruchten deleted the minor_tweaks branch May 11, 2022 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants