Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Gnuplot and adding function name to legend

  1. Feb 2, 2007 #1
    Hi,
    I've searched endlessly for an answer to this seemingly simple question, without success.
    I am fitting a lot of data and I am plotting the data and the fit on the same graph. I would like to have gnuplot automatically add the function (with the values determined by the fit) to the legend. Doing this by hand would be very tedious. Any ideas would be appreciated.

    thanks
     
  2. jcsd
  3. Feb 2, 2007 #2

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

  4. Feb 2, 2007 #3
    unfortunately yes :D
    I have tried both of those references. thanks anyway.
    Any other suggestions?
     
  5. Feb 3, 2007 #4

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    Are you using a *nix box??? If so, you could write a script to run the plot and curve fit, then extract teh correct variables out of the fit then put them back into the plot as the legend. Lot of work for something that you could do by hand for a few cases, but if you have many data sets to do it would be worth the effort.
     
  6. Feb 3, 2007 #5
    Yeah, I considered doing that. I figured for a program such as gnuplot, there would be some easy way of doing it. But it seems that is the only way.
    oh well.
    thanks
     
  7. Feb 3, 2007 #6

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    That's exactly what I had to do [via a perl script].
     
  8. Feb 4, 2007 #7

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    When I was in grad school, I would spend hours plotting by hand every data set. When I got out and into industry, I started working a job where if I did that I still would be plotting my first test set. I had to learn how to script using sed & awk along with Korn shell. I once went on a range test, we took over 6 Gig of data (raw ascii file format) in two weeks of range time. It took me a week to write the script and get everything the way I wanted, 3 days to run all the plots ( somewhere in the neighborhood of 25K data sets). I figure I saved the company about two years worth of my salary spending the week learning how to script.
     
  9. Feb 4, 2007 #8

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Hopefully, your efforts were acknowledged and rewarded. Don't just get paid for your time... also get paid for your expertise. However, one should be cautious about revealing all because, in some sense, you could script yourself out of a job.
     
  10. Feb 4, 2007 #9

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    Sure, we get acknowledged, but when the programs die your still out of luck and lay-offs occur. You go and find another position and go on. You never script yourself out of a job because no matter how much you do, your customer always wants more and they are in the business of getting as much out of you as they can for the money. You always have to check the contract deliverables and go by them, if they want extra they have to pay extra. In this day and age, expertise may keep you in a job, but if you are paid too well you are always on the top of the list to get laid off. In industry today, a PhD equals more money, but can also equal less securtiy if you can get a job at all.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Gnuplot and adding function name to legend
  1. Gnuplot program graph (Replies: 0)

  2. Plotting in gnuplot (Replies: 2)

Loading...