The new default colormap for matplotlib is called “viridis” and it’s great!

It’s probably not news to anyone in data visualization that the most-used “jet” colormap (sic) (sometimes referred to as “rainbow”) is a bad choice for many reasons.

  • Doesn’t work when printed black & white
  • Doesn’t work well for colourblind people
  • Not linear in colour space, so it’s hard to estimate numerical values from the resulting image

The Matlab team recently developed a new colormap called “parula” but amazingly because Matlab is commercially-licensed software no-one else is allowed to use it!
The guys at Matplotlib have therefore developed their own version, based on the principles of colour theory (covered in my own BSc lecture courses on Visualization :) ) that is actually an improvement on parula. The new Matplotlib default colormap is named “viridis” and you can learn all about it in the following lecture from the SciPy 2015 conference (YouTube ):

Viridis will be the new default colour map from Matplotlib 2.0 onwards, but users of v1.5.1 can also choose to use it using the command.
I don’t know about you, but I like it a lot and will start using it immediately!

[PDF] “Grain-size dependent demagnetizing factors in permanent magnets” reprint update

The reprint of our Journal of Applied Physics (JAP) paper “Grain-size dependent demagnetizing factors in permanent magnets” has been updated since the old version was not being discovered by the Google Scholar crawler.

There is also now a version on arXiv. I hope that Google Scholar will now correctly index the paper so that it’s easier for people to find!

The full, correct reference for the paper is:

S. Bance, B. Seebacher, T. Schrefl, L. Exl, M. Winklhofer, G. Hrkac, G. Zimanyi, T. Shoji, M. Yano, N. Sakuma, M. Ito, A. Kato and A. Manabe, “Grain-size dependent demagnetizing factors in permanent magnets”, J. Appl. Phys. 116, 233903 (2014);


Equations in Gmail with the “TeX for Gmail” Chrome extension

Science via email

One thing scientists and engineers have to do daily is discuss collaborative work via email exchanges. This often includes the need to share and discuss mathematical equations and to represent variables with subscripts and superscripts or special characters; something that is tricky when you are emailing in plain text.

WikiImages / Pixabay

Of course it is possible to work around this problem! Email was invented by scientists, and for decades they have been communicating in this manner, using various conventions to convey the correct information using plaintext. However, if you are a Gmail user there is a nice extension that will make your equations look proper good.

Tex for GmailGmail-logo

TeX for Gmail is a Chrome browser extension that checks a Gmail email that you are writing for LaTeX markup and converts the markup to a visually prettier equation, using one of two modes. In Simple Math mode, subscripts and superscripts are correctly formatted but the current font is maintained and text remains ediatble. In Rich Math mode, the equation is rendered into TeX and replaced by an embedded image.  The email recipient doesn’t need the extension installed on their browser in order to read your nice equations!


Original markup:

$E = mc^{2}$

Simple Math mode:

E = mc2

Rich Math mode:
E = mc^{2}


One problem; once the extension has converted my markup to formatted text, I cannot get the markup back. So editing a small mistake usually means re-doing all the curly brackets and other stuff that a TeX equation requires. The only workaround seems to be to stay vigilant and use Undo (Ctrl-z), but this doesn’t work when you notice a mistake in an equation that you wrote a while ago. One improvement could be the option to restore any equation to the original markup.


Overall, a great little tool to improve the clarity of science and maths communications over email. With a few small improvements it could be even better but it is already very usable.

HP Spectre x360 keyboard turning off; problem solved!

I recently bought a new notebook; the HP Spectre x360, a 13” convertible ultra-slim notebook PC. It is a really nice piece of hardware, chiselled from solid aluminium with great battery life, decent performance and a pretty usable keyboard.

When the laptop is folded back it automatically converts to tablet mode, wherein the keyboard is automatically turned off so that the keys are not accidentally pressed while using the touchscreen interface.

But since I bought it I have found that, on booting up the device in laptop mode, with it sitting open on my desk, the keyboard is mistakenly turned off. No amount of opening and closing the screen will trick the keyboard into coming on, and it is necessary to log in using the touchscreen interface and on-screen keyboard. After lots of opening and closing it seemed that eventually the keyboard would come back on but there seemed to be no logic to the problem at all.

This post on the official HP forum describes a similar problem. Unfortunately the HP rep simply assumes a hardware fault in the hinges and advises the owner to send it back for repair. However, once my keyboard is on, the connection stays on even as I adjust the screen angle, so it seems a hinge connection failure is not the issue here.

Finally, after much confusion, I found the answer: When the laptop is rotated sideways it attempts to switch to tablet mode, even when I have not adjusted the screen angle. The sensing it done by an orientation sensor in the base of the laptop, not in the hinges! I have found that, to turn the keyboard back on and to go to laptop mode I can tilt the whole laptop towards me slightly, and voila! So far it has worked every time. I wish that there had been some way for me to find this answer out earlier!

Still no viable 13.3 inch eReader…. hurry up!

Netronix and, purportedly also Onyx International, are developing 13.3 inch screen eReaders using eInk’s Mobius screen, as rivals to Sony’s expensive, PDF-only DPT-S1 Digital Paper. A new video shows the Netronix device prototype being displayed at a recent trade show:

Unfortunately, it seems that without a major company to put up the money to manufacture, market, distribute and sell it the device won’t become available to consumers. That is a real shame! Many people, myself included, would love to have such a device for taking notes or reading scientific papers, magazines and textbooks that don’t display well on, say, a Kindle.

However, I think there is one weakness of the device. Although I haven’t had the privilege of demoing one, the problem also exists on my Onyx Boox M96. Writing with the stylus is not actually that good! Because there is a delay in the line/text appearing as you write it is very hard to write accurately. This seems to make writing small text very difficult since the required stylus strokes are shorter and writing is quicker. The lady in the above video seems to avoid writing small, maybe subconsciously since she already knows that it doesn’t really work well! The manufacturers should really try to improve this aspect of their devices. Perhaps a faster refresh mode while writing would help. Accurately writing with the stylus is essential when notating articles or books, perhaps between the lines of text.

Maybe the resolution of my M96 screen is too low, so that the drawing line cannot be made thinner for more precise drawing and writing. The Mobius screen is supposed to be higher resolution, so that could fix it.

Another crucial problem with eReaders for textbooks is the navigation inside the book, being able to quickly jump between different parts of the book and back again. Think of working on some problems in a Maths textbook and trying to jump to the back for the solutions every few minutes! The software on the device is therefore of utmost importance.

Having stated these problems, I would probably buy one immediately anyway. Please make it available soon!

Update: It looks like Onyx were serious about their 13.3 inch device! It is expected for release in Spring 2016!