The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Matrix colour contour plot - manual scaling??
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

plfreiberg

Germany
Posts

Posted - 01/27/2006 :  06:31:14 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: windows XP

Hi,
I have a 150x150 Matrix that I would like to be plotted as a contour plot. It works fine, but since my data is distributed not very equally in the data range, most parts of the plot are dark and only a few spots are lighter. The log-scale doesnt really help to better that. Is there a possibility to scale the colours that are used manually (e.g. by shifting the colours in the colour scale)?

In the 3D plot details menu there is the option to select scaling: Manual/ normal/ from.../ to... but I couldn't figure out if that is what I need or if it just refers to the axis. (I don't know if the menu title is correct since my Origin version is german, sorry.)

Thanks, Franziska.

Mike

USA
357 Posts

Posted - 01/27/2006 :  09:42:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Franziska,

It's hard to know just what you will need to do, as I can't see your contour plot. However, to edit the color scale, you begin by clicking on the Level button on the Color Map/Contours tab. Here you can set the Maximum and Minimum values, scale Interval,Number of Levels, etc.

Since you are working with a German version of the software, you might find it easier to simply open the Color Map/Contours tab of Plot Details and press the F1 key on your keyboard. That will open the Help file to an explanation of all of the controls in this dialog box.

Maybe you could read this material over and let us know if you are still having problems?

Thanks.

Mike
OriginLab

P.S. Don't forget that Speed Mode has the general effect of "simplifying" a 150 x 150 3D plot. You may want to turn this off (Plot Details, Layer level, Size/Speed tab).

Go to Top of Page

plfreiberg

Germany
Posts

Posted - 01/27/2006 :  10:05:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

thanks for the advice. I always just increased the number of levels but never changed the max/min.
I have far better contrast now...

Franziska.
Go to Top of Page

easwar

USA
1964 Posts

Posted - 01/27/2006 :  3:24:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Franziska,

There is programmatic access for finer control and so these things can be manipulated with Origin C code such as pasted below.

You may also want to review these old forum posts. The code below is mainly taken from those, with some more comments etc.

Note as in remarked in one of the old posts that settings can be saved as theme etc to apply later so not always necessary to program - can program to set and then save theme/template etc.

Easwar
OriginLab

Old posts:
http://www.originlab.com/forum/topic.asp?TOPIC_ID=3843
http://www.originlab.com/forum/topic.asp?TOPIC_ID=4415


void custom_color_map()
{
// Point to active contour data plot
GraphLayer gly = Project.ActiveLayer();
DataPlot dp = gly.DataPlots(-1);
if( !dp ) return;

// Get color map into tree object
Tree tr;
if( !dp.GetColormap(tr) )
return;
// Uncomment next line to dump tree in script window
// to see what is available
//out_tree(tr);

// Get current levels
vector vLevels;
vLevels = tr.Details.Levels.dVals;
// Uncomment next two lines to dump current levels
//for(int i = 0; i < vLevels.GetSize(); i++)
// printf("%d %f\n", i, vLevels[i]);

// Now let us change levels, colors etc
// Following code uses some sample numbers for each
// Modify code as applicable to your data

// Set new min, max
double dMin = -5;
double dMax = 5;

// Change number of levels and values
// In this example we are setting to a nonlinear scale, 2nd order polynomial
int nLevels = 32;
vLevels.SetSize(nLevels);
for(int i = 0; i < nLevels; i++)
{
// Note that level needs to be set as % of (max-min)
vLevels[i] = 100 * (i^2)/(nLevels^2);
// Actual value in dialog/GUI will be:
// uncomment line below to verify
//printf("%f\n", dMin + vLevels[i]*(dMax-dMin)/100);
}

// Write new level info to tree
tr.Min.dVal = dMin;
tr.Max.dVal = dMax;
tr.Details.Levels.dVals = vLevels;

// Now let us set colors for each level, using RGB values
vector<uint> vColors;
vColors.SetSize(nLevels);
// Set colors using some nonlinear function for R, G, B
for(i = 0; i < nLevels; i++)
{
int nRed = 256* i / nLevels; // linear in R
int nGreen = 256 * i^2 / nLevels^2; // power of 2 in G
int nBlue = 128 + 128 * sin(2 * Pi * i / nLevels) ; // sinusoidal in B
vColors[i] = nRed + 256 * nGreen + 65536 * nBlue + OCOLOR_RGB_BITS;
// The above sets colors using direct RGB values
// The offset OCOLOR_RGB_BITS indicates to Origin to interpret as RGB
}

// Write colors to tree
tr.Details.Colors.nVals = vColors;

// Can also set above and below color values, such as:
tr.Details.BelowColor.nVal = 3; // set to 4th color in Origin color list
tr.Details.AboveColor.nVal = 1; // set to 2nd color in Origin color list
// So can use color list index, or RGB as shown previously

// Set new color map properties using upated tree
if( !dp.SetColormap(tr) )
printf("Failed to set color map\n");
}



Edited by - easwar on 01/27/2006 3:29:52 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000