Sciencey graphs with Matplotlib from SciPy

This is my first post in a series of examples of graphing using available technical tools, and today I feature the Matplotlib bindings from SciPy.  It does a decent job of plotting, supports LaTeX in labels, and runs on Python.  You will need NumPy and SciPy, both downloadable from the SciPy website.  You can find the Matplotlib documentation to see how to make a scatter plot and many other types of graphs.
One can plot interactively using ipython (as in “ipython –pylab”) or from IDLE or a Python script by importing pylab (as in “from pylab import *”).  Here’s a schematic example:


from pylab import * # not needed if run from ipython --pylab
Independent_Variable = arange(0, 5, 0.1) # You should enter some data here, like [0.0, 0.1, 0.2, 3.1]
Dependent_Variable = sin(Independent_Variable) # You should enter some data here like [-3.2, 44.8, 91.2, 5.0]
Dependent_Variable_Error = 0.1*abs(randn(len(Dependent_Variable)))
Fit_Coeffs = polyfit(Independent_Variable, Dependent_Variable, 2) # 2 is for 2nd order polynomial
Dependent_Variable_Best_Fit = polyval(Fit_Coeffs, Independent_Variable)
figure()
errorbar(Independent_Variable, Dependent_Variable, yerr=Dependent_Variable_Error, fmt='o', label='experimental run 1') # fmt='o' makes dots
plot(Independent_Variable, Dependent_Variable_Best_Fit, label='best fit quadratic polynomial') # You can enter mathematics in the labels between dollar signs, like 'best fit $y=ax^{2}+bx+c$'
xlabel('Independent Variable axis label (IV units)')
ylabel('Dependent Variable axis label (DV units)')
legend() # This adds a legend using the "label=" part of the commands above.
title('Scatter plot with error bars') # Be descriptive!  What is the context?
show() # Needed when not running from ipython

This code generates a graph that can be exported to a PNG image file, which looks like this:

What works for ghosting dry-erase markers

Or, Why my wife wants to kill me for buying too many cleaning supplies

We whiteboard a lot in my class, and although it has been expensive to try so many things and is labor intensive, I still haven’t spent more on cleaning supplies than what three or four group-size regular dry erase boards would cost.  I’m collecting what I’ve personally tried to remove dry-erase marker stains from shower/panel board (a cheap whiteboard solution with a not totally smooth melamine surface).

Whiteboards were marked and left for a day to test various treatments. Fiducial controls included water and diluted Dawn.

Markers

I’ve used mainly Expo markers.  Expo 2 markers (low-odor) ghost quite badly, so I tried to use regular Expo markers.  Red and purple are the worst colors.  I had students use mainly black, blue, brown, green (which leave a haze behind), and red (which ghosts).  When I run out of Expo markers this year, I’m going to get AusPen refillable dry-erase markers.  I’ve tried them on my whiteboards, and in rough order of easy of erasing (high to low) the colors are black, orange, blue, green, red, purple.  I’m going to try black, orange, blue, and green, but orange isn’t the darkest color.

Cleaning rags

I’ve used Expo dry-erase erasers and rags made from cotton T-shirts (ok but they stain forever) and old sheets (modal and high—actually too high—thread count cotton, which stain also).  Our janitor swears by old sheets from hotels, which have a much lower thread count.  Even when stained, rags continue to work well dry.  I have students use one set of “erasers” dry and another set (not actual erasers!, just rags) wet.  Dry rags get most of the dry-erase marker marks, but some colors ghost worse than others.

For my classes, I use my old high-thread count modal sheet rags to replace my aging supply of old Expo dry-erasers, both for dry-erasing.  The Expo dry-erasers can be washed with soap and water, but it’s something I only do about twice per year.  I use my old cotton undershirt rags for wet-erasing.  I wash the whole lot of rags after a week of heavy use or every few weeks of light use.

Everyday cleaners (for cleaning within 2 hours or so)

  • water — It works surprisingly well but not for “bad” colors left on for more than a day.  This is what I use in my classes in small spray bottles.  I have students dry-erase first so that the set of wet rags doesn’t get too stained and smear the colors everywhere.
  • ultra-concentrated Dawn dish-washing detergent and water (in about a 1:5 to 1:20 ratio) — The degreasers are reported to work well, and I concur.  I keep some in a spray bottle for occasional cleaning.
  • Expo cleaner — This is what I used last year.  It smelled, didn’t work much better than Dawn, and seemed to eat away the wax finish quickly.  Further, it seemed to leave a residue that increased ghosting, and the solvents pulled chunks of pigment out of old rags, leaving streaks of color on the “cleaned” whiteboards.

For removing stubborn marks (left on for more than a day)

  • Denatured alcohol — This is my new favorite.  It’s pretty cheap at a hardware store.  I can’t report yet on how fast it takes the finish off the whiteboards, though.
  • De-Solv-it (citrus based) — It works well.
  • Dirty Jobs All-Purpose Heavy-Duty Degreaser — It works well.
  • Dirty Jobs Fresh Citrus Heavy-Duty Multi-Surface — It doesn’t work very well at all.
  • Cleaning Vinegar (6% acidity) — It doesn’t work at all.
  • Diluted Simple Green — It works pretty well.
  • Formula 409 Cleaner — I remember it working pretty well, but I ought to try it again.
  • GMS Surface Tech’s Whiteboard Cleaner — It wouldn’t remove blue and green marks left for a day.  (The red and purple marks just came off with water.)  (Full disclosure: GMS Surface Tech was kind enough to send me a sample bottle to try.)
  • GMS Surface Tech’s HPG™ Odorless Whiteboard Rejuvenator Solution — It works well (minimal polishing) in removing blue and green marks left for a day.  (The red and purple marks just came off with water.)  It did leave a residue that increased ghosting and made it harder to erase.  (Full disclosure: GMS Surface Tech was kind enough to send me a sample bottle to try.)
  • 91% isopropanol (Wal-Mart) — It works OK (heavy polishing) in removing blue and green marks left for a day.  (The red and purple marks just came off with water.)  Diluting it to about 35% resulting in something that didn’t work much better than diluted Dawn but with a more penetrating odor.
  • Mr. Clean Magic Eraser — It works well, though I have found that it only works well by abrading the surface.  Too much elbow grease and you’ll quickly wear holes in the whiteboard suface.
  • Goof Off Heavy Duty Spot Remover & Degreaser — It works well.

Note: Since GMS Surface Tech was kind enough to send me two of their products to try, I should emphasize that my informal tests don’t at all suggest how well their products would work on regular whiteboards, only on fake-whiteboard surfaces like shower boards.

See also the section below on rubbing compound.

And the ones I can’t yet report on because I haven’t tried them yet:

  • Baking soda and water
  • Ammonia
  • Goof Off Heavy Duty Spot Remover & Degreaser
  • Möstenböcker’s Lift Off 3 Graffiti Remover

Whiteboard surface treatments

I’m always looking for that magical treatment that would make my whiteboards pristine, but I haven’t found it yet.  Maybe one day I will try the whiteboard paint on top of one after I sand it down…

  • Nu Finish Cling Instant Detailer (spray bottle) — It makes marks easy to erase, but the dry-erase markers don’t write well on top of it until it wears off a little.
  • Turtle Wax Carnauba Cleaner Wax (yellowish jelly in a tub) — I haven’t used this enough to know if it works well or not.
  • Turtle Wax Super Hard Shell Car Wax (upright bottle; says “hard shell finish”) — I used this all last year, and it seemed to work well.  Right after coating, marker seemed to bead up on the surface, but this effect went away after a few cleanings.  I applied it about once every two or three weeks, but I think the Expo cleaner took it off pretty fast.  Also, I’m noticing this year of not using a wax has resulted in whiteboards that erase much better with only dry erasing.
  • Turtle Wax Express Shine Spray Car Wax (spray bottle; says “hard shell finish”) — I haven’t used this enough to know whether it works well yet.  It seems a little thin, but that doesn’t mean it doesn’t work, I suppose.
  • Turtle Wax Polishing Compound (upright bottle; for light to medium scratches) — I haven’t tried this yet, but it’s cousin below works well.
  • Turtle Wax Rubbing Compound (upright bottle; for medium to heavy scratches) — I tried this last year to fill in scratches in my whiteboards and found that it took off the green ghosting haze on my whiteboards (perhaps by abrasion?).  If you rub too hard, you’ll probably take off the Melamine finish, but it works well for stubborn marks.  I put a layer of the Turtle Wax Super Hard Shell Car Wax on top of it after I’m done.
  • GMS Surface Tech’s HPG™ Odorless Whiteboard Rejuvenator Solution — It works well (minimal polishing) in removing blue and green marks left for a day.  (The red and purple marks just came off with water.)  It did leave a residue that increased ghosting and made it harder to erase.  (Full disclosure: GMS Surface Tech was kind enough to send me a sample bottle to try.)  [Update on 2014-01-29:]  When I tried the GMS Surface Tech Rejuvenator and Whiteboard Cleaner on a much-abused traditional whiteboard in my class, it did a decent job of preventing future ghosting, and although it did not take off all the old stains, it did lighten them a little.

For applying these surface treatments, I use a fine sponge or rag to spread them, rubbing lightly.  I buff them with a microfiber cleaning cloth.