|
From: Justace C. <pro...@co...> - 2005-04-02 19:54:42
|
Problem fixed, inadvertantly had two different versions of gnuplot
installed, one in /usr/local/bin and one in /usr/bin. The one
in /usr/local/bin/works correctly. Sorry for the uneeded traffic.
Justace
On Sat, 2005-04-02 at 07:35 -0600, Justace Clutter wrote:
> Hey everybody,
>
> So, I have just encountered a small problem. I usually create a
> gnuplot script that can just be executed from the command line in Linux.
> I do this throught the #! style. Here is the thing though, I want to
> use sprintf. When I use sprintf in an interactive session it works
> fine. When I put this line in a script I get the following error:
>
> gnuplot> blah = sprintf("Hello")
> ^
> "./cost", line 54: invalid expression
>
> I will include the script just below so that we can see if I am missing
> anything. I am running version 4.1 patchlevel 0. Thanks for any
> information.
>
>
> --------------------Script Below
> #!/usr/bin/gnuplot
>
> budget = 1000
>
> gas_rate = 2.20
> trip_distance = 1400
>
> auto_insurance = 24.95
>
> car_mpg = 25
> car_cost = 30 + auto_insurance
> car_cap = 4
>
> van_mpg = 15
> van_cost = 75 + auto_insurance
> van_cap = 9
>
> hotel_cost = 75
> hotel_cap = 4
>
> NumberOfVans(x) = ceil(x/van_cap)
> NumberOfCars(x) = ceil(x/car_cap)
>
> HotelCost(x) = hotel_cost * (ceil(x/hotel_cap))
> VanCost(x) = NumberOfVans(x)*van_cost +
> NumberOfVans(x)*((trip_distance/van_mpg)*gas_rate)
> CarCost(x) = NumberOfCars(x)*car_cost +
> NumberOfCars(x)*((trip_distance/car_mpg)*gas_rate)
>
> TripCostVan(x) = HotelCost(x) + VanCost(x)
> TripCostCar(x) = HotelCost(x) + CarCost(x)
>
> AdditionalCostVanUnbound(x) = (TripCostVan(x)-budget)/x
> AdditionalCostCarUnbound(x) = (TripCostCar(x)-budget)/x
>
> AdditionalCostVan(x) = AdditionalCostVanUnbound(x)<0 ? 1/0 :
> AdditionalCostVanUnbound(x)
> AdditionalCostCar(x) = AdditionalCostCarUnbound(x)<0 ? 1/0 :
> AdditionalCostCarUnbound(x)
>
> set title "Cost of the SPS Fermilab Trip"
> set xlabel "Person Count"
> set ylabel "Cost"
>
> set samples 10000
> set xrange [1:30]
> set yrange [0:2000]
> set y2range [0:100]
>
> set key left
> set xtics 1
> set ytics auto
> set ytics nomirror
> set y2tics auto
> set y2tics nomirror
>
> #blah = gprintf("Gas Rate %2.2f", gas_rate)
> blah = sprintf("Hello")
>
> set label blah at .2,.7
>
> plot TripCostVan(x) with lines title "Vans", TripCostCar(x) with lines
> title "Cars", \
> AdditionalCostVan(x) with lines axes x1y2 title "Additional Cost
> (Van)", \
> AdditionalCostCar(x) with lines axes x1y2 title "Additional Cost
> (Car)", \
> budget with lines title ""
>
> pause -1
>
>
>
>
>
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> gnuplot-beta mailing list
> gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
|