setelem in scatter diagrams

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

Posts: 13
Joined: Fri May 28, 2010 5:27 am

setelem in scatter diagrams

Postby zezza » Fri Mar 16, 2018 3:43 am

I wanted to plot a scatter diagram between X and Y, but since the correlation changes over time, I wanted to have different colors corresponding to different periods. Therefore I created Y1, Y2, ... Y5, and used
graph mychart.scat X Y1 Y2 Y3 Y4 Y5
mychart.setelem(1) legend(X)
mychart.setelem(2) symbol(1) legend(Y1)
mychart.setelem(3) symbol(2) fillcolor(red) legend(Y2)
mychart.setelem(4) symbol(2) fillcolor(green) legend(Y3)
mychart.setelem(5) symbol(2) fillcolor(blue) legend(Y4)
mychart.setelem(6) symbol(3) fillcolor(orange) legend(Y5)

But the output is not what I expect. The second series (Y2) is displayed in red (as expected) but with a cyrcle (symbol(1)) instead of a filledcircle. Y3 is as expected. Y4 is black rather than blue, and Y5 uses a filledcircle instead of a transciircle, and it is not orange

In scatter diagrams, setelem(1) corresponds to the first Y series? Or to the X series?

I suspect that fillcolor is not working as expected in scatter diagrams

Thank you for your replies!

EViews Jason
EViews Developer
Posts: 779
Joined: Tue Sep 16, 2008 3:50 pm

Re: setelem in scatter diagrams

Postby EViews Jason » Fri Mar 16, 2018 8:21 am

In scatter diagrams, setelem(1) refers to the first Y series. So this partially explains why you are not getting the expected format.

The second part is you will want to use linecolor instead of fillcolor. Despite what our docs say, fillcolor refers to the color for bars, pies, and areas and not symbols. Linecolor refers to the line color along with the symbols.

I believe what you want is

Code: Select all

mychart.setelem(1) symbol(1) legend(Y1)
mychart.setelem(2) symbol(2) linecolor(red) legend(Y2)
mychart.setelem(3) symbol(2) linecolor(green) legend(Y3)
mychart.setelem(4) symbol(2) linecolor(blue) legend(Y4)
mychart.setelem(5) symbol(3) linecolor(orange) legend(Y5)

Posts: 13
Joined: Fri May 28, 2010 5:27 am

Re: setelem in scatter diagrams

Postby zezza » Sat Mar 17, 2018 12:08 am

Thank you! It now works as expected
Please update the manual :-)

Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 10 guests