4.33333

4.3 | 3 ratings Rate this file 130 downloads (last 30 days) File Size: 3.34 KB File ID: #12513

Thermometer plot

by Eric Ludlam

 

03 Oct 2006 (Updated 04 Oct 2006)

Code covered by BSD License  

Draw a thermometer style plot

Download Now | Watch this File

File Information
Description

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

Acknowledgements
This submission has inspired the following:
Weather in Boston
MATLAB release MATLAB 7.1.0 (R14SP3)
Zip File Content  
Other Files license.txt,
thermometer.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
03 Oct 2006 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
end

Here is the bug:

thermometer(sort(rand(10,1)),0,1)
??? Index exceeds matrix dimensions.

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

03 Oct 2006 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.

04 Oct 2006 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)

09 May 2007 edvin skaljo  
Please login to add a comment or rating.
Updates
03 Oct 2006

Fix bug when there are more data elements than colors in the axes color order.

04 Oct 2006

Update documentation.
Fix case where MIN ~= 0.
Add some error checking.

Tag Activity for this File
Tag Applied By Date/Time
specialized Eric Ludlam 22 Oct 2008 08:42:21
plotting Eric Ludlam 22 Oct 2008 08:42:21
thermometer Eric Ludlam 22 Oct 2008 08:42:21
goal Eric Ludlam 22 Oct 2008 08:42:21
plot Eric Ludlam 22 Oct 2008 08:42:21
draw Eric Ludlam 22 Oct 2008 08:42:21
graphics Eric Ludlam 22 Oct 2008 08:42:21
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com