[R] Changing Y axis in R

Jim Lemon jim at bitwrit.com.au
Fri Jul 22 14:03:36 CEST 2011


On 07/22/2011 07:16 AM, David Winsemius wrote:
> Context added back in:
>>
>>> SamiC wrote:
>>>> Hi,
>>>>
>>>> So I am trying to plot my results of a model. what i have is the
>>>> majority
>>>> of the data between the values of 0 and 30, then one outlier at 80 and
>>>> another at 130. the model plots a nice line through the data between
>>>> 0 to
>>>> 30, however given the outliers you cant seen this unless you change
>>>> the y
>>>> axis using ylim=c(0,30) but then you can only see the data points in
>>>> this
>>>> range. What I would like to do is plot a y axis with a multiple
>>>> scale, so
>>>> if i have 10 equally spaced ticks, 0 to 8 would be the data between
>>>> 0 and
>>>> 30, and then tick 9 would be 80 and tick 10 130, so that the two
>>>> outliers
>>>> would be show in the graph. I think what i have seen is a graph with
>>>> the
>>>> axis on one scale, then a squiggly line to another scale, and a
>>>> squiggly
>>>> like to a third scale.
>>>>
>>>
>> DW wrote:
>>> I seem to remember a post from Sarkar that there is no provision for
>>> broken axes in lattice, so you will perhaps need to stay with base
>>> graphics. The places to look for this sort of request are in plotrix
>>> and TeachingDemos packages. I seem to remember such a question in the
>>> past, so if that isn't immediately effective (actually it was when I
>>> just checked so I am leaving it as an exercise for the poster), then
>>> do some searching in the archives. And I see you are on posting from
>>> Nabble. Nabble is not a particularly good place to do searches. Use
>>> Baron's site, or Rseek, or sos::findFn, or Markmail or gmane. They
>>> are all bette for searching. You might want to read the Posting Guide
>>> too.
>
>
> On Jul 21, 2011, at 4:51 PM, SamiC wrote:
>
>> Hi, couldn't find much in the archives. I had checked before posting.
>> Anyway the plotrix package was a good hint. So anyone who reads this in
>> future, i ended up using the gap.plot function in the plotrix package,
>> which
>> does the trick. Thanks
>
> Interesting ... I had thought it was axis.break that would do the job,
> but it looks as though the two are interdependent.
>
Yes, the gap* functions use the gap style of axis break to separate the 
different areas of the plot.

Jim



More information about the R-help mailing list