• Posts
  • RSS
  • ◂◂RSS
  • Contact

  • Simple Plotting Software?

    October 12th, 2011
    tech  [html]
    When trying to understand data, looking at it in graphical form is incredibly useful. When looking at raw data it is difficult to get a sense of the overall patterns. Summary statistics can be misleading. Yesterday I wanted to look at some data. My graphing process was:
        # prepare data on the command line into a stream of lines as "xval yval"
        $ emit_data | head -n 3
        4 7
        8 9
        2 200
    
        # use awk to send the xvals to one file and the yvals to another
        $ (emit_data | awk '{print $1}' | tr '\n' ' ' ; echo) > xvals.txt
        $ (emit_data | awk '{print $2}' | tr '\n' ' ' ; echo) > yvals.txt
    
        # in octave open the files as two vectors and plot them
        $ octave
        > xvals = load("xvals.txt");
        > yvals = load("yvals.txt");
        > plot(xvals, yvals);
    

    As you can tell, this is annoying. I would prefer to be able to simply write:

        $ emit_data | plot
    

    Is there a program that can do this?

    Update 2011-10-12: Adam Yie writes that gnuplot can do what I want:
       emit_data | gnuplot -persist -e "plot '-'"
    
    I've now added an alias to my ~/.bash_profile:
      alias plot='gnuplot -persist -e "plot '\'-\''"'
    

    Some other features that would be nice, and that I would probably include if writing this myself:

    • interpret single column data as if it were the output of "emit_data | cat -n"
    • if given filenames instead of standard input, plot them on the same chart ( plot <(emit_data_a) <(emit_data_b))
    • allow non-numeric X vals
    • interpret data in the format 'YYYY-MM-DD" as dates

    Further, it would be nice to be able to specify some options, though I definitely don't want them required:

    • points vs lines
    • x and y ranges
    • chart width and height
    • colors
    • output file if not for display
    • interpret the xvalues as seconds since 1970-01-01

    I would probably write this with gnuplot as a backend, and with aquaterm as the mac display terminal (so I wouldn't need to start X11).

    Comment via: google plus, facebook

    Recent posts on blogs I like:

    The Limit of Circles in the Suburbs

    In dense urban cores, it’s valuable to run circular rail lines. They connect dense near-center neighborhoods to one another without going through the more congested center, and help make transferring between parallel lines more efficient, again through av…

    via Pedestrian Observations September 6, 2020

    Collections: Bread, How Did They Make It? Addendum: Rice!

    As an addendum on to our four-part look at the general structures of the farming of cereal grains (I, II, III, IV) this post is going to briefly discuss some of the key ways that the structures of rice farming differ from the structures of wheat and barle…

    via A Collection of Unmitigated Pedantry September 4, 2020

    Notes on “Anthropology of Childhood” by David Lancy

    I read David Lancy’s “The Anthropology of Childhood: Cherubs, Chattel, and Changelings” and highlighted some passages. A lot of passages, it turns out. [content note: discussion of abortion and infanticide, including infanticide of children with disabilit…

    via The whole sky August 27, 2020

    more     (via openring)


  • Posts
  • RSS
  • ◂◂RSS
  • Contact