## Problem with axis in gplot

Frequent Contributor
Posts: 131

# Problem with axis in gplot

Hi,

I am doing a simple plot with proc GPLOT y have two values in vertical axis (left and right).

When I show the graph I don't have the same top value in both axis, is possible to set the same top for boh axis,

for example, range 200 to 1200 for axis1 and axis2.

my code:

PROC GPLOT DATA = predic3;
PLOT val_real * date /
VAXIS=AXIS1
HAXIS=AXIS2
FRAME LEGEND=real;
PLOT2 val_pre * date = 2 /
VAXIS=AXIS3
OVERLAY LEGEND=previsto ;
run;

and my plot:

Any advice will be greatly appreciated.

Super User
Posts: 9,193

## Re: Problem with axis in gplot

Posted in reply to juanvg1972

Move to sgplot, it is far simpler to any type of graph with the modern graphing setup, for instance:

http://documentation.sas.com/?docsetId=grstatproc&docsetTarget=p0wvmd88sz151ln1i1vx8l72b73c.htm&docs...

Super User
Posts: 12,994

## Re: Problem with axis in gplot

Posted in reply to juanvg1972

If you are going to reference AXIS statements then you should show the code for the axis statements used.

I am going to guess that one or both do not have Order sections to control the tick mark values

Frequent Contributor
Posts: 131

## Re: Problem with axis in gplot

This is my code. Thanks for your help:

PROC SORT
DATA=WORK.PREDIC3(KEEP=DATE val_real val_pre)
OUT=WORK.SORTTempTableSorted
;
BY DATE;
RUN;
SYMBOL1
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2

CV = _STYLE_
;
SYMBOL2
INTERPOL=JOIN
HEIGHT=10pt
VALUE=NONE
LINE=1
WIDTH=2

CV = _STYLE_
;
Legend1
FRAME
;
Axis1
STYLE=1
WIDTH=1
MINOR=NONE

;
Axis2
STYLE=1
WIDTH=1
MINOR=NONE

;
Axis3
STYLE=1
WIDTH=1
MINOR=NONE

;
TITLE;
TITLE1 "Gráfico de línea";
FOOTNOTE;
FOOTNOTE1 "Generado por el Sistema SAS (&_SASSERVERNAME, &SYSSCPL) el %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) a las %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
PROC GPLOT DATA = WORK.SORTTempTableSorted
;
PLOT val_real * DATE  /
VAXIS=AXIS1

HAXIS=AXIS2

FRAME	LEGEND=LEGEND1
;
PLOT2 val_pre * DATE  = 2 /

VAXIS=AXIS3

OVERLAY
LEGEND=LEGEND1

;
/* -------------------------------------------------------------------
Fin de código de la tarea
------------------------------------------------------------------- */
RUN; QUIT;
SAS Employee
Posts: 1,024

## Re: Problem with axis in gplot

Posted in reply to juanvg1972

add the following to both axis statements ...

order=(200 to 1200 by 200)

Discussion stats
• 4 replies
• 246 views
• 4 likes
• 4 in conversation