Displaying 20 results from an estimated 32 matches for "coord_equal".
2008 Jan 11
1
ggplot2, coord_equal and aspect ratio
Hi everyone, Hi Hadley,
I am a heavy user of coord_equal() in ggplot2 since most of my data is
spatial, on x,y coordinates. Everything works. However by enforcing an
aspect ratio of 1 for the plotting region, coord_equal() usually
wastes a lot of space if the region of interest is not a perfect square.
For example:
x=runif(10)
a=data.frame(x=x*3...
2009 May 19
2
Coord_equal in ggplot2
Dear all,
I'm plotting some points on a graph where both axes need to have the
same scale. See the example below. Coord_equal does that trick but in
this case it wastes a lot of space on the y-axis. Setting the limits of
the y-axis myself was no avail.
Any suggestions to solve this problem?
library(ggplot2)
ds <- data.frame(x = runif(1000, min = 0, max = 300000), y = runif(1000,
min = 140000, max = 260000))
ggplot...
2010 Feb 26
1
ggplot2 : bug in coord_equal() ?
Hello,
I think there is a bug in coord_equal when x s a factor :
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar()
ggplot(diamonds, aes(clarity, fill=cut)) + geom_bar() + coord_equal(1/2)
David
2007 Sep 27
3
Plotting from different data sources on the same plot (with ggplot2)
...nates of the coastlines in a region of interest and the
coordinated of sampling stations in a subset of this region. I want
to plot the coastline as a line and the stations as points, on the
same graph. I can plot them independently easily:
p1 = ggplot(coast,aes(x=lon,y=lat)) + geom_path() + coord_equal(ratio=1)
p1$aspect.ratio = 1
p2 = ggplot(coords,aes(x=lon,y=lat)) + geom_point() + coord_equal
(ratio=1)
p2$aspect.ratio = 1
but I cannot find how to combine the two graphs. I suspect this has
probably to be done via different layers but I really can't find how.
In particular, I would li...
2013 Nov 01
1
Package(s) for making waffle plot-like figures?
...]$ratio)
waffle$residue=c(as.vector(residuevec),rep(NA,nrow(waffle)-length(residuevec)))
png(paste('plot',i,'.png',sep=''))
print(ggplot(waffle, aes(x = x, y = y, fill = residue)) + geom_tile(color =
"white") + scale_fill_manual("residue",values = col4) + coord_equal() +
theme(panel.grid.minor=element_blank(),panel.grid.major=element_blank())
+ theme(axis.ticks=element_blank()) +
theme(axis.text.x=element_blank(),axis.text.y=element_blank()) +
theme(axis.title.x=element_blank(),axis.title.y=element_blank())
)
dev.off()}
With my scripts, I could make a waffle p...
2017 Dec 20
2
outlining (highlighting) pixels in ggplot2
...an example matrix with binary code for which results (pixels) are
significant
set.seed(4004)
sig <- matrix(round(abs(rnorm(15*12)/3)), nrow = 15, ncol = 12)
ggplot(m1.melted, aes(x = Month, y = Site, fill = Concentration), autoscale
= FALSE, zmin = -1 * zmax1, zmax = zmax1) +
geom_tile() +
coord_equal() +
scale_fill_gradient2(low = "darkred",
mid = "white",
high = "darkblue",
midpoint = 0)
[[alternative HTML version deleted]]
2012 Aug 04
1
Getting unknown error trying to plot spatial data
...;OBJECTID", value = integer(0)) :
replacement has 0 rows, data has 16249*
>
>
> ## Make the map
>
> p1 <- ggplot(my_data, aes(map_id = zip))
> p1 <- p1 + geom_map(aes(fill=vol, map_id = zip), map = pds)
> p1 <- p1 + expand_limits(x = pds$lon, y = pds$lat) + coord_equal()
> p1 + xlab("Basic Map with Default Elements")
*Error in unit(x, default.units) : 'x' and 'units' must have length > 0*
Anybody have any idea what is happening here or how to resolve this?
Thanks!!!!
--
View this message in context: http://r.789695.n4.nabble.c...
2010 Jul 07
0
ggplot2 version 0.8.8
...in use. If you're interested, you can also sign up to
the ggplot2 mailing list at http://groups.google.com/group/ggplot2, or track
development at http://github.com/hadley/ggplot2
ggplot2 0.8.8 (2010-07-02) ----------------------------------------
This version fixes the following 23 bugs:
* coord_equal finally works as expected (thanks to continued prompting
from Jean-Olivier Irisson)
* coord_equal renamed to coord_fixed to better represent capabilities
* coord_polar and coord_polar: new munching system that uses distances
(as defined by the coordinate system) to figure out how many pieces
each s...
2010 Jul 07
0
ggplot2 version 0.8.8
...in use. If you're interested, you can also sign up to
the ggplot2 mailing list at http://groups.google.com/group/ggplot2, or track
development at http://github.com/hadley/ggplot2
ggplot2 0.8.8 (2010-07-02) ----------------------------------------
This version fixes the following 23 bugs:
* coord_equal finally works as expected (thanks to continued prompting
from Jean-Olivier Irisson)
* coord_equal renamed to coord_fixed to better represent capabilities
* coord_polar and coord_polar: new munching system that uses distances
(as defined by the coordinate system) to figure out how many pieces
each s...
2017 Dec 20
0
outlining (highlighting) pixels in ggplot2
Hi Eric,
you can use an annotate-layer, eg
ind<-which(sig>0,arr.ind = T)
ggplot(m1.melted, aes(x = Month, y = Site, fill = Concentration), autoscale
= FALSE, zmin = -1 * zmax1, zmax = zmax1) +
geom_tile() +
coord_equal() +
scale_fill_gradient2(low = "darkred",
mid = "white",
high = "darkblue",
midpoint = 0)
+annotate("rect",ymin=ind[,"row"]-.5,ymax=.5+ind[,"row"],
xmin=-.5+ind[,"...
2017 Nov 10
1
How to create separate legend for each plot in the function of facet_wrap in ggplot2?
....Label = c("A", "B"), class = "factor")),
.Names = c("X",
"Y", "value", "group"), class = "data.frame", row.names = c(NA,
-12L))
AB<-ggplot(data = dat, aes(x = X, y = Y, color = value)) + geom_point(size
=2) +
coord_equal() + theme_bw()+ scale_color_gradientn(colours = terrain.colors(
7))
AB+facet_wrap(~group, scales="free")+theme(strip.text = element_text(size
= 8))
Thanks
MW
[[alternative HTML version deleted]]
2009 Dec 22
0
ggplot2 version 0.8.5
...he y axis on a histogram.
Additionally, it means default scales are only added to the plot until just
prior to plotting, instead of the previous behaviour where scales where
added as layers were added - this could cause problems if you later modified
the underlying data. (Implements #28)
* coord_equal: when ratio = NULL (the default), it will adjust the aspect
ratio of the plot, rather than trying to extend the shortest axis.
* x and y positions can be set to Inf or -Inf to refer to the top/right and
bottom/left extents of the panel. (Implements #18)
* expand_limits(): a new function to ma...
2009 Dec 22
0
ggplot2 version 0.8.5
...he y axis on a histogram.
Additionally, it means default scales are only added to the plot until just
prior to plotting, instead of the previous behaviour where scales where
added as layers were added - this could cause problems if you later modified
the underlying data. (Implements #28)
* coord_equal: when ratio = NULL (the default), it will adjust the aspect
ratio of the plot, rather than trying to extend the shortest axis.
* x and y positions can be set to Inf or -Inf to refer to the top/right and
bottom/left extents of the panel. (Implements #18)
* expand_limits(): a new function to ma...
2017 Nov 17
2
How to produce rainfall maps
...fake transect (csv file with lat and lon coordinates)
sites <- data.frame(read.csv(?/your/path/to/pointfile.csv?))
#Now make the map
ggplot(data=df, aes(y=Latitude, x=Longitude)) +
geom_raster(aes(fill=MAP)) +
geom_point(data=sites, aes(x=x, y=y), color=?white?, size=3, shape=4) +
theme_bw() +
coord_equal() +
scale_fill_gradient(?MAP (mm/yr)?, limits=c(0,2500)) +
theme(axis.title.x = element_text(size=16),
axis.title.y = element_text(size=16, angle=90),
axis.text.x = element_text(size=14),
axis.text.y = element_text(size=14),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
le...
2017 Nov 21
0
How to produce rainfall maps
...on coordinates)
> sites <- data.frame(read.csv(?/your/path/to/pointfile.csv?))
>
> #Now make the map
> ggplot(data=df, aes(y=Latitude, x=Longitude)) +
> geom_raster(aes(fill=MAP)) +
> geom_point(data=sites, aes(x=x, y=y), color=?white?, size=3, shape=4) +
> theme_bw() +
> coord_equal() +
> scale_fill_gradient(?MAP (mm/yr)?, limits=c(0,2500)) +
> theme(axis.title.x = element_text(size=16),
> axis.title.y = element_text(size=16, angle=90),
> axis.text.x = element_text(size=14),
> axis.text.y = element_text(size=14),
> panel.grid.major = element_blank(),
> pan...
2010 Feb 19
0
ggplot2: version 0.8.6
...ub.com/hadley/ggplot2
ggplot2 0.8.6 (2010-02-07) ----------------------------------------
New features
* trans_log1p: new log + 1 transformer contributed by Jean-Olivier Irisson
Bug fixes
* aesthetics: fixed bug when overriding aesthetics with NULL
* annotate: adds layers with legend = FALSE
* coord_equal: correctly place tick marks (Fixes #61)
* documentation: usage statements should now be spread over multiple lines
* fortify.SpatialPolygonsDataFrame: fixed bug when region variable had
missing values
* legend: don't try and display legend when unnecessary scale added
* legend: text labels now...
2011 Apr 03
0
Plotting data on a US County Map
...e(us_counties.shp,
region="CNTY_FIPS")
us <- merge(us_counties.shp.p, us_counties.shp, by.x="id", by.y="CNTY_FIPS")
p <- ggplot(data=us, aes(x=long, y=lat, group=group)) +
geom_polygon(fill="#CFCFCF")
p <- p + geom_path(color="white") + coord_equal()
ggsave(p, width=11.69, height=8.27, file="us_counties_a.jpg")
--
View this message in context: http://r.789695.n4.nabble.com/Plotting-data-on-a-US-County-Map-tp3423342p3423342.html
Sent from the R help mailing list archive at Nabble.com.
2010 Feb 19
0
ggplot2: version 0.8.6
...ub.com/hadley/ggplot2
ggplot2 0.8.6 (2010-02-07) ----------------------------------------
New features
* trans_log1p: new log + 1 transformer contributed by Jean-Olivier Irisson
Bug fixes
* aesthetics: fixed bug when overriding aesthetics with NULL
* annotate: adds layers with legend = FALSE
* coord_equal: correctly place tick marks (Fixes #61)
* documentation: usage statements should now be spread over multiple lines
* fortify.SpatialPolygonsDataFrame: fixed bug when region variable had
missing values
* legend: don't try and display legend when unnecessary scale added
* legend: text labels now...
2012 May 10
0
Fwd: Re: need help in R
...rker),data=emz)+
> scale_fill_identity()+
> scale_x_continuous('Longitude', limits = lon_range) +
> scale_y_continuous('Latitude', limits = lat_range) +
> scale_colour_discrete('') +
> opts(title = 'Invitation map of Emzinini, 2012') +
> coord_equal()
>
> this code brings an error says
> Error in dev.copy2pdf(device = "x11", file = paste(mapdir, "EmzinoniGG.pdf", :
> no device to print from
> i am not sure what does the error mean
> dev.copy2pdf(device="x11",file=paste(mapdir,"EmzinoniGG...
2008 Dec 14
0
New version of ggplot2, 0.8.1
...pecified the grouping
* geom_smooth will switch to an alternative smoothing method
(mgcv::gam(y ~ s(x, bs = "cr"))), when there are more than 1000
observations
* layers gain a legend argument, which allow you to force the layer
either into (TRUE) or out of (FALSE) the legend
Bug fixes
* coord_equal now calculates scales correctly again
* coord_flip: flips axes labels again too
* coord_trans fix bug where transformation incorrect
* facet_grid: fix bug where tick labels where being produced outside
the range of the axes
* facet_wrap: fixed bug with ncol = 1 or nrow = 1
* facet_wrap: labels corr...