Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6998655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:26:19+00:00 2026-05-27T20:26:19+00:00

I am trying to save a histogram to file in R from my Virtual

  • 0

I am trying to save a histogram to file in R from my Virtual Machine.

I use the following R code:

> pdf("graph1.pdf")
> hist(nchar(as.character(m1$qf)),main="First name search 11-14 and 11-15",
  xlab="length of     name")
> dev.off()
null device 
      1 

I get the response: null device 1

If I just run the hist(nchar(as.character(m1$qf)),main="First name search 11-14 and 11-15",xlab="length of name") in the command line I see the correct histogram.

But when saved to pdf, I get something that looks something like this:

ET
BT
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 160.01 Tm (500000) Tj
ET
BT
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 249.50 Tm (1000000) Tj
ET
BT
/F2 1 Tf 0.00 12.00 -12.00 0.00 41.76 342.32 Tm (1500000) Tj
ET
Q q 59.04 73.44 414.72 371.52 re W n
0.000 0.000 0.000 RG
0.75 w
[] 0 d
1 J
1 j
10.00 M
74.40 87.20 16.00 156.65 re S
90.40 87.20 16.00 20.71 re S
106.40 87.20 16.00 86.75 re S

That’s not the histogram I was expecting. How do I save a histogram to file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:26:20+00:00Added an answer on May 27, 2026 at 8:26 pm

    If you are new to plotting in R, I recommend getting an early start on ggplot2

    library(ggplot2)
    data=data.frame(x=rnorm(100))
    plot=qplot(x, data=data, geom="histogram") 
    ggsave(plot,file="graph1.pdf")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to save a file at path WindowsFormsApplication1\WindowsFormsApplication1\SaveFile but the following code returning
Im trying to save a screen from my app with th use of a
Hi i am trying to save text values as binary file and read from
I am trying to save a pdf file in SQLite. I think it will
i am trying to save a file from chrome using AjaxSubmit. i got the
Trying to save output from this script to a file based on a cell
I'm trying to save the images from a third-party API to my own S3
I'm trying to save some information from a user that is saved on the
I'm trying to save some audio data to a WAV file -- I have
When trying to save my SSIS packages from my vs 2008 to my sql

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.