File Exchange

image thumbnail

Thermometer plot

version (3.34 KB) by Eric Ludlam
Draw a thermometer style plot


Updated 01 Sep 2016

View Version History

View License

A Thermometer plot, like the ones you see when a small town wants to buy a new ambulance.

Cite As

Eric Ludlam (2021). Thermometer plot (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)



edvin skaljo

Iram Weinstein

I'm puzzled by the MIN argument
>> thermometer([.1 .2 .3],0.1,1)
??? Error using ==> rectangle
Width and height must be > 0.

also look at odd results from
thermometer([.1 .2 .3],-1,1)

John D'Errico

Much better now. My opinion of thermometer is "warming up". I noticed only one other flaw after a more careful look.

The help shows no indication whether the values plotted will be considered as cumulative numbers or as increments. Thus how will the call

thermometer([.1 .2 .3],0,1)

be interpreted? Thermometer assumes that these numbers are differences, but this assumption is never stated in the help. Never force your users to guess how your code will work. I will always guess incorrectly.

Regardless, I'll give it a 5 rating now and hope the author cleans up this flaw of assumption in the documentation.

John D'Errico

This is a nice addition to our plotting capabilities in Matlab. The obvious bug demands I should give this code a low rating, but I really did like the idea in general. So I'll hope the author chooses to repair these problems. If so, I'll return to do more extensive testing and provide an actual rating.

Problems identified from quick tests:

When called with no outputs, thermometer still returns a figure handle. Far better (and consistent with most Matlab codes) is to add a check like:

% check for no outputs
if (nargout==0)
clear h

Here is the bug:

??? Index exceeds matrix dimensions.

Error in ==> thermometer at 111
surface('xdata', [ 0 1 ] , 'ydata', [ bottom bottom+data(i) ], ...

MATLAB Release Compatibility
Created with R14SP3
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!