मैं शुरू में इस पृष्ठभूमि बनाने के लिए geom_raster
और geom_tile
उपयोग करने की कोशिश, लेकिन इसके बजाय एक छवि का उपयोग कर का सहारा के रूप में मैंने सोचा कि यह आसान होगा का उपयोग करने पर अंक अस्तर एक कठिन समय बीत रहा है।एक छवि ggplot2
हालांकि, मैं पूरी पृष्ठभूमि को लेने के लिए छवि नहीं प्राप्त कर सकता हूं ताकि अंक शीर्ष पर सही हो। पृष्ठभूमि छवि यहाँ है: http://imgur.com/a/eZGAP
लेकिन यह इस तरह बाहर आ रहा है:
structure(list(Industry.Group = c("Defense/Military", "Energy", "Financial Services", "Healthcare", "Manufacturing", "Public Sector (non-defense)/Not For Profit", "Retail", "Services", "Technology", "Telecommunications", "Transportation" ), ciq_tech = c(55.9, 53.7111111111111, 60.743661971831, 45.0620689655172, 42.1529411764706, 52.2444444444444, 40.8, 52.3263157894737, 50.9222222222222, 59.5111111111111, 39.6666666666667), Industry.Group = c("Defense/Military", "Energy", "Financial Services", "Healthcare", "Manufacturing", "Public Sector (non-defense)/Not For Profit", "Retail", "Services", "Technology", "Telecommunications", "Transportation"), ciq_org = c(39.6666666666667, 48.7413636363636, 48.0868442622951, 42.2482222222222, 39.0128260869565, 38.482, 39.7786956521739, 41.7248387096774, 47.8644262295082, 49.6739285714286, 41.4825)), .Names = c("Industry.Group", "ciq_tech", "Industry.Group", "ciq_org"), row.names = c(NA, -11L), class = "data.frame")
यहाँ डेटा की एक dput
है
मैंने कोशिश की है और xmin
समायोजित कर रहा है, xmax
और ymin
और ymax
चर:
library(png)
library(grid)
library(ggplot2)
img <- readPNG("grid.png")
g <- rasterGrob(img, interpolate=TRUE)
ggplot(both, aes(x = ciq_org, y = ciq_tech)) +
theme_bw() + annotation_custom(g, xmin=31, xmax=57, ymin=38, ymax=61) + geom_point()
साथ ही:
ggplot(both, aes(x = ciq_org, y = ciq_tech)) +
theme_bw() + annotation_custom(g, xmin=-Inf, xmax=Inf, ymin=-Inf, ymax=Inf) + geom_point()
मैं भी geom_raster
का उपयोग कर के लिए खुला बजाय अगर यह तय वर्गों और रंग के साथ पृष्ठभूमि पुन: बनाने के लिए आसान हो जाएगा हूँ ngatively ggplot2 में।
वाह, गंभीरता से? बहुत बहुत धन्यवाद, मुझे लगा कि मैं इसे खत्म कर रहा था! – tcash21