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

Henry hccoles at lbl.gov
Sun Mar 18 15:35:30 CET 2012


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)	




--
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.



More information about the R-help mailing list