Plotly Express author Nicolas Kruchten here… Great writeup! A few comments:

  1. You can set the default color scheme with px.defaults.color_* or the default template with px.defaults.template
  2. The line graph is messy because it doesn’t sort your data for you… tack on something like .sort_values(by='ShareWomen') to df and the output should look as you expect
  3. Setting the colors explicitly is by design so you can independently control positioning and color of box/violin plots, bars etc…
  4. …but there is an awkward issue wherein if you set just a color and x to the same variable for box or violin plots, then it “leaves room” for cases that don’t occur, but you can grow the boxes back to full width with boxmode='overlay'
  5. You can put your visualization into a presentation fairly easily by exporting it to a static format like SVG, PNG or PDF using plotly.io as documented here https://plot.ly/python/static-image-export/
  6. The lack of documentation is definitely something we’re working on! We’re hard at work on version 4 of plotly which will include Plotly Express as plotly.express and a revamped documentation site that puts px front and center with tons more examples, including all the points above. Should be done in 4–6 weeks… stay tuned :)

Written by

The leading front-end for ML & data science models in Python, R, and Julia.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store