A default install of QGIS doesn’t work too well with a HiDPI display.
However setting an environment variable seem to sort all that out.
typing this into your terminal:
export QT_AUTO_SCREEN_SCALE_FACTOR=true
A default install of QGIS doesn’t work too well with a HiDPI display.
However setting an environment variable seem to sort all that out.
typing this into your terminal:
export QT_AUTO_SCREEN_SCALE_FACTOR=true
Install and load the ggplot2 and Cairo libraries
install.packages(c("ggplot2","Cairo")
library(c(ggplot2,Cairo))
set up some data (or use some real data)
x1<-rnorm(150,mean = rep(1:3, each =50),sd = 0.7)
x2<-rnorm(150,mean = rep(c(1,2,1.5), each = 50),sd = 0.2)
x3<-rnorm(150,mean = rep(c(20,30,3),each = 50)), sd = 0.5)
n3<-rep(c("GRP 01","GRP 02","GRP 03"),each=50)
Here is the command to generate the PNG file, with anti-aliasing:
CairoPNG(filename = "Plot1.png", antialias="subpixel", width = 1000, height=800, units = "px")
{
qplot(x1,x2, ,color = n3, size = x3)
}
dev.off()
or you can split the 3 sections up using:
qplot(x1,x2, color = n3, facets = .~n3)
First thing we need to do is create a dataframe from the four identical length vectors.
df <- data.frame(x1,x2,x3,n3)
colnames(df) <- c("x1","x2","x3","n3")
Some Charting:
g1 <- ggplot(df,aes(x1,x2)) p <- g1 + geom_point(aes(colour=n3), size =3.5) + geom_smooth(method = "lm") + theme_bw() print(p)
..and a slightly better looking version:
g1 <- ggplot(df,aes(x1,x2)) p <- g1 + geom_point(aes(colour=n3, size =x3)) + geom_smooth(method = "lm") + theme_bw() print(p)
There you go all good stuff.
Other things to check out: facet_wrap
Some more pretty graphics
library(RODBC)
library(lattice)
library(treemap)
ch<-odbcConnect("mike_db",uid="mike")
c<-sqlQuery(ch, paste("select"
,"ward,year(end_Dttm) as [year]"
,",sum(datediff(mi,start_Dttm,end_Dttm)/1440.0) as LOS"
,"from [wardstays_examples]"
,"GROUP BY ward ,year(end_Dttm)"
))
str(c)
treemap (c
,index=c("year","ward") # the different levels
,vSize = "LOS" # the value on which to scale the squares
)
library(maptools)
library(Cairo)
walesCoast<-readShapeSpatial("Z:/MAPPING DATA/Meridian 2 Shape/data/coast_ln_polyline.shp", proj4string=CRS("+init=epsg:27700"))
walesUA<-readShapeSpatial("Z:/MAPPING DATA/Meridian 2 Shape/data/district_region.shp", proj4string=CRS("+init=epsg:27700"))
x1x2<-c(221000,346594)
y1y2<-c(269406,395000)
plot(walesUA,xaxs="i",yaxs="i",xlim=x1x2,ylim=y1y2,lwd=1)
plot(walesCoast,xaxs="i",yaxs="i",xlim=x1x2,ylim=y1y2,lwd=3,col="red", add=TRUE)
mtext("upvar",side=2,line=2,col=1)
mtext("Bottom",side=1,line=2,col=2)
mtext("Top",side=3,line=2,col=3)
mtext("Right",side=4,line=1,col=4)