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
 Pie chart inside bubble?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JordiPlana

1 Posts

Posted - 12/22/2016 :  03:27:03 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2016 (64-bit) b9.3.226
Operating System: Windows 10

Hi. I would like to know if this is possible: I have a ternary plot with bubbles. Is it possible to make the inside of the bubble a pie chart?

Thanks in advance.

Hideo Fujii

USA
1582 Posts

Posted - 12/22/2016 :  2:48:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi JordiPlana,

I'm sorry for that the following is a possible procedure not for ternary, but for the Cartesian system
1) Book1 for Bubble Data (XYY) with N (say 3) rows. Add extra 3 columns (D, E, F)
2) Book2 for Pie Data with N columns.
3) Create Bubble chart from Book1 (Graph1)
4) Create Pie charts from columns in Book2 in order (Graph2, .., Graph4)
  Note: Remove surrounding box by turning OFF check boxes of XAxes, YAxes, and Labels 
    in Show Elements in Display tab for Layer1.
5) ALT+Click every Pie chart (in order) to select the layer frame, copy-and-paste it into the bubble chart
  Note: To view the pasted the Pie charts easily, you can zoom out the displayed page Zoom, say to 50%, setting in Standard toolbar.
6) Run the following script:

/////////////////////////////////
PieSizeFactor=1.7;
bk$="Book1";   //Book name of bubble data
gr$$="Graph1"; //Graph name of bubble chart

NP=bk$!wks.maxrows;  //number pf Pies
%(bk$)_D=100*(%(bk$)_A-%(gr$)!layer1.x.from)/layer1ScaleWidth;
%(bk$)_E=100*(%(bk$)_B-%(gr$)!layer1.y.from)/layer1ScaleHeight;
sum(%(bk$)_C);
%(bk$)_F=%(bk$)_C/sum.total;
layer1HalfWidth=%(gr$)!layer1.width/2;
layer1HalfHeight=%(gr$)!layer1.height/2;
layer1ScaleWidth=%(gr$)!layer1.x.to-%(gr$)!layer1.x.from;
layer1ScaleHeight=%(gr$)!layer1.y.to-%(gr$)!layer1.y.from;
for(ii=1; ii<=NP; ii++) {
  gr$!layer$(ii+1).link=1;
  gr$!layer$(ii+1).unit=7;
  layer2HalfWidth =gr$!layer$(ii+1).width/2;
  layer2HalfHeight=gr$!layer$(ii+1).height/2;
  gr$!layer$(ii+1).left=%(bk$)_D[ii]-layer2HalfWidth;
  gr$!layer$(ii+1).top=100-%(bk$)_E[ii]-layer2HalfHeight;
}
for(ii=1; ii<=NP; ii++) {
  gr$!layer$(ii+1).width=50*%(bk$)_F[ii]*PieSizeFactor;
  gr$!layer$(ii+1).height=50*%(bk$)_F[ii]*PieSizeFactor;
}
for(ii=1; ii<=NP; ii++) {
  layer2HalfWidth=%(gr$)!layer$(ii+1).width/2;
  layer2HalfHeight=%(gr$)!layer$(ii+1).height/2;
  gr$!layer$(ii+1).left=%(bk$)_D[ii]-layer2HalfWidth;
  gr$!layer$(ii+1).top=100-%(bk$)_E[ii]-layer2HalfHeight;
}
Type -b Job done.
////////////////////////////////////

7) If the Pies are not scales nicely, change PieSizeFacto in the code, and run again. Repeat until it looks okay.



I will try to modify this code for ternary later, but as the holiday season arrives tomorrow, it may take time.
If you are in a hurry, try to modify by yourself... sorry!
Anyway happy holidays!

--Hideo Fujii
OriginLab
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