5.0

5.0 | 5 ratings Rate this file 13 Downloads (last 30 days) File Size: 1.7 KB File ID: #14001

plotclr

by Stephanie Contardo

 

19 Feb 2007 (Updated 08 Feb 2010)

Plots scattered data colorcoded and adds a colorbar. Based on function plotc.m

| Watch this File

File Information
Description

This function is similar to MATLAB's own scatter3 routine. PLOTCLR(X,Y,V) plots the values specified in V as a color coded scatter plot at the locations specified in the vectors X and Y. The current colormap of the figure is used for the color code.
Improvement from function plotc.m.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
plotc

MATLAB release MATLAB 7.2 (R2006a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
23 Feb 2007 Loren Ayotte

Works wonderful.
Couple comments:
The marker argument isn't needed because you can use the 'plot3' properties to handle the marker type. Also, grid does not need to be default on based on the same reason.

One argument that I added was to invert the ticks so that lower numbers were considered "high". Just edit line 62 (and 64 accordingly) to:
        B=sprintf('%-3.1E',ytl(i)*-1);

Great work!

01 Mar 2007 Val Schmidt

Great Script.

I also made a couple of modifications that might be of general use.

I wanted to plot colored points on top of another 2D plot. For example, I might capture part of a chart or Google Earth image, plot it with 'image', then scale GPS poisitons for each measurement to the image using a few known points, and finally plot the measurements at each position on top of the chart, color coded to their respective values. plotclr as it is written can't do this because it uses plot3 (a 3d plotting tool). Since I didn't want a 3D plot, I didn't see any reason to use plot3. So I changed plot3 to plot. I also deleted the 'delete(gca)' line at the beginning and 'grid on' line at the end.

My new plotclr can plot colored points atop any other plot. Very handy!

29 Nov 2007 Vinod Vishwakarma

Its wonderful
works fantastic, just i need to change colormap manually ever time to change the view of plot.

31 Aug 2010 haidi

Fantastic! This is exactly what I am looking for. Many thanks.

09 Mar 2011 Stefan

Nice tool. May be important to note though that the lower limit is not plotted. For instance,

plotclr(1:10,1:10,[5 1 1 1 1 1 6 9 9 9])

gives only 5 points and omits all data, where Z = 1.

07 Sep 2011 Erica

Excellent! Works very quickly for my large dataset.

Please login to add a comment or rating.
Updates
08 Feb 2010

With little problems fixed.

Tag Activity for this File
Tag Applied By Date/Time
specialized Stephanie Contardo 22 Oct 2008 09:01:06
plotting Stephanie Contardo 22 Oct 2008 09:01:06
scatter Stephanie Contardo 22 Oct 2008 09:01:06
colorbar Stephanie Contardo 22 Oct 2008 09:01:06
color coded Stephanie Contardo 22 Oct 2008 09:01:06
graphics Stephanie Contardo 22 Oct 2008 09:01:06
specialized plot Stephanie Contardo 22 Oct 2008 09:01:06
specialize Stephanie Contardo 22 Oct 2008 09:01:06

Contact us at files@mathworks.com