Add scale bar for plotting ppp object
up vote
0
down vote
favorite
I would like to add a scale bar to plots of spatstat objects but am not sure how.
Here is a reproducible example:
Plot ppp object called "cells":
data(cells)
plot(cells)
How would I add a scale bar to this plot?
sp spatstat
add a comment |
up vote
0
down vote
favorite
I would like to add a scale bar to plots of spatstat objects but am not sure how.
Here is a reproducible example:
Plot ppp object called "cells":
data(cells)
plot(cells)
How would I add a scale bar to this plot?
sp spatstat
Please consider upvoting and/or accepting an answer if it solves your problem or explain what is missing.
– Ege Rubak
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I would like to add a scale bar to plots of spatstat objects but am not sure how.
Here is a reproducible example:
Plot ppp object called "cells":
data(cells)
plot(cells)
How would I add a scale bar to this plot?
sp spatstat
I would like to add a scale bar to plots of spatstat objects but am not sure how.
Here is a reproducible example:
Plot ppp object called "cells":
data(cells)
plot(cells)
How would I add a scale bar to this plot?
sp spatstat
sp spatstat
asked Nov 10 at 16:38
Carrie Perkins
263
263
Please consider upvoting and/or accepting an answer if it solves your problem or explain what is missing.
– Ege Rubak
2 days ago
add a comment |
Please consider upvoting and/or accepting an answer if it solves your problem or explain what is missing.
– Ege Rubak
2 days ago
Please consider upvoting and/or accepting an answer if it solves your problem or explain what is missing.
– Ege Rubak
2 days ago
Please consider upvoting and/or accepting an answer if it solves your problem or explain what is missing.
– Ege Rubak
2 days ago
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I just Googled 'spatstat scale bar' and the second hit was the help file for yardstick() while the top hit concerned the plot method for the yard stick. The title of the help file is "yardstick: Text, Arrow or Scale Bar in a Diagram". Maybe that is what you are looking for.
E.g:
library(spatstat)
W <- union.owin(owin(c(0,1),c(0,5)), owin(c(0,5),c(4,5)))
X <- runifpoint(100, win = W)
plot(X, main = "")
y <- yardstick(3,1,4,1, txt = "1 unit")
plot(y, add = TRUE)
Created on 2018-11-11 by the reprex package (v0.2.1)
Thank you very much for your suggestion. Yes, i did look into yardstick, but am not sure how to use it for my real data. The window in my real data is very narrow and as far as I understand, it seems that the yardstick will have to be placed at coordinates within the window itself, where there isn't really any free space. I am looking for a way to put a scale bar outside of the window.
– Carrie Perkins
Nov 11 at 2:45
The coordinates of the observation window follow the bounding box of the rectangle. See my update for an example where a stick is plotted outside the window, but inside the bounding box (frame).
– Ege Rubak
Nov 11 at 21:51
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I just Googled 'spatstat scale bar' and the second hit was the help file for yardstick() while the top hit concerned the plot method for the yard stick. The title of the help file is "yardstick: Text, Arrow or Scale Bar in a Diagram". Maybe that is what you are looking for.
E.g:
library(spatstat)
W <- union.owin(owin(c(0,1),c(0,5)), owin(c(0,5),c(4,5)))
X <- runifpoint(100, win = W)
plot(X, main = "")
y <- yardstick(3,1,4,1, txt = "1 unit")
plot(y, add = TRUE)
Created on 2018-11-11 by the reprex package (v0.2.1)
Thank you very much for your suggestion. Yes, i did look into yardstick, but am not sure how to use it for my real data. The window in my real data is very narrow and as far as I understand, it seems that the yardstick will have to be placed at coordinates within the window itself, where there isn't really any free space. I am looking for a way to put a scale bar outside of the window.
– Carrie Perkins
Nov 11 at 2:45
The coordinates of the observation window follow the bounding box of the rectangle. See my update for an example where a stick is plotted outside the window, but inside the bounding box (frame).
– Ege Rubak
Nov 11 at 21:51
add a comment |
up vote
0
down vote
I just Googled 'spatstat scale bar' and the second hit was the help file for yardstick() while the top hit concerned the plot method for the yard stick. The title of the help file is "yardstick: Text, Arrow or Scale Bar in a Diagram". Maybe that is what you are looking for.
E.g:
library(spatstat)
W <- union.owin(owin(c(0,1),c(0,5)), owin(c(0,5),c(4,5)))
X <- runifpoint(100, win = W)
plot(X, main = "")
y <- yardstick(3,1,4,1, txt = "1 unit")
plot(y, add = TRUE)
Created on 2018-11-11 by the reprex package (v0.2.1)
Thank you very much for your suggestion. Yes, i did look into yardstick, but am not sure how to use it for my real data. The window in my real data is very narrow and as far as I understand, it seems that the yardstick will have to be placed at coordinates within the window itself, where there isn't really any free space. I am looking for a way to put a scale bar outside of the window.
– Carrie Perkins
Nov 11 at 2:45
The coordinates of the observation window follow the bounding box of the rectangle. See my update for an example where a stick is plotted outside the window, but inside the bounding box (frame).
– Ege Rubak
Nov 11 at 21:51
add a comment |
up vote
0
down vote
up vote
0
down vote
I just Googled 'spatstat scale bar' and the second hit was the help file for yardstick() while the top hit concerned the plot method for the yard stick. The title of the help file is "yardstick: Text, Arrow or Scale Bar in a Diagram". Maybe that is what you are looking for.
E.g:
library(spatstat)
W <- union.owin(owin(c(0,1),c(0,5)), owin(c(0,5),c(4,5)))
X <- runifpoint(100, win = W)
plot(X, main = "")
y <- yardstick(3,1,4,1, txt = "1 unit")
plot(y, add = TRUE)
Created on 2018-11-11 by the reprex package (v0.2.1)
I just Googled 'spatstat scale bar' and the second hit was the help file for yardstick() while the top hit concerned the plot method for the yard stick. The title of the help file is "yardstick: Text, Arrow or Scale Bar in a Diagram". Maybe that is what you are looking for.
E.g:
library(spatstat)
W <- union.owin(owin(c(0,1),c(0,5)), owin(c(0,5),c(4,5)))
X <- runifpoint(100, win = W)
plot(X, main = "")
y <- yardstick(3,1,4,1, txt = "1 unit")
plot(y, add = TRUE)
Created on 2018-11-11 by the reprex package (v0.2.1)
edited Nov 11 at 21:49
answered Nov 11 at 1:14
Ege Rubak
1,7791511
1,7791511
Thank you very much for your suggestion. Yes, i did look into yardstick, but am not sure how to use it for my real data. The window in my real data is very narrow and as far as I understand, it seems that the yardstick will have to be placed at coordinates within the window itself, where there isn't really any free space. I am looking for a way to put a scale bar outside of the window.
– Carrie Perkins
Nov 11 at 2:45
The coordinates of the observation window follow the bounding box of the rectangle. See my update for an example where a stick is plotted outside the window, but inside the bounding box (frame).
– Ege Rubak
Nov 11 at 21:51
add a comment |
Thank you very much for your suggestion. Yes, i did look into yardstick, but am not sure how to use it for my real data. The window in my real data is very narrow and as far as I understand, it seems that the yardstick will have to be placed at coordinates within the window itself, where there isn't really any free space. I am looking for a way to put a scale bar outside of the window.
– Carrie Perkins
Nov 11 at 2:45
The coordinates of the observation window follow the bounding box of the rectangle. See my update for an example where a stick is plotted outside the window, but inside the bounding box (frame).
– Ege Rubak
Nov 11 at 21:51
Thank you very much for your suggestion. Yes, i did look into yardstick, but am not sure how to use it for my real data. The window in my real data is very narrow and as far as I understand, it seems that the yardstick will have to be placed at coordinates within the window itself, where there isn't really any free space. I am looking for a way to put a scale bar outside of the window.
– Carrie Perkins
Nov 11 at 2:45
Thank you very much for your suggestion. Yes, i did look into yardstick, but am not sure how to use it for my real data. The window in my real data is very narrow and as far as I understand, it seems that the yardstick will have to be placed at coordinates within the window itself, where there isn't really any free space. I am looking for a way to put a scale bar outside of the window.
– Carrie Perkins
Nov 11 at 2:45
The coordinates of the observation window follow the bounding box of the rectangle. See my update for an example where a stick is plotted outside the window, but inside the bounding box (frame).
– Ege Rubak
Nov 11 at 21:51
The coordinates of the observation window follow the bounding box of the rectangle. See my update for an example where a stick is plotted outside the window, but inside the bounding box (frame).
– Ege Rubak
Nov 11 at 21:51
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241073%2fadd-scale-bar-for-plotting-ppp-object%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please consider upvoting and/or accepting an answer if it solves your problem or explain what is missing.
– Ege Rubak
2 days ago