+ Reply to Thread
Results 1 to 1 of 1

Thread: Create simple line graph, no data points with "o"'s, etc?

  1. #1
    Points: 1,731, Level: 24
    Level completed: 31%, Points required for next Level: 69

    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Create simple line graph, no data points with "o"'s, etc?



    I'm trying to generate a simple line graph of the iterations of a given natural number n, of the collatz conjecture, by importing the data from a csv file. For example, n=27 yields the attached data (I can't upload csv, so it's a txt file instead). I want to create a line graph like the one wikipedia displays, here:

    http://upload.wikimedia.org/wikipedi...6/Collatz5.svg

    where the data points aren't marked by some large point of an "o" or something to that effect. However, this code is all I can come up with:

    Code: 
    c <- read.csv("data_27.csv", head=TRUE, sep=",")
    
    max_x = max(c$n)
    
    max_y = max(c$Value)
    
    plot_colors <- c("blue","red","forestgreen")
    
    jpeg(filename="27.jpg", bg="white")
    
    plot(c$n, c$Value, pch=46, col=plot_colors[1], xlim=c(0, max_x), ylim=c(0, max_y), axes=FALSE, ann=FALSE)
    lines(c$Value, pch=46, lty=1, col=plot_colors[1])
    
    axis(1, las=1, at=2*0:max_x)
    
    axis(2, las=1, at=2000*0:max_y)
    
    box()
    
    title(main="Collatz Sequence: 27", col.main="blue", font.main=3)
    
    title(xlab= "n", col.lab=rgb(0,0.5,0))
    
    title(ylab= "Value", col.lab=rgb(0,0.5,0))
    
    dev.off()
    which generates the attached jpeg, in which the data points are very obvious and the whole graph looks somewhat ugly. Can anyone help me create a better graph?
    Attached Images
    Attached Files

+ Reply to Thread

Similar Threads

  1. Analysis of simple "yes/no" data
    By Captain Sensible in forum Statistics
    Replies: 9
    Last Post: 11-30-2010, 10:28 PM
  2. How do i create "nice" prediction hyperbola?
    By thedreamshaper in forum Regression Analysis
    Replies: 3
    Last Post: 09-16-2010, 03:55 PM
  3. Replies: 2
    Last Post: 09-14-2010, 04:54 PM
  4. Replies: 4
    Last Post: 06-10-2010, 12:56 PM
  5. "Hepatitis" and "Golf" probabilities.
    By DAI&DF in forum Probability
    Replies: 7
    Last Post: 06-01-2008, 06:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats