problem saving gplot.hexbin using file save as pdf - "Error: invalid graphics state

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem saving gplot.hexbin using file save as pdf - "Error: invalid graphics state

Henry
I can save to png, TIFF and jpg but get an error  "Error: invalid graphics state" when trying to save as pdf and I have to restart R.
This happens when I add mtext lines.

There are a few other questions e.g. I want to move the mtext on side 1 to the left, but that is the main issue for now.
I'm not using the ylab inside gplot.hexbin because it writes over the numbers on the axis.

The file is  33k records but I could get a subset and paste in here if people need that to resolve the issue.
the code

par(oma=c(3,3.5,3,1))
par(mar=c(2, 4, 0, 0))
plot.new()
gplot.hexbin(h, style = "colorscale",
                        colramp = function(n) {LinGray(7, beg=92, end=1)},
                        colorcut = 8,
                        xlab = "", ylab = "", main = "",
                        legend = .75, lcex = .8)

mtext("Outside Temperature (F)", side=1, line = 2, col="black",cex=1.1)
mtext("Electrical Power (kW)", side=2, line=6, col="black",cex=1.1)
mtext("Building 90 - 2011 All Hours, All Days", side=3, line=0, col="black",cex=1.2)


Reply | Threaded
Open this post in threaded view
|

Re: problem saving gplot.hexbin using file save as pdf - "Error: invalid graphics state

Uwe Ligges-3


On 18.03.2012 15:35, Henry wrote:

> I can save to png, TIFF and jpg but get an error  "Error: invalid graphics
> state" when trying to save as pdf and I have to restart R.
> This happens when I add mtext lines.
>
> There are a few other questions e.g. I want to move the mtext on side 1 to
> the left, but that is the main issue for now.
> I'm not using the ylab inside gplot.hexbin because it writes over the
> numbers on the axis.
>
> The file is  33k records but I could get a subset and paste in here if
> people need that to resolve the issue.

Yes, please.

also, we get

Error: object 'gplot.hexbin' not found

which is probably in some not mentioned contributed package?

Uwe Ligges





> the code
>
> par(oma=c(3,3.5,3,1))
> par(mar=c(2, 4, 0, 0))
> plot.new()
> gplot.hexbin(h, style = "colorscale",
> colramp = function(n) {LinGray(7, beg=92, end=1)},
> colorcut = 8,
> xlab = "", ylab = "", main = "",
> legend = .75, lcex = .8)
>
> mtext("Outside Temperature (F)", side=1, line = 2, col="black",cex=1.1)
> mtext("Electrical Power (kW)", side=2, line=6, col="black",cex=1.1)
> mtext("Building 90 - 2011 All Hours, All Days", side=3, line=0,
> col="black",cex=1.2)
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/problem-saving-gplot-hexbin-using-file-save-as-pdf-Error-invalid-graphics-state-tp4482235p4482235.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [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.