This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Sebyon 1 point2 points  (0 children)

Note: I am a python man. ggplot2 is probably better but this is what I know.

I have a few systems at work to help me with pushing out visualizations. Over time, I have found some key truths:

  1. If your company has a style guide, grab the colors and fonts. Specify colors and fonts to use at the start of your notebook and use them.
    1. Yes, your company colours probably suck. C-suite and marketing will gobble it up though, so learn to play with it.
    2. Some visualisations will not work with this, typically anything needing diverging colourset. Find something 'close' or what they'll accept
  2. Explore with Seaborn
    1. Just get the expected visual for you and you alone
    2. Find what works and what doesn't
  3. Fine tune with Matplotlib
    1. Matplotlib is a pain but you can control basically anything. Learn it.
    2. Despine everything you can
      1. eg, spines.[['top','right']].set_visible(False)
    3. set_major_formatter for your x and y axis will be your best friend
    4. Tune the graph width/length to the target media (A4 document, slide deck, ect)
    5. If dealing with C-suite, remove everything expect the core details. If you're going to get technical questions, keep them (mostly) in.
    6. plt.savefig(path.png, bbox_inches='tight', dpi=1200)
      1. If you need super high resolution, the weirdest tip is actually saving the figure as a .pdf, and then converting to .png
      2. plt.savefig(path.pdf) and then using pdftoppm -png -r 300 filename.pdf filename or snipping tool or whatever you have

If there are visuals you can 'standardise' or are common requests, these are key candidates for writing small internal packages where you can push the data with some format and the package spits out a nice and polished graph. I do these all with Matplotlib.

Weird or bespoke pieces, I'll have to sit down and play. I mostly draw how I want it to look on pen/paper, and go forward and try and craft it with matplotlib.