Removing Legend

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Removing Legend

Kara
Good morning everyone. Sorry if this posted twice, I seem to be having problems with email.

I have spent hours on this problem and I can't seem to resolve the problem. I am working on a nursing time study and I want to produce a histogram - actually I have to produce over 100 of the charts by the project's end. The time is in hours. In all my summary statistics the mean, std. dev is in hours. In the histogram, the std dev is in days. Since I can't seem to fix the hours to day conversion, I thought I would remove the legend. But that doesn't work either. I've tried different variations of GUIDE: legend(aesthetic(aesthetic.size), null()) (probably incorrectly) but the histogram legend remains. Below is an example of the type of data I'm working with and the histogram syntax.

Any help would be appreciated. Ideally, I would love the histogram summary std. dev show in hours not in days. But, if that isn't possible, removing it would work as well.

Thanks

Kara

DATA LIST LIST
 / numevent (f5.0), Event1(TIME5).
BEGIN DATA.
1001, 3:30
1002, 1:15
1003, 2:45
1004,10:15
1005, 0:15
1006, 0:45
1007, 4:00
1008, 2:30
1009, 3:15
1010, 4:30
1001, 3:30
1002, 1:15
1003, 3:45
1004, 2:15
1005, 0:15
1006, 0:45
1007, 2:15
1008, 2:30
1009, 2:15
1010, 3:30
END DATA.

DATASET NAME timetest.
DATASET ACTIVATE timetest.

FREQUENCIES VARIABLES=Event1
  /STATISTICS=STDDEV RANGE MINIMUM MAXIMUM MEAN MEDIAN MODE SUM
  /ORDER=ANALYSIS.


GGRAPH
  /GRAPHDATASET NAME="timetest" VARIABLES=Event1
  /GRAPHSPEC SOURCE=INLINE.
BEGIN GPL
  SOURCE: s=userSource(id("timetest"))
  DATA: Event1=col(source(s), name("Event1"))
    SCALE: linear(dim(2), include(0))
  GUIDE: axis(dim(1), label("Event1"))
  GUIDE: axis(dim(2), label("Count"))
  GUIDE: text.title( label( "Time Test" ) )
  GUIDE: legend(aesthetic(aesthetic.size), null())
  ELEMENT: interval(position(summary.count(bin.rect(Event1, binCount(9)))))
  ELEMENT: line(position(density.normal(Event1)))
END GPL.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Removing Legend

Andy W
Do you mean the summary statistics box? That is buried in the default chart template and is not a legend (so cannot be turned off via GPL code). See this blog post for a description of removing it, https://developer.ibm.com/predictiveanalytics/2016/02/02/removing-the-histogram-summary-frame/. (If people get irritated about me self-promoting my own blog posts, that is someone elses!)

If you just want to download a chart template that has this removed already, the current one I use is at https://www.dropbox.com/s/drnd9nddedd8w6m/chart_style%28AndyW2-presentation%29.sgt?dl=0. Mine changes the bars to grey as well. Example of my default template to your data example below.



That is weird that the summary statistics are in days (I was able to replicate with the default chart template in V22). A potential way to fix that might be to convert the data to fractional hours. The underlying time variable is seconds, so if you do:

COMPUTE FracHours = Event1/(60*60).

and then plot FracHours in the histogram the default statistics will be on the hourly scale.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: Removing Legend

Kara
In reply to this post by Kara
Andy,

Thanks, your suggestions worked and I now have the charts without the summary statistics. I appreciate your help. I kept getting an odd result with the fracHours, so I'm going to check my data just to make sure.

Thanks again, you've saved me days of work on all of these charts.

Kara

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD