[R] insert hyperlink into svg graphic

Sigbert Klinke @|gbert @end|ng |rom w|w|@hu-ber||n@de
Thu Mar 9 08:24:01 CET 2023


Hi,

maybe it would be a good idea to extend plotmath by a href command.

Sigbert

Am 08.03.23 um 22:46 schrieb Paul Murrell:
> Hi
> 
> On 8/03/23 15:27, Rusty Travis wrote:
>> On 3/7/23 13:12, Paul Murrell wrote:
>>> Hi
>>>
>>> I think the main issue here is that you are *drawing* text on the 
>>> graphics device, so I would only expect to see literal XML text 
>>> output in the result.
>>> '''
>>>
>>> Hope that helps
>>
>> Thank you for your consideration of the matter, but that seems 
>> extraordinarily overly-complicated for the results of "help(svg)". 
>> I'll just print the text of the link instead of constructing a link, 
>> as the resultant R-produced *.svg file is about 10 times the size of a 
>> manual screen-print *.png of X11() same.
> 
> Yes, it is not completely straightforward :)
> Though once you have a code template it is not hard to repeat.
> Yes, the generated SVG is verbose.
> Though SVG can be compressed.
> 
>> I'll let the user type the title() noaa.gov uri into their browser 
>> instead of providing a clickable link.
> 
> Glad you have a solution!
> 
> Paul
> 
>> Thank you all.
>>
>>>>  > On 2023-03-07, at 10:33, Bert Gunter <bgunter.4567 using gmail.com> wrote:
>>>>  >
>>>>  > Perhaps this thread on stackoverflow (from a search on "include 
>>>> hyperlink
>>>>  > in svg graphic") may be of use:
>>>>  >
>>>>  > 
>>>> https://stackoverflow.com/questions/41970535/a-hyperlink-in-svg-use 
>>>> <https://stackoverflow.com/questions/41970535/a-hyperlink-in-svg-use>
>>>>  >
>>>>  > Cheers,
>>>>  > Bert
>>>>  >
>>>>  > On Tue, Mar 7, 2023 at 12:34 AM Rusty Travis 
>>>> <rusytravis19 using gmail.com> wrote:
>>>>  >
>>>>  >> Greetings,
>>>>  >>
>>>>  >> I am creating plots of weather data and wish to include a link 
>>>> to the
>>>>  >> data source into a title() object in the plot. My syntax must be 
>>>> wrong
>>>>  >> though, as the hyperlink doesn't display, just the text and tags.
>>>>  >>
>>>>  >>> svg("/tmp/temps.svg", width=9, height=6)
>>>>  >>> #plot created here
>>>>  >>> title(sub="produced by Rusty Travis \nusing data from <a
>>>>  >> xlink:href=https://www.ncei.noaa.gov/cdo-web/ 
>>>> <https://www.ncei.noaa.gov/cdo-web>>test</a> ", line=-1.5,
>>>>  >> adj=1)
>>>>  >>> dev.off()
>>>>  >>
>>>>  >> The goal is to create a hyperlink of the word "test" in the above
>>>>  >> example. What is the correct syntax, please?
>>>>  >>
>>>>  >> [[alternative HTML version deleted]]
>>>>  >>
>>>>  >> ______________________________________________
>>>>  >> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>>  >> https://stat.ethz.ch/mailman/listinfo/r-help 
>>>> <https://stat.ethz.ch/mailman/listinfo/r-help>
>>>>  >> PLEASE do read the posting guide
>>>>  >> http://www.R-project.org/posting-guide.html 
>>>> <http://www.R-project.org/posting-guide.html>
>>>>  >> and provide commented, minimal, self-contained, reproducible code.
>>>>  >>
>>>>  >
>>>>  > [[alternative HTML version deleted]]
>>>>  >
>>>>  > ______________________________________________
>>>>  > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>>  > https://stat.ethz.ch/mailman/listinfo/r-help 
>>>> <https://stat.ethz.ch/mailman/listinfo/r-help>
>>>>  > PLEASE do read the posting guide 
>>>> http://www.R-project.org/posting-guide.html 
>>>> <http://www.R-project.org/posting-guide.html>
>>>>  > and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>> ______________________________________________
>>>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help 
>>>> <https://stat.ethz.ch/mailman/listinfo/r-help>
>>>> PLEASE do read the posting guide 
>>>> http://www.R-project.org/posting-guide.html 
>>>> <http://www.R-project.org/posting-guide.html>
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
> 

-- 
https://hu.berlin/sk
https://www.stat.de/faqs
https://hu.berlin/mmstat
https://hu.berlin/mmstat-ar



More information about the R-help mailing list