R script not launch histogramme from bash
up vote
1
down vote
favorite
I have a histogram.R with chmod 755.
I want to display the histogram.
From a R console (with removing the "#!/usr/bin/env Rscript") it's work but not when I execute the script from my shell.
Just by doing : ./histogram.R
I have this for output :
[1] 58384 67239 23702 32667 60158 21209 49167 33010 20278 46316 35619 NA
[13] 26647 NA 44791 21630 41907 58796 15578 56909 46550
This is my code :
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
Soluce find :
save graph as pdf and open it after with ggplot2 (example with generic data)
library(ggplot2)
data=data.frame(x=rnorm(100))
plot=qplot(x, data=data, geom="histogram")
ggsave(plot,file="graph1.pdf")
system("open graph1.pdf")
python r bash histogram rscript
add a comment |
up vote
1
down vote
favorite
I have a histogram.R with chmod 755.
I want to display the histogram.
From a R console (with removing the "#!/usr/bin/env Rscript") it's work but not when I execute the script from my shell.
Just by doing : ./histogram.R
I have this for output :
[1] 58384 67239 23702 32667 60158 21209 49167 33010 20278 46316 35619 NA
[13] 26647 NA 44791 21630 41907 58796 15578 56909 46550
This is my code :
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
Soluce find :
save graph as pdf and open it after with ggplot2 (example with generic data)
library(ggplot2)
data=data.frame(x=rnorm(100))
plot=qplot(x, data=data, geom="histogram")
ggsave(plot,file="graph1.pdf")
system("open graph1.pdf")
python r bash histogram rscript
Your script is putting the histogram in a device you cannot see.
– MichaelChirico
Nov 11 at 10:49
Surround the call tohist
with a redirect to a graphics device -- would you like to save the histogram as a png? then surround it withpng('file_name.png'); hist_call; dev.off()
– MichaelChirico
Nov 11 at 10:50
I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:34
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a histogram.R with chmod 755.
I want to display the histogram.
From a R console (with removing the "#!/usr/bin/env Rscript") it's work but not when I execute the script from my shell.
Just by doing : ./histogram.R
I have this for output :
[1] 58384 67239 23702 32667 60158 21209 49167 33010 20278 46316 35619 NA
[13] 26647 NA 44791 21630 41907 58796 15578 56909 46550
This is my code :
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
Soluce find :
save graph as pdf and open it after with ggplot2 (example with generic data)
library(ggplot2)
data=data.frame(x=rnorm(100))
plot=qplot(x, data=data, geom="histogram")
ggsave(plot,file="graph1.pdf")
system("open graph1.pdf")
python r bash histogram rscript
I have a histogram.R with chmod 755.
I want to display the histogram.
From a R console (with removing the "#!/usr/bin/env Rscript") it's work but not when I execute the script from my shell.
Just by doing : ./histogram.R
I have this for output :
[1] 58384 67239 23702 32667 60158 21209 49167 33010 20278 46316 35619 NA
[13] 26647 NA 44791 21630 41907 58796 15578 56909 46550
This is my code :
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
Soluce find :
save graph as pdf and open it after with ggplot2 (example with generic data)
library(ggplot2)
data=data.frame(x=rnorm(100))
plot=qplot(x, data=data, geom="histogram")
ggsave(plot,file="graph1.pdf")
system("open graph1.pdf")
python r bash histogram rscript
python r bash histogram rscript
edited Nov 11 at 11:35
asked Nov 11 at 10:43
Soswolf
135
135
Your script is putting the histogram in a device you cannot see.
– MichaelChirico
Nov 11 at 10:49
Surround the call tohist
with a redirect to a graphics device -- would you like to save the histogram as a png? then surround it withpng('file_name.png'); hist_call; dev.off()
– MichaelChirico
Nov 11 at 10:50
I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:34
add a comment |
Your script is putting the histogram in a device you cannot see.
– MichaelChirico
Nov 11 at 10:49
Surround the call tohist
with a redirect to a graphics device -- would you like to save the histogram as a png? then surround it withpng('file_name.png'); hist_call; dev.off()
– MichaelChirico
Nov 11 at 10:50
I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:34
Your script is putting the histogram in a device you cannot see.
– MichaelChirico
Nov 11 at 10:49
Your script is putting the histogram in a device you cannot see.
– MichaelChirico
Nov 11 at 10:49
Surround the call to
hist
with a redirect to a graphics device -- would you like to save the histogram as a png? then surround it with png('file_name.png'); hist_call; dev.off()
– MichaelChirico
Nov 11 at 10:50
Surround the call to
hist
with a redirect to a graphics device -- would you like to save the histogram as a png? then surround it with png('file_name.png'); hist_call; dev.off()
– MichaelChirico
Nov 11 at 10:50
I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:34
I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:34
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
x11() # if you're on linux; quartz() if macOS
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
invisible(readLines("stdin", n=1)) # Wait for ENTER so the chart stays up
dev.off() # close the X11 device
Do what Michael suggested if you want to make a file.
very nice solution!
– MichaelChirico
Nov 11 at 11:02
I tried but not work... I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:33
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
x11() # if you're on linux; quartz() if macOS
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
invisible(readLines("stdin", n=1)) # Wait for ENTER so the chart stays up
dev.off() # close the X11 device
Do what Michael suggested if you want to make a file.
very nice solution!
– MichaelChirico
Nov 11 at 11:02
I tried but not work... I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:33
add a comment |
up vote
1
down vote
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
x11() # if you're on linux; quartz() if macOS
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
invisible(readLines("stdin", n=1)) # Wait for ENTER so the chart stays up
dev.off() # close the X11 device
Do what Michael suggested if you want to make a file.
very nice solution!
– MichaelChirico
Nov 11 at 11:02
I tried but not work... I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:33
add a comment |
up vote
1
down vote
up vote
1
down vote
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
x11() # if you're on linux; quartz() if macOS
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
invisible(readLines("stdin", n=1)) # Wait for ENTER so the chart stays up
dev.off() # close the X11 device
Do what Michael suggested if you want to make a file.
#!/usr/bin/env Rscript
contenuTotalFichier <- read.csv("./resources/dataset_train.20.csv")
colonne.Arithmancy <- contenuTotalFichier["Arithmancy"][,1]
print(colonne.Arithmancy)
x11() # if you're on linux; quartz() if macOS
hist(colonne.Arithmancy, col = grey(0.9), border = grey(0.2),
main = paste("Quel cours de Poudlard a une répartition des notes homogènes entre les quatres maisons
?"),
xlab = "effectifs en fonction des maisons",
ylab = "cours de Poudlard",
labels = TRUE, las = 1, ylim = c(0, 50))
invisible(readLines("stdin", n=1)) # Wait for ENTER so the chart stays up
dev.off() # close the X11 device
Do what Michael suggested if you want to make a file.
answered Nov 11 at 10:58
hrbrmstr
59.1k584143
59.1k584143
very nice solution!
– MichaelChirico
Nov 11 at 11:02
I tried but not work... I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:33
add a comment |
very nice solution!
– MichaelChirico
Nov 11 at 11:02
I tried but not work... I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:33
very nice solution!
– MichaelChirico
Nov 11 at 11:02
very nice solution!
– MichaelChirico
Nov 11 at 11:02
I tried but not work... I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:33
I tried but not work... I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:33
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f53247951%2fr-script-not-launch-histogramme-from-bash%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
Your script is putting the histogram in a device you cannot see.
– MichaelChirico
Nov 11 at 10:49
Surround the call to
hist
with a redirect to a graphics device -- would you like to save the histogram as a png? then surround it withpng('file_name.png'); hist_call; dev.off()
– MichaelChirico
Nov 11 at 10:50
I use the soluce to save sur graph as pdf and open it after.
– Soswolf
Nov 11 at 11:34