Making my own graphics device

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

Making my own graphics device

Thomas Levine-4
I want to make my own graphics device am thus looking for
documentation about graphics devices.

The only thing I've found so far is these directions for
making graphics devices with the RGraphicsDevice package.
http://www.omegahat.org/RGraphicsDevice/

Could someone point me to any other resources? Or just
some documentation about how to edit base R? If I don't
get anything, I'm just going to stare at the grDevices
section of the R source code (src/library/grDevices/src)
until I figure out how it works.

In case you're curious, I want to make a graphics device
that saves the graph in Hewlett-Packard Graphics Language.
https://en.wikipedia.org/wiki/HPGL

Thanks

Tom

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Making my own graphics device

Roger Koenker-3
In ancient times, ie circa 1981,  the S language certainly supported HP pen plotters
so there should be code somewhere that could be resuscitated, he said naively.

url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    [hidden email]            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Urbana, IL 61801
On Aug 17, 2014, at 2:58 PM, Thomas Levine <[hidden email]> wrote:

> I want to make my own graphics device am thus looking for
> documentation about graphics devices.
>
> The only thing I've found so far is these directions for
> making graphics devices with the RGraphicsDevice package.
> http://www.omegahat.org/RGraphicsDevice/
>
> Could someone point me to any other resources? Or just
> some documentation about how to edit base R? If I don't
> get anything, I'm just going to stare at the grDevices
> section of the R source code (src/library/grDevices/src)
> until I figure out how it works.
>
> In case you're curious, I want to make a graphics device
> that saves the graph in Hewlett-Packard Graphics Language.
> https://en.wikipedia.org/wiki/HPGL
>
> Thanks
>
> Tom
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Making my own graphics device

David Winsemius
In reply to this post by Thomas Levine-4

On Aug 17, 2014, at 12:58 PM, Thomas Levine wrote:

> I want to make my own graphics device am thus looking for
> documentation about graphics devices.
>
> The only thing I've found so far is these directions for
> making graphics devices with the RGraphicsDevice package.
> http://www.omegahat.org/RGraphicsDevice/
>
> Could someone point me to any other resources? Or just
> some documentation about how to edit base R? If I don't
> get anything, I'm just going to stare at the grDevices
> section of the R source code (src/library/grDevices/src)
> until I figure out how it works.
>
> In case you're curious, I want to make a graphics device
> that saves the graph in Hewlett-Packard Graphics Language.
> https://en.wikipedia.org/wiki/HPGL
>

I went out searching and thought I had found an answer in the archives, but I see it was authored by you, so it must not have been entirely satisfactory:

http://markmail.org/search/?q=list%3Aorg.r-project.r-help+hpgl#query:list%3Aorg.r-project.r-help%20hpgl+page:1+mid:sxly4345y6tbj4dw+state:results

I also saw the suggestion from Koenker. The current holder of the rights to the S language (at least on PC's)  would be TIBCO. They do list the acronym `hpgl` on one page in the S+ documentation, but it is in the "deprecated functions" section (p 39):

http://www.uni-koeln.de/themen/statistik/software/s/v81/functionguide.pdf

Good luck.

--

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Making my own graphics device

Thomas Levine-4
In reply to this post by Roger Koenker-3
Thanks for this! I had a feeling that was the case;
the R graphics functions are so clearly designed for
use with pen plotters that I was puzzled by the absense
of an HPGL device.

And now I've found a list of some other interesting
devices on page 71 of Modern Applied Statistics with S.

This Wikipedia article says that S source code was released
in 1981. (I never knew!)
https://en.wikipedia.org/wiki/S_%28programming_language%29

So I'm going to look for publications related to S from 1981.
Say something if you have any tips for my search.

On 17 Aug 15:11, Roger Koenker wrote:

> In ancient times, ie circa 1981,  the S language certainly supported HP pen plotters
> so there should be code somewhere that could be resuscitated, he said naively.
>
> url:    www.econ.uiuc.edu/~roger            Roger Koenker
> email    [hidden email]            Department of Economics
> vox:     217-333-4558                University of Illinois
> fax:       217-244-6678                Urbana, IL 61801
> On Aug 17, 2014, at 2:58 PM, Thomas Levine <[hidden email]> wrote:
>
> > I want to make my own graphics device am thus looking for
> > documentation about graphics devices.
> >
> > The only thing I've found so far is these directions for
> > making graphics devices with the RGraphicsDevice package.
> > http://www.omegahat.org/RGraphicsDevice/
> >
> > Could someone point me to any other resources? Or just
> > some documentation about how to edit base R? If I don't
> > get anything, I'm just going to stare at the grDevices
> > section of the R source code (src/library/grDevices/src)
> > until I figure out how it works.
> >
> > In case you're curious, I want to make a graphics device
> > that saves the graph in Hewlett-Packard Graphics Language.
> > https://en.wikipedia.org/wiki/HPGL
> >
> > Thanks
> >
> > Tom
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Making my own graphics device

Paul Murrell-2
In reply to this post by Thomas Levine-4
Hi

On 08/18/14 07:58, Thomas Levine wrote:
> I want to make my own graphics device am thus looking for
> documentation about graphics devices.
>
> The only thing I've found so far is these directions for
> making graphics devices with the RGraphicsDevice package.
> http://www.omegahat.org/RGraphicsDevice/

That is certainly a good way to get something going quickly at least
(I used it just the other day and had something up and running in under
an hour, based on the inst/examples/SVG/svgDev.R example)

> Could someone point me to any other resources? Or just
> some documentation about how to edit base R? If I don't
> get anything, I'm just going to stare at the grDevices
> section of the R source code (src/library/grDevices/src)
> until I figure out how it works.

The "canonical" approach is to look at the source code for one of the
built-in devices in the R source code and change it to do what you want
(e.g., src/modules/X11/devX11.c).  The file
src/include/R_ext/GraphicsDevice.h has comments describing how the
graphics device should be set up.  See the RSvgDevice package for an
example of a device implemented in a package.

Paul

> In case you're curious, I want to make a graphics device
> that saves the graph in Hewlett-Packard Graphics Language.
> https://en.wikipedia.org/wiki/HPGL
>
> Thanks
>
> Tom
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[hidden email]
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Making my own graphics device

Duncan Murdoch-2
In reply to this post by Roger Koenker-3

> On Aug 17, 2014, at 2:58 PM, Thomas Levine <[hidden email]> wrote:
>
>> I want to make my own graphics device am thus looking for
>> documentation about graphics devices.
>>
>> The only thing I've found so far is these directions for
>> making graphics devices with the RGraphicsDevice package.
>> http://www.omegahat.org/RGraphicsDevice/
>>
>> Could someone point me to any other resources? Or just
>> some documentation about how to edit base R? If I don't
>> get anything, I'm just going to stare at the grDevices
>> section of the R source code (src/library/grDevices/src)
>> until I figure out how it works.
>>
>> In case you're curious, I want to make a graphics device
>> that saves the graph in Hewlett-Packard Graphics Language.
>> https://en.wikipedia.org/wiki/HPGL


There's a chapter on this in the R Internals manual.

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Making my own graphics device

David Winsemius
In reply to this post by Paul Murrell-2

On Aug 17, 2014, at 2:35 PM, Paul Murrell wrote:

> Hi
>
> On 08/18/14 07:58, Thomas Levine wrote:
>> I want to make my own graphics device am thus looking for
>> documentation about graphics devices.
>>
>> The only thing I've found so far is these directions for
>> making graphics devices with the RGraphicsDevice package.
>> http://www.omegahat.org/RGraphicsDevice/
>
> That is certainly a good way to get something going quickly at least
> (I used it just the other day and had something up and running in under an hour, based on the inst/examples/SVG/svgDev.R example)
>
>> Could someone point me to any other resources? Or just
>> some documentation about how to edit base R? If I don't
>> get anything, I'm just going to stare at the grDevices
>> section of the R source code (src/library/grDevices/src)
>> until I figure out how it works.
>
> The "canonical" approach is to look at the source code for one of the built-in devices in the R source code and change it to do what you want (e.g., src/modules/X11/devX11.c).  The file src/include/R_ext/GraphicsDevice.h has comments describing how the graphics device should be set up.  See the RSvgDevice package for an example of a device implemented in a package.

It may be useful to look at existing interfaces to an HPGL device in other graphics applications. One such application is xgraph and here is the C code for one implementation:

http://xgraph.sourcearchive.com/documentation/12.1-3/hpgl_8c-source.html

The other option might be to enlist an external program such as GNUPLOT that has an HPGL output and use it as a driver to which you send an image in a file format that R can produce.

--
David.

>
> Paul
>
>> In case you're curious, I want to make a graphics device
>> that saves the graph in Hewlett-Packard Graphics Language.
>> https://en.wikipedia.org/wiki/HPGL
>>
>> Thanks
>>
>> Tom
>>
>> ______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> --
> Dr Paul Murrell
> Department of Statistics
> The University of Auckland
> Private Bag 92019
> Auckland
> New Zealand
> 64 9 3737599 x85392
> [hidden email]
> http://www.stat.auckland.ac.nz/~paul/
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Making my own graphics device

Thomas Levine-4
Thanks for the further tips! I'll look at the R Internals manual,
the other built-in devices, and the RSvgDevice package. And I'm
still looking for the S source code, but I have a feeling that I'll
wind up writing the device before I find the source code.

> It may be useful to look at existing interfaces to an HPGL device in other graphics applications. One such application is xgraph and here is the C code for one implementation:
>
> http://xgraph.sourcearchive.com/documentation/12.1-3/hpgl_8c-source.html
>
> The other option might be to enlist an external program such as GNUPLOT that has an HPGL output and use it as a driver to which you send an image in a file format that R can produce.

While this would be a good idea for pretty much any other file format,
it probably will make things more complicated for HPGL as the structure
of base R graphics is kind of exactly the same as HPGL.

Tom

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.