That works well if one is using a variable on the axis. In your original example though there was only the `ypll_75` variable on the x-axis and Frequency (Count) on the y-axis. In cases like that only a chart template or manual editing will affect the format of the y-axis tick labels.
Original Message:
Sent: Tue September 17, 2024 11:15 AM
From: Robert Lundqvist
Subject: Axis labels on graph
Since the decimal setting is only for the display, not how and what is stored, I usually put a TEMPORARY command before the GGRAPH syntax.
With v1 defined in whatever format, F4.3 say, the following would set the axis where v1 is used with no decimals:
TEMPORARY.
FORMATS v1(F4).
GGRAPH
/GRAPHDATASET...
.
.
END GPL.
An easy way to avoid the format definitions?
.
------------------------------
Robert
Original Message:
Sent: Tue September 17, 2024 10:13 AM
From: Curtis Browning
Subject: Axis labels on graph
In this case the Y-Axis is Count and the X-Axis variable precision is already set to zero decimals, so either a chart template or a post-creation change was needed.
I do think that it is an error to set the decimal precision to 1 for Counts, so I have filed an enhancement request to get that changed.
Best,
------------------------------
Curtis Browning
SPSS Statistics Architect
Original Message:
Sent: Tue September 17, 2024 09:46 AM
From: Jon Peck
Subject: Axis labels on graph
In many cases, the precision of the marker labels is derived from the decimals setting of the variable, so try changing the decimals setting to zero.
--
Original Message:
Sent: 9/17/2024 9:43:00 AM
From: Curtis Browning
Subject: RE: Axis labels on graph
Hi @Urban Landreman. You can set the precision of Y-Axis tick labels by opening the chart in the Chart Editor, selecting the Y-Axis labels by clicking once on one of them, then opening Chart Editor Properties dialog and using the Number Format tab there to set the precision. See the screen shot below.
Best,
Curtis
------------------------------
Curtis Browning
SPSS Statistics Architect
Original Message:
Sent: Mon September 16, 2024 07:07 PM
From: Urban Landreman
Subject: Axis labels on graph
I'm trying to generate a simple bar graph. My syntax is:
GGRAPH
/GRAPHDATASET NAME="graphdataset" VARIABLES=ypll_75 MISSING=LISTWISE REPORTMISSING=NO
/GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
GUIDE: axis(dim(1), label("Years of potential life lost"))
GUIDE: axis(dim(2), label("Frequency"))
GUIDE: text.title(label("Frequency of Years of potential life lost - 2019-2021: Hispanic/Latino"))
ELEMENT: interval(position(summary.count(bin.rect(ypll_75))), shape.interior(shape.square))
END GPL.
The bar graph gets generated fine, but the Y axis - which is the frequency count - has labels that include one digit after the decimal point, such as 10.0, 20.0, 30.0, etc. Since the Y axis is just frequencies, I want the labels to be simply 10, 20, 30, etc.
How do I get rid of that ".0"?
------------------------------
Urban Landreman
------------------------------