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

  • SEARCH
  • Home
  • 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 7644401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:40:47+00:00 2026-05-31T09:40:47+00:00

I have a data frame that has dates, disk reads and disk writes data.

  • 0

I have a data frame that has dates, disk reads and disk writes data. I am able to create the stack chart but the dates on xaxis are not readable. Is there an option in qplot to scale the graph or dont display all of the dates or something? I’ve been looking at this now for a long time, I couldn’t find an answer.

I melt it first

app1_diskIO.M<-melt(app1_diskIO.M, id=c("Date2"))

qplot(x = factor(Date2), y = value, data = app1_diskIO.M, geom = "bar", fill = variable, main="DISK IO", xlab="Date", ylab="Disk IO")

Data frame looks like this:

       Date2 DiskReads DiskWrites
1  2011-12-06  136382.2    78961.0
2  2011-12-07  146277.0    77802.0
3  2011-12-08  141123.6    76219.0
4  2011-12-09  139219.8    77649.4
5  2011-12-10   72101.1    35258.6
6  2011-12-11  229445.9    92316.6
7  2011-12-12  175886.7    86087.0
8  2011-12-13  134958.3    76605.6
9  2011-12-14  133972.1    75141.4
10 2011-12-15  147175.2    77189.7
11 2011-12-16  143542.3    78155.9
12 2011-12-17  152579.1    68395.2
13 2011-12-18  168667.7    69720.1
14 2011-12-19  152328.6    75994.2
15 2011-12-20  135061.8    75271.6
16 2011-12-21  153455.0    78197.5
17 2011-12-22  130020.8    73369.7
18 2011-12-23  131423.6    73484.9
19 2011-12-24  135285.6    65081.4
20 2011-12-25  137185.4    63334.8
21 2011-12-26  132612.9    70484.4
22 2011-12-27  155396.9    79239.1
23 2011-12-28  151587.5    77986.5
24 2011-12-29  122076.5    71575.5
25 2011-12-30  146888.8    75376.3
26 2011-12-31  141285.5    69737.8
27 2012-01-01  206306.6    78059.4
28 2012-01-02  134002.4    73062.5
29 2012-01-03  137753.8    76947.4
30 2012-01-04  150655.8    78836.3
31 2012-01-05  151750.3    79300.9
32 2012-01-06  141464.8    77529.4
33 2012-01-07  137667.3    66344.8
34 2012-01-08  120998.5    60582.4
35 2012-01-09  133422.4    73688.3
36 2012-01-10  134247.7    75664.5
37 2012-01-11  146243.5    79042.2
38 2012-01-12  178738.2    84199.7
39 2012-01-13  145564.8    77908.2
40 2012-01-14  135966.8    65900.9
41 2012-01-15  136448.4    63339.9
42 2012-01-16  186109.9    83348.6
43 2012-01-17  146906.5    78645.6
44 2012-01-18  106343.0    69313.6
45 2012-01-19  197205.6    88411.6
46 2012-01-20  132950.1    73078.0
47 2012-01-21  137488.1    68711.5
  • 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-31T09:40:48+00:00Added an answer on May 31, 2026 at 9:40 am

    How about rotating the dates to be vertical, that makes them a bit more legible:

    qplot(x = factor(Date2), y = value, data = app1_diskIO.M, 
         geom = "bar", fill = variable, main = "DISK IO", 
         xlab = "Date", ylab = "Disk IO") +
         opts(axis.text.x = theme_text(angl e =-90))
    

    enter image description here

    You could also reduce the font size (is that what you mean by scale?), but that doesn’t make it any easier to read. To do this, add a size argument in the opts

    qplot(x = factor(Date2), y = value, data = app1_diskIO.M, 
         geom = "bar", fill = variable, main = "DISK IO", 
         xlab = "Date", ylab = "Disk IO") +
         opts(axis.text.x = theme_text(angle = -90, size = 5))
    

    To remove all tick marks and labels on X axis (so you’re not displaying any dates, as you request, maybe you might use a graphics editor to put something else there?), try this:

    qplot(x = factor(Date2), y = value, data = app1_diskIO.M, 
         geom = "bar", fill = variable, main = "DISK IO", 
         xlab = "Date", ylab = "Disk IO")  + 
         opts(axis.ticks = theme_blank(), axis.text.x = theme_blank())
    

    UPDATE: To space out the x axis labels, say one every ten days, as you request, try this:

    app1_diskIO.M$Date2 <- as.Date(app1_diskIO.M$Date2)
    qplot(x = Date2, 
          y = value, data = app1_diskIO.M, 
          geom = "line", colour = variable, 
          main="DISK IO", xlab="Date", 
          ylab="Disk IO") +
          scale_x_date(breaks = "10 days") +
          opts(axis.text.x = theme_text(angle = -90))
    

    Which should give you:

    enter image description here

    Useful website with excellent instructions for doing this kind of stuff: http://wiki.stdout.org/rcookbook/Graphs/Axes%20(ggplot2)/

    The guide to the updates in ggplot2 0.9 is very handy too, with lots of good examples: http://cloud.github.com/downloads/hadley/ggplot2/guide-col.pdf

    Related question: need to create a stack bar chart

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data frame in R that has come about from running some
I have a data.frame and I'm trying to create a frequency table that shows
I have this huge data frame that has servernames, Date, CPU, memory as the
I have a column of data in a R data frame that has values
I have a data.frame that has a number of duplicate rows, akin to something
I have a data.frame, d1, that has 7 columns, the 5th through 7th column
I often run into an issue where I have a data frame that has
I have a data frame that has a format like the following: Month Frequency
I have a data.frame that looks like this: > head(ff.df) .id pio caremgmt prev
I have a data.frame in R that looks like this: score rms template aln_id

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.