[R] Changing radii line type in radial plots
Peter Ehlers
ehlers at ucalgary.ca
Tue Oct 30 07:58:35 CET 2012
On 2012-10-29 11:34, Bernie Wone wrote:
> ok got it to work, but my original question was, is it possible to set
> the radii or axes one line type and the circles another type (please
> see attached)? Thanks!
That wasn't clear in your original request. But it's easy.
To provide arguments for setting the circle/radius line types
separately is essentially the same process that I've already
shown you. Modify the same two lines that I referenced in the
previous discussion:
1. Change
polygon(xpos, ypos, border = grid.col, col = grid.bg)
to
polygon(xpos, ypos, border = grid.col, col = grid.bg,
lty = gridcircle.lty)
and
segments(0, 0, xpos, ypos, col = grid.col)
to
segments(0, 0, xpos, ypos, col = grid.col,
lty = gridradius.lty)
Then add two arguments to the function's argument list:
gridradius.lty = 1, gridcircle.lty = 1
Modification that will permit different colours for the
circles/radii is left as an exercise.
Peter Ehlers
>
> On Fri, Oct 26, 2012 at 10:59 AM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
>> On 2012-10-25 14:42, Bernie Wone wrote:
>>>
>>> Hi Peter,
>>>
>>> Thanks for the help. Being a beginner R user with little programming
>>> experience, once I source in "myradial.plot" in my R session, what do
>>> I use to plot. In other words, before I used radial.plot(), but now
>>> when I state myradial.plot(), it tells me that it can find the
>>> function.
>>>
>>> Thanks,
>>> Bern
>>
>>
>> You may be misunderstanding my suggestion.
>> I'll assume that you are editing the file saved by capture.output().
>> Let's call it 'rp.txt'. After making the edits that I suggested,
>> you will need to add
>>
>> myradial.plot <-
>>
>> at the front of the file. You save the resulting edited file, still
>> named 'rp.txt'. Now use source() on that file to get the modified
>> version of the radial.plot function into your R session.
>>
>> Peter Ehlers
>>
>>
>>>
>>> On Wed, Oct 24, 2012 at 7:10 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
>>>>
>>>> On 2012-10-24 11:06, bwone wrote:
>>>>>
>>>>>
>>>>> I am using the package plotrix radial.plot(). Yes, radial.plot() has a
>>>>> line
>>>>> type argument, lty, but that is for the polygons or the radial lines,
>>>>> not
>>>>> the radii or axes of the radial plot.....unless I am doing something
>>>>> wrong.
>>>>> Thanks!
>>>>>
>>>>>
>>>>
>>>> First, even if you must post via Nabble, please do keep context.
>>>>
>>>> Now, as to your question: I think I now understand; you want control
>>>> over the line type of the radial grid. You're correct; that's not
>>>> currently possible with radial.plot(), but it's easy to modify the
>>>> function and you can probably nudge Jim Lemon to make the change.
>>>> In the meantime, here's a fix you can apply yourself:
>>>>
>>>> 1. Save the function code (either get the source or just use
>>>> capture.output:
>>>>
>>>> capture.output(radial.plot, file = "rp.txt")
>>>>
>>>> 2. Edit the function; find the following two lines:
>>>>
>>>> polygon(xpos, ypos, border = grid.col, col = grid.bg)
>>>> segments(0, 0, xpos, ypos, col = grid.col)
>>>>
>>>> and add the argument 'lty = grid.lty' to each.
>>>> Then add 'grid.lty = 1' to the function arguments.
>>>> Save the modified function as myradial.plot and source()
>>>> it into your R session and then use it with whatever
>>>> grid.lty setting you prefer.
>>>>
>>>> Peter Ehlers
>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>>
>>>>> http://r.789695.n4.nabble.com/Changing-radii-line-type-in-radial-plots-tp4647238p4647339.html
>>>>>
>>>>> Sent from the R help mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>>
>>
>
More information about the R-help
mailing list