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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Creating a Colormap Scatter Plot

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Seb136 Posted - 09/18/2018 : 07:48:43 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2017 b9.4.0.220
Operating System:Win10

Hi all,

I have a problem creating a scatter plot with a colormap.



Worksheet wks = Project.ActiveLayer();

DataRange dr;
	
//Creating XYY Range
dr.Add("X", wks, 0, 2, -1, 2);
dr.Add("Y", wks, 0, 4, -1, 4);
dr.Add("Y", wks, 0, 6, -1, 6);
	
GraphPage gp;
gp.Create("Origin");
GraphLayer gl = gp.Layers();
	
gl.AddPlot(dr, IDM_PLOT_INDEX_COLOR); //ID: 247 for Color mapped


This code is my attempt to create a graph that has column 3 as X, column 5 as Y and column 7 as the reference for the color scale.
Instead it just creates a graphpage with columns 5 and 7 as a group and no plot type is selected (so it's just a blank page with axes).

The LabTalk commands I used in this code work as I want them to, execpt that it creates a line plot so I have to use the update_plot_type X-Function.

Worksheet wks = Project.ActiveLayer();
	
wks.Columns(2).SetType(OKDATAOBJ_DESIGNATION_X);
	
LT_execute("wks.ColSel(3,1)");
LT_execute("wks.ColSel(5,1)");
LT_execute("wks.ColSel(7,1)");
LT_execute("Worksheet -p 247");

//use x-function to change plot type to scatter
GraphLayer gl = Project.ActiveLayer();
DataPlot dp = gl.DataPlots(0);
update_plot_type(dp, IDM_PLOT_SCATTER);


Can someone tell me why my OC-code doesn't work as it's supposed to but instead creates a grouped plot?

Thanks a lot
Seb
2   L A T E S T    R E P L I E S    (Newest First)
Seb136 Posted - 09/19/2018 : 03:26:26 AM
Hi Yuki,

thank you very much it works perfectly fine!
yuki_wu Posted - 09/19/2018 : 01:34:22 AM
Hi Seb,

It seems that IDM_PLOT_INDEX_COLOR only works in LabTalk, but you could try method DataPlot::SetModifier
https://www.originlab.com/doc/OriginC/ref/DataPlot-SetModifier
void test_plot_scatter_3()
{
	Worksheet wks = Project.ActiveLayer();
	DataRange dr;	
	//Creating XYY Range
	dr.Add(wks, 0, "X");
	dr.Add(wks, 1, "Y");
	GraphPage gp;
	gp.Create("Origin");
	GraphLayer gl = gp.Layers();	
	gl.AddPlot(dr, IDM_PLOT_SCATTER);
    DataPlot dp = gl.DataPlots(0); 
	if( !dp )
		return;
	Column col(wks, 2);
	dp.SetModifier(COLDESIG_COLOR, col);
	gl.Rescale();
}

Hope it helps.

Regards,
Yuki

OriginLab

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000