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")









share|improve this question
























  • 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










  • I use the soluce to save sur graph as pdf and open it after.
    – Soswolf
    Nov 11 at 11:34















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")









share|improve this question
























  • 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










  • I use the soluce to save sur graph as pdf and open it after.
    – Soswolf
    Nov 11 at 11:34













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")









share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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


















  • 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










  • 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












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.






share|improve this answer





















  • 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











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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

























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.






share|improve this answer





















  • 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















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.






share|improve this answer





















  • 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













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.






share|improve this answer












#!/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.







share|improve this answer












share|improve this answer



share|improve this answer










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


















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python